From f67c22bfa7a56d55944c2c709f0d31d42dab3094 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 4 May 2021 14:08:05 +0200 Subject: [PATCH] Move debug plugin setup to separate debug.vim file Begin to prepare using the plugin by moving debug stuff away from the normal mode of operation. --- plugin/debug.vim | 20 ++++++++++++++++++++ plugin/zettelkasten.vim | 26 ++++---------------------- 2 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 plugin/debug.vim 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