From f109e0e488a595246baab6fd9c39e9fb3e08b295 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Thu, 11 Sep 2014 10:36:44 +0200 Subject: [PATCH] Fix regression bug: opening URLs didn't work Fix #68 and #73 --- autoload/vimwiki/base.vim | 13 +++++++------ doc/vimwiki.txt | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 91b3151..ef07b06 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -510,7 +510,13 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{ let [idx, scheme, path, subdir, lnk, ext, url, anchor] = \ vimwiki#base#resolve_scheme(a:link, 0) - if path == '' + " wikilinks of the form [[#anchor]] + if url == '' && anchor != '' + let lnk = expand('%:t:r') + let url = path.subdir.lnk.ext + endif + + if url == '' if g:vimwiki_debug echom 'open_link: idx='.idx.', scheme='.scheme.', path='.path.', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url.', anchor='.anchor endif @@ -518,11 +524,6 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{ return endif - if url == '' - let lnk = expand('%:t:r') - let url = path.subdir.lnk.ext - endif - let update_prev_link = ( (scheme == '' || scheme =~ 'wiki' || scheme =~ 'diary') \ && lnk != expand('%:t:r') \ ? 1 : 0) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 51896c1..b972120 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2239,11 +2239,11 @@ similar to 'local:' and 'file:' schemes, but are always opened with Vim: > \ ', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url. \ ', anchor='.anchor endif - if path == '' + if url == '' && anchor == '' echom 'Vimwiki Error: Unable to resolve link!' return 0 else - call vimwiki#base#edit_file('tabnew', url, '', [], 0) + call vimwiki#base#edit_file('tabnew', url, anchor, [], 0) return 1 endif endfunction " }}}