nvim: Enter notes dir when calling zettel index
When switching the current buffer to the Zettelkasten index page (`<leader>ni`), we now also switch the working directory to the corresponding notes directory.
This commit is contained in:
parent
20b9d432ac
commit
22b70a0639
3 changed files with 20 additions and 13 deletions
|
@ -103,6 +103,9 @@ local prose_plugs = {
|
||||||
-- simple static markdown linking and link following using zettel IDs
|
-- simple static markdown linking and link following using zettel IDs
|
||||||
{
|
{
|
||||||
"marty-oehme/zettelkasten.nvim",
|
"marty-oehme/zettelkasten.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"mickael-menu/zk-nvim", -- for the CD when opening index
|
||||||
|
},
|
||||||
ft = writing_ft,
|
ft = writing_ft,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
|
@ -122,6 +125,7 @@ local prose_plugs = {
|
||||||
{
|
{
|
||||||
"<leader>ni",
|
"<leader>ni",
|
||||||
function()
|
function()
|
||||||
|
require("zk.commands").get("ZkCd")()
|
||||||
require("zettelkasten").index_open()
|
require("zettelkasten").index_open()
|
||||||
end,
|
end,
|
||||||
desc = "index page",
|
desc = "index page",
|
||||||
|
|
9
nvim/.config/sh/alias.d/neovim.sh
Normal file
9
nvim/.config/sh/alias.d/neovim.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# v shorthand for neovim
|
||||||
|
if exist nvim; then
|
||||||
|
alias v="nvim"
|
||||||
|
alias vim="nvim"
|
||||||
|
|
||||||
|
# open notes with my vim zettelkasten plugin
|
||||||
|
# TODO better implementation conditional on zk & zettelkasten existing
|
||||||
|
alias vn='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"lua require \"zettelkasten\".index_open()"'
|
||||||
|
fi
|
|
@ -7,20 +7,14 @@ exist() { type "$1" >/dev/null 2>&1; }
|
||||||
# Avoid aliases which I did not create -- unalias EVERYTHING
|
# Avoid aliases which I did not create -- unalias EVERYTHING
|
||||||
unalias -a
|
unalias -a
|
||||||
|
|
||||||
# v shorthand for neovim
|
if alias v >/dev/null 2>&1; then
|
||||||
if exist nvim; then
|
if exist vim; then
|
||||||
alias v="nvim"
|
|
||||||
alias vim="nvim"
|
|
||||||
alias vs="nvim -c 'ScratchPad'" # open an empty 'scratchpad' which simply disappears after use
|
|
||||||
alias vw="nvim -c \"lua require 'zettelkasten'.index_open()\"" # open to personal wiki
|
|
||||||
elif exist vim; then
|
|
||||||
alias v="vim"
|
alias v="vim"
|
||||||
else
|
else
|
||||||
alias v="vi"
|
alias v="vi"
|
||||||
alias vim="vi"
|
alias vim="vi"
|
||||||
fi
|
fi
|
||||||
# open notes with my vim zettelkasten plugin
|
fi
|
||||||
alias vn='v +"lua require \"zettelkasten\".index_open()"'
|
|
||||||
|
|
||||||
# exit shell mimicks vim
|
# exit shell mimicks vim
|
||||||
alias :q="exit"
|
alias :q="exit"
|
||||||
|
|
Loading…
Reference in a new issue