commit f109e0e488a595246baab6fd9c39e9fb3e08b295
parent b954923cbf26c4aff90b4dbde11e2113a5ea4157
Author: EinfachToll <istjanichtzufassen@googlemail.com>
Date: Thu, 11 Sep 2014 10:36:44 +0200
Fix regression bug: opening URLs didn't work
Fix #68 and #73
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git 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
@@ -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 " }}}