Browse Source

vimwiki: open file: links in vim itself

main
Brennen Bearnes 1 month ago
parent
commit
a3bcd7f0ed
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      home/.vim/vimrc

+ 15
- 13
home/.vim/vimrc View File

@ -350,19 +350,21 @@ let mapleader = ","
" au FileType vimwiki :set tw=80
" an example override of vimwiki link handling - could be extended to add
" custom link types, etc.:
" function! VimwikiLinkHandler(link)
" if a:link =~# '^https\?:'
" try
" execute ':!lynx ' . a:link
" return 1
" catch
" echo "Something went wrong..."
" endtry
" endif
" return 0
" endfunction
" override default vimwiki link handling - could be extended to add
" custom link types, etc. Right now all it does is use vim itself
" to handle files, crudely.
function! VimwikiLinkHandler(link)
if a:link =~# 'file:'
try
" chop off the leading file: - see :h expr-[:] for syntax:
execute ':e ' . a:link[5:]
return 1
catch
echo "Something went wrong..."
endtry
endif
return 0
endfunction
Plugin 'vimwiki/vimwiki'


Loading…
Cancel
Save