fix: tag removal; keys: tag mod
This commit is contained in:
@@ -1,14 +1,3 @@
|
|||||||
" This function is used to autocomplete the tags in user commands.
|
|
||||||
function s:tagList(ArgLead, cmdLine, CursorPos)
|
|
||||||
let l:files=glob(g:denote_directory .. '/*', 0, v:true)
|
|
||||||
let l:tags=[]
|
|
||||||
for f in l:files
|
|
||||||
let l:tags=extend(l:tags, denote#meta#noteTagsFromFile(f))
|
|
||||||
endfor
|
|
||||||
return uniq(sort(l:tags))->join("\n")
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
" Public commands
|
" Public commands
|
||||||
function denote#commands#load()
|
function denote#commands#load()
|
||||||
if exists('g:denote_commands_loaded') && g:denote_commands_loaded
|
if exists('g:denote_commands_loaded') && g:denote_commands_loaded
|
||||||
@@ -16,7 +5,7 @@ function denote#commands#load()
|
|||||||
endif
|
endif
|
||||||
" Register user commands
|
" Register user commands
|
||||||
command -nargs=* Denote call denote#notes#list(<q-args>) | lcl | lopen
|
command -nargs=* Denote call denote#notes#list(<q-args>) | lcl | lopen
|
||||||
command -nargs=1 -complete=custom,s:tagList DenoteByTag call denote#notes#bytag(<q-args>) | lcl | lopen
|
command -nargs=1 -complete=custom,denote#completion#tags DenoteByTag call denote#notes#bytag(<q-args>) | lcl | lopen
|
||||||
command -nargs=+ DenoteGrep call denote#notes#grep(<q-args>) | lcl | lopen
|
command -nargs=+ DenoteGrep call denote#notes#grep(<q-args>) | lcl | lopen
|
||||||
command -nargs=1 DenoteNew call denote#notes#new(<q-args>)
|
command -nargs=1 DenoteNew call denote#notes#new(<q-args>)
|
||||||
|
|
||||||
|
|||||||
@@ -47,3 +47,13 @@ endfunction
|
|||||||
function denote#completion#get(findstart, base)
|
function denote#completion#get(findstart, base)
|
||||||
return a:findstart == 1 ? s:column() : s:suggestions(a:base)
|
return a:findstart == 1 ? s:column() : s:suggestions(a:base)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Completion function for denote tags
|
||||||
|
function denote#completion#tags(ArgLead, cmdLine, CursorPos)
|
||||||
|
let l:files=glob(g:denote_directory .. '/*', 0, v:true)
|
||||||
|
let l:tags=[]
|
||||||
|
for f in l:files
|
||||||
|
let l:tags=extend(l:tags, denote#meta#noteTagsFromFile(f))
|
||||||
|
endfor
|
||||||
|
return uniq(sort(l:tags))->join("\n")
|
||||||
|
endfunction
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ function denote#ft#qf()
|
|||||||
" Denote-list specific configuration
|
" Denote-list specific configuration
|
||||||
if l:context['denote'] == 'list'
|
if l:context['denote'] == 'list'
|
||||||
command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(<line1>, <q-args>)
|
command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(<line1>, <q-args>)
|
||||||
command! -nargs=1 -range -buffer DenoteTagAdd :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:true)
|
command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagAdd :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:true)
|
||||||
command! -nargs=1 -range -buffer DenoteTagRm :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:false)
|
command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagRm :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:false)
|
||||||
|
nnoremap <buffer> C :DenoteSetTitle
|
||||||
|
nnoremap <buffer> + :DenoteTagAdd
|
||||||
|
nnoremap <buffer> - :DenoteTagRm
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function denote#notes#tagmod(line1, line2, tag, add)
|
|||||||
if l:idx == -1
|
if l:idx == -1
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
call remove(l:notetags, a:tag)
|
call remove(l:notetags, l:idx)
|
||||||
endif
|
endif
|
||||||
let l:notesignature = denote#meta#noteSignatureFromFile(l:filename)
|
let l:notesignature = denote#meta#noteSignatureFromFile(l:filename)
|
||||||
let l:title = denote#meta#noteTitleFromFile(l:filename)
|
let l:title = denote#meta#noteTitleFromFile(l:filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user