From e1c3ea09da315c95d89f77a4113d9578f8b8ff0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Wed, 4 Mar 2026 11:16:59 +0100 Subject: [PATCH] feat: open non-note files using "open" --- after/ftplugin/qf.vim | 12 ++++++++++++ autoload/denote/notes.vim | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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