added key o for other files

This commit is contained in:
2026-03-04 11:38:04 +01:00
parent e1c3ea09da
commit 270be048dc
2 changed files with 11 additions and 13 deletions

View File

@@ -39,6 +39,12 @@ endif
" Denote-list specific configuration " Denote-list specific configuration
if b:context['denote'] == 'list' if b:context['denote'] == 'list'
function OpenDenoteEntry()
let l:item = getloclist(0, {'items': 1})['items'][line('.')-1]
let l:bufnr = l:item['bufnr']
let l:filename = bufname(l:bufnr)
call system('open ' .. shellescape(l:filename))
endfunction
command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(<line1>, <q-args>) | :normal r command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(<line1>, <q-args>) | :normal r
command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagAdd :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:true) | :normal r command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagAdd :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:true) | :normal r
command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagRm :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:false) | :normal r command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagRm :call denote#notes#tagmod(<line1>, <line2>, <q-args>, v:false) | :normal r
@@ -47,19 +53,8 @@ if b:context['denote'] == 'list'
nnoremap <buffer> + :DenoteTagAdd nnoremap <buffer> + :DenoteTagAdd
nnoremap <buffer> - :DenoteTagRm nnoremap <buffer> - :DenoteTagRm
nnoremap <buffer> dd :DenoteDelete<CR>r nnoremap <buffer> dd :DenoteDelete<CR>r
nnoremap <buffer> o :call OpenDenoteEntry()<CR>
xnoremap <buffer> + :DenoteTagAdd xnoremap <buffer> + :DenoteTagAdd
xnoremap <buffer> - :DenoteTagRm xnoremap <buffer> - :DenoteTagRm
xnoremap <buffer> d :DenoteDelete<CR> xnoremap <buffer> d :DenoteDelete<CR>
" 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 <buffer> <Enter> :call OpenDenoteEntry()<CR>
endif endif

View File

@@ -1,6 +1,6 @@
*denote.txt* Handling denote entries the vim way *denote.txt* Handling denote entries the vim way
Last change: 2026 Mar 3 Last change: 2026 Mar 4
This is the documentation for the denote package. This package also introduces This is the documentation for the denote package. This package also introduces
the |libdenote| plugin in the file autoload/libdenote.vim, which may be of the |libdenote| plugin in the file autoload/libdenote.vim, which may be of
@@ -257,6 +257,9 @@ C Change the title of the selected entry.
dd Delete the selected entry. dd Delete the selected entry.
{Visual}d Delete the visually selected entries. {Visual}d Delete the visually selected entries.
*denote-list-o*
o Open the file using the system "open" command.
============================================================================== ==============================================================================
APPENDIX A - THE LIBDENOTE PLUGIN *libdenote* APPENDIX A - THE LIBDENOTE PLUGIN *libdenote*