" Run this plugin only if the denote package has been setup if !exists('g:denote_directory') finish endif " Load only once per buffer if exists('b:loaded_denote_ftplugin_qf') finish endif let b:loaded_denote_ftplugin_qf = 1 " This will be called for every location and quickfix, when data is loaded into " the list. This does nothing for such lists that are note 'denote' lists. let b:context = getloclist(0, {'context': 1})['context'] if type(b:context) != v:t_dict || !has_key(b:context, 'denote') " Clear settings set spell< nmapclear finish endif setlocal nospell nnoremap q :lclose " Reload capability if has_key(b:context, 'gfun') function DenoteLocListReload() let curl = line('.') let Gfun = b:context['gfun'] call denote#loclist#jumptowindow() exe 'lclose' call Gfun() exe 'lwindow' exe curl endfunction nnoremap r :call DenoteLocListReload() endif " Denote-list specific configuration if b:context['denote'] == 'list' command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(, ) | :normal r command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagAdd :call denote#notes#tagmod(, , , v:true) | :normal r command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagRm :call denote#notes#tagmod(, , , v:false) | :normal r command! -range -buffer -bang DenoteDelete :call denote#notes#rm(, , 0) | :normal r nnoremap C :DenoteSetTitle nnoremap + :DenoteTagAdd nnoremap - :DenoteTagRm nnoremap dd :DenoteDeleter xnoremap + :DenoteTagAdd xnoremap - :DenoteTagRm xnoremap d :DenoteDelete " Open non-notes using the 'open' command function OpenDenoteEntry() let l:item = getloclist(0, {'items': 1})['items'][line('.')-1] let l:bufnr = l:item['bufnr'] let l:filename = bufname(l:bufnr) if index(g:denote_note_file_extensions, fnamemodify(l:filename, ':e')) == -1 call system('open ' .. shellescape(l:filename)) else exe 'edit ' .. fnameescape(l:filename) endif endfunction nnoremap :call OpenDenoteEntry() endif