refacotred and split
This commit is contained in:
32
autoload/denote/commands.vim
Normal file
32
autoload/denote/commands.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
" This function is used to autocomplete the tags in user commands.
|
||||
function s:tagList(ArgLead, cmdLine, CursorPos)
|
||||
let files=glob(g:denote_directory .. "/*", 0, v:true)
|
||||
let tags=[]
|
||||
for f in files
|
||||
let tags=extend(tags, denote#meta#noteTagsFromFile(f))
|
||||
endfor
|
||||
return uniq(sort(tags))->join("\n")
|
||||
endfunction
|
||||
|
||||
|
||||
" Public commands
|
||||
function denote#commands#load()
|
||||
if exists('g:denote_commands_loaded') && g:denote_commands_loaded
|
||||
return
|
||||
endif
|
||||
" Register user commands
|
||||
command -nargs=* Denote call denote#notes#list(<q-args>) | lcl | lw
|
||||
command -nargs=1 -complete=custom,s:tagList DenoteByTag call denote#notes#bytag(<q-args>) | lcl | lw
|
||||
command -nargs=+ DenoteGrep call denote#notes#grep(<q-args>) | lcl | lw
|
||||
command -nargs=1 DenoteNew call denote#notes#new(<q-args>)
|
||||
|
||||
" Register auto commands
|
||||
autocmd BufReadPost quickfix call denote#ft#qf()
|
||||
let l:aupat = map(copy(g:denote_note_file_extensions), {_, v -> '*.' .. v})->join(',')
|
||||
exe 'autocmd BufReadPost ' .. l:aupat .. ' call denote#ft#denote()'
|
||||
|
||||
" Useful key mappings
|
||||
" nnoremap <silent> <Plug>DenoteList :DenoteSearch<CR>:lclose<CR>:lopen<CR>:resize 20<CR>
|
||||
" nnoremap <silent> <Plug>DenoteBackReferences :DenoteBackReferences<CR>:lclose<CR>:lopen<CR>:resize 20<CR>
|
||||
let g:denote_commands_loaded = v:true
|
||||
endfunction
|
||||
Reference in New Issue
Block a user