diff --git a/plugin/debug.vim b/plugin/debug.vim new file mode 100644 index 0000000..760957c --- /dev/null +++ b/plugin/debug.vim @@ -0,0 +1,20 @@ +" TODO for DEBUGGING ONLY: reloads the whole lua plugin +fun! ZKReload() + lua for k in pairs(package.loaded) do if k:match("^zettelkasten") then package.loaded[k] = nil end end + lua require 'zettelkasten' +endfun +nnoremap R :call ZKReload() + +augroup Zettelkasten + autocmd! +augroup END + +command! ZKOpen lua require('zettelkasten').open_link() + +command! -range ZKCreate lua require('zettelkasten').create_link() + +" example plug mappings +" nnoremap Zettel_Link :call zettelkasten#zettel_link() +map i zettel_link_open + +map zettel_link_follow diff --git a/plugin/zettelkasten.vim b/plugin/zettelkasten.vim index d06f541..29323b2 100644 --- a/plugin/zettelkasten.vim +++ b/plugin/zettelkasten.vim @@ -2,31 +2,13 @@ if exists('g:loaded_zettelkasten') finish endif -" TODO for DEBUGGING ONLY: reloads the whole lua plugin -fun! ZKReload() - lua for k in pairs(package.loaded) do if k:match("^zettelkasten") then package.loaded[k] = nil end end - lua require 'zettelkasten' -endfun -nnoremap R :call ZKReload() -augroup Zettelkasten - autocmd! -augroup END - -command! ZKOpen lua require('zettelkasten').open_link() - -command! -range ZKCreate lua require('zettelkasten').create_link() - -" example plug mappings -" nnoremap Zettel_Link :call zettelkasten#zettel_link() -nnoremap zettel_link_open :lua require 'zettelkasten'.open_link() -vnoremap zettel_link_open :lua require 'zettelkasten'.open_link() -nmap i zettel_link_open -vmap i zettel_link_open +noremap zettel_link_open :lua require 'zettelkasten'.open_link() nnoremap zettel_link_make :lua require 'zettelkasten'.make_link() vnoremap zettel_link_make :lua require 'zettelkasten'.make_link(true) -nmap o zettel_link_make -vmap o zettel_link_make + +nnoremap zettel_link_follow :lua require 'zettelkasten'.open_or_make_link() +vnoremap zettel_link_follow :lua require 'zettelkasten'.open_or_make_link(true) let g:loaded_zettelkasten = 1