This commit is contained in:
2026-03-03 23:03:34 +01:00
parent 2270ab9069
commit 66e032ee38
14 changed files with 338 additions and 356 deletions

View File

@@ -5,10 +5,10 @@ endfunction
" Local helper function to retrieve and format the title.
function s:titleFromBuf(buf)
let l:name=denote#meta#noteTitleFromFile(bufname(a:buf))
return strchars(l:name, 1) <= g:denote_loc_title_columns
\ ? printf('%' .. g:denote_loc_title_columns .. 's', l:name)
\ : printf('%.' .. (g:denote_loc_title_columns - 1) .. 's', l:name) .. '…'
let l:name = libdenote#scheme_metadata(bufname(a:buf)).title
return strchars(l:name, 1) <= g:denote_loc_title_columns
\ ? printf('%' .. g:denote_loc_title_columns .. 's', l:name)
\ : printf('%.' .. (g:denote_loc_title_columns - 1) .. 's', l:name) .. '…'
endfunction
" Local helper function to truncate text with match at the given column as a
@@ -20,7 +20,7 @@ function s:formatText(text, col, width)
endfunction
" This modifies the location list for pretty display.
function denote#loclist#textReferences(info)
function s:textReferences(info)
let l:items=getloclist(a:info.winid)
let l:l=[]
let l:width=winwidth(0) - g:denote_loc_title_columns - 19
@@ -37,15 +37,15 @@ function denote#loclist#textReferences(info)
endfunction
" This modifies the location list for pretty display.
function denote#loclist#textNoteList(info)
function s:textNoteList(info)
let l:items=getloclist(a:info.winid)
let l:l=[]
for idx in range(a:info.start_idx - 1, a:info.end_idx - 1)
let l:e=l:items[idx]
let l:name=s:titleFromBuf(l:e.bufnr)
let l:ntags=denote#meta#noteTagsFromFile(bufname(l:e.bufnr))->join()
let l:ntags = libdenote#scheme_metadata(bufname(l:e.bufnr)).tags->join()
call add(l:l, l:name .. ' | ' .. l:ntags)
endfor
endfor
return l:l
endfunction
@@ -56,7 +56,7 @@ function denote#loclist#fill(title, files, Gfun)
" Set properties
call setloclist(0, [], 'r',
\ {'title': a:title,
\ 'quickfixtextfunc' : 'denote#loclist#textNoteList',
\ 'quickfixtextfunc' : 's:textNoteList',
\ 'context' : {'denote': 'list', 'gfun': a:Gfun}})
" Populate
let l:notes=[]
@@ -73,7 +73,7 @@ endfunction
function denote#loclist#setgrep(title, Gfun)
call setloclist(0, [], 'r',
\ {'title': a:title,
\ 'quickfixtextfunc' : 'denote#loclist#textReferences',
\ 'quickfixtextfunc' : 's:textReferences',
\ 'context' : {'denote': 'grep', 'gfun': a:Gfun}})
endfunction