feat: reload key

This commit is contained in:
2026-02-26 14:20:03 +01:00
parent 7a82fe32db
commit 864b678b9e
5 changed files with 43 additions and 8 deletions

View File

@@ -50,14 +50,14 @@ endfor
endfunction
" Re-populate location list with denote entries
function denote#loclist#fill(title, files)
function denote#loclist#fill(title, files, Gfun)
" Clear first
call setloclist(0, [], ' ')
" Set properties
call setloclist(0, [], 'r',
\ {'title': a:title,
\ 'quickfixtextfunc' : 'denote#loclist#textNoteList',
\ 'context' : 'denote'})
\ 'context' : {'denote': 'list', 'gfun': a:Gfun}})
" Populate
let l:notes=[]
for f in a:files
@@ -70,9 +70,19 @@ function denote#loclist#fill(title, files)
endfunction
" Specify location list as denote-grep list
function denote#loclist#setgrep(title)
function denote#loclist#setgrep(title, Gfun)
call setloclist(0, [], 'r',
\ {'title': a:title,
\ 'quickfixtextfunc' : 'denote#loclist#textReferences',
\ 'context' : 'denote'})
\ 'context' : {'denote': 'grep', 'gfun': a:Gfun}})
endfunction
" Reload location list
function denote#loclist#reload()
let l:context = getloclist(0, {'context': 1})['context']
if has_key(l:context, 'denote') && has_key(l:context, 'gfun')
execute ':lclose'
call l:context['gfun']()
execute ':lwindow'
endif
endfunction