From c5417636172ba94e9b2363fd5e510b72e800ddab Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 4 Feb 2020 20:40:03 +0100 Subject: [PATCH] Add wiki.vim file opening scheme for pdf, html Can open file-links that the cursor is currently over (in markdown link format). PDF is opened in zathura, html in qutebrowser, the rest in vim. --- nvim/.config/nvim/plugin/wiki.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nvim/.config/nvim/plugin/wiki.vim b/nvim/.config/nvim/plugin/wiki.vim index 25854cf..1c63525 100644 --- a/nvim/.config/nvim/plugin/wiki.vim +++ b/nvim/.config/nvim/plugin/wiki.vim @@ -39,3 +39,16 @@ endfunction let g:wiki_link_target_map = "PrependDatestamp" let g:wiki_list_todos = ['[ ]', '[x]'] + +" set file opening schemes +function! WikiFileOpen(...) abort dict + if self.path =~# '.pdf$' + silent execute '!zathura' fnameescape(self.path) '&' + return 1 + elseif self.path =~# '.html$' + silent execute '!qutebrowser' fnameescape(self.path) '&' + return 1 + endif + return 0 +endfunction +let g:wiki_file_open = 'WikiFileOpen'