dotfiles/writing/zk/config/sh/alias.d/zk.sh
Marty Oehme 8555021527
zk: Split nnn quicknote and nni idea alias
nni Quickly lets me dump an idea, while nnn quickly lets me create a new
note in the notes inbox.
2025-03-15 20:08:44 +01:00

41 lines
969 B
Bash

#!/usr/bin/env sh
#
_zk_wiki() {
zk --working-dir="$WIKIROOT" "$@"
}
n() {
if [ $# -eq 0 ]; then
_zk_wiki edit -i
else
_zk_wiki "${@}"
fi
}
# We have a local wiki
if [ -n "${WIKIROOT}" ]; then
# open notes with my vim zettelkasten plugin
# TODO better implementation conditional on zk.nvim & zettelkasten existing
# nvim +'lua pcall(require "zk.commands"') --headless +qa 2>&1 or similar to check - but slow
if command -v nvim >/dev/null 2>&1; then
alias ni='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"edit $WIKIROOT/index.md"'
fi
alias ncd='cd $WIKIROOT'
nn() { # 'new note'
_zk_wiki new "$@"
}
nnn() { # 'new quicknote'
_zk_wiki new -t "${*}" inbox
}
nnl() { # 'new note log'
_zk_wiki log "$@"
}
nnd() { # 'new note draft'
_zk_wiki draft "$@"
}
nni() { # 'new note idea'
_zk_wiki edit -n 1 -m idea dump
}
fi