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:
Marty Oehme 2025-02-22 13:28:30 +01:00
parent 44cd4481a2
commit 613df98520
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -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