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.
This commit is contained in:
Marty Oehme 2021-05-04 14:08:05 +02:00
parent 477ec45d22
commit f67c22bfa7
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 24 additions and 22 deletions

20
plugin/debug.vim Normal file
View file

@ -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 <leader>R :call ZKReload()<cr>
augroup Zettelkasten
autocmd!
augroup END
command! ZKOpen lua require('zettelkasten').open_link()
command! -range ZKCreate lua require('zettelkasten').create_link()
" example plug mappings
" nnoremap <Plug>Zettel_Link :call zettelkasten#zettel_link()<cr>
map <leader>i <Plug>zettel_link_open
map <cr> <Plug>zettel_link_follow

View file

@ -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 <leader>R :call ZKReload()<cr>
augroup Zettelkasten
autocmd!
augroup END
command! ZKOpen lua require('zettelkasten').open_link()
command! -range ZKCreate lua require('zettelkasten').create_link()
" example plug mappings
" nnoremap <Plug>Zettel_Link :call zettelkasten#zettel_link()<cr>
nnoremap <Plug>zettel_link_open :lua require 'zettelkasten'.open_link()<cr>
vnoremap <Plug>zettel_link_open :lua require 'zettelkasten'.open_link()<cr>
nmap <leader>i <Plug>zettel_link_open
vmap <leader>i <Plug>zettel_link_open
noremap <Plug>zettel_link_open :lua require 'zettelkasten'.open_link()<cr>
nnoremap <Plug>zettel_link_make :lua require 'zettelkasten'.make_link()<cr>
vnoremap <Plug>zettel_link_make :lua require 'zettelkasten'.make_link(true)<cr>
nmap <leader>o <Plug>zettel_link_make
vmap <leader>o <Plug>zettel_link_make
nnoremap <Plug>zettel_link_follow :lua require 'zettelkasten'.open_or_make_link()<cr>
vnoremap <Plug>zettel_link_follow :lua require 'zettelkasten'.open_or_make_link(true)<cr>
let g:loaded_zettelkasten = 1