Create a link handler `vim:` for Vimwiki

parent 3dbbb8d9
if exists('g:loaded_vimwiki_link_handler') && g:loaded_vimwiki_link_handler
finish
endif
let g:loaded_vimwiki_link_handler = 1
" `vim:` opens the file same as `file:` but in the vim as a new tab.
function! VimwikiLinkHandler(link)
let link = a:link
if link =~# '^vim:'
let link = 'file' . link[3:]
else
return 0
endif
let link_info = vimwiki#base#resolve_link(link)
if link_info.filename == ''
echomsg 'Vimwiki Error: Unable to resolve the link'
return 0
else
exe 'tabnew ' . fnameescape(link_info.filename)
return 1
endif
endfunction
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment