diff --git a/after/ftplugin/qf.vim b/after/ftplugin/qf.vim index d30232c..7de28f0 100644 --- a/after/ftplugin/qf.vim +++ b/after/ftplugin/qf.vim @@ -50,4 +50,16 @@ if b:context['denote'] == 'list' xnoremap + :DenoteTagAdd xnoremap - :DenoteTagRm xnoremap d :DenoteDelete + " 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 :call OpenDenoteEntry() endif diff --git a/autoload/denote/notes.vim b/autoload/denote/notes.vim index dd223c9..bc38821 100644 --- a/autoload/denote/notes.vim +++ b/autoload/denote/notes.vim @@ -246,7 +246,7 @@ function denote#notes#copy(origfile) " Write front matter, if this is supported if index(g:denote_note_file_extensions, l:ext) >= 0 call denote#loclist#jumptowindow() - exe 'edit ' .. l:filename + exe 'edit ' .. fnameescape(l:filename) call appendbufline(l:filename, 0, libdenote#fm_gen(l:ext, l:identifier, l:title), [], g:denote_fm_md_type) exe 'w' endif