zk: Ensure global wiki cmds are always executed in wiki
We use a custom zk indirection which ensures that any short alias for interacting with the zk wiki will actually act on the globally assigned wiki (by ensuring notebooks dir is "$WIKIROOT").
This commit is contained in:
parent
44cd4481a2
commit
613df98520
1 changed files with 15 additions and 3 deletions
|
@ -1,14 +1,20 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
|
||||
_zk_wiki() {
|
||||
zk --notebook-dir="$WIKIROOT" "$@"
|
||||
}
|
||||
|
||||
n() {
|
||||
if [ $# -eq 0 ]; then
|
||||
zk edit -i
|
||||
_zk_wiki edit -i
|
||||
else
|
||||
zk "${@}"
|
||||
_zk_wiki "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# We have a local wiki
|
||||
if [ -n "${WIKIROOT}" ]; then
|
||||
# open notes with my vim zettelkasten plugin
|
||||
|
@ -18,5 +24,11 @@ if [ -n "${WIKIROOT}" ]; then
|
|||
alias ni='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"edit $WIKIROOT/index.md"'
|
||||
fi
|
||||
|
||||
alias ncd='pushd $WIKIROOT'
|
||||
alias ncd='cd $WIKIROOT'
|
||||
nnd() {
|
||||
_zk_wiki draft "$@"
|
||||
}
|
||||
nn() {
|
||||
_zk_wiki new "$@"
|
||||
}
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue