zk: Check WIKIROOT before adding n alias for zk
Since this function also requires a WIKIROOT to be available in the environment, we should only define it if that variable is not empty -- just like all the other zk aliases and functions.
This commit is contained in:
parent
6aa8aefe0e
commit
cf544e4740
1 changed files with 13 additions and 13 deletions
|
|
@ -1,20 +1,20 @@
|
|||
#!/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
|
||||
|
||||
_zk_wiki() {
|
||||
zk --working-dir="$WIKIROOT" "$@"
|
||||
}
|
||||
|
||||
n() {
|
||||
if [ $# -eq 0 ]; then
|
||||
_zk_wiki edit -i
|
||||
else
|
||||
_zk_wiki "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue