From 4e6db92d2c5a3ff24e64f6ba88220e7000f6c2b3 Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 15 Dec 2018 11:33:38 +0100 Subject: [PATCH] Patch for issue #585 - implement suggested improvements --- autoload/vimwiki/base.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 8124444..01af8bf 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -152,14 +152,11 @@ function! vimwiki#base#resolve_link(link_text, ...) let link_infos.anchor = join(split_lnk[1:], '#') endif if link_text == '' " because the link was of the form '#anchor' - if source_file =~ vimwiki#vars#get_wikilocal('ext') . '$' + let expected_ext = vimwiki#u#escape(vimwiki#vars#get_wikilocal('ext')).'$' + if source_file =~# expected_ext " Source file has expected extension. Remove it, it will be added later on let ext_len = strlen(vimwiki#vars#get_wikilocal('ext')) let link_text = fnamemodify(source_file, ':p:t')[:-ext_len-1] - else - " Source file has unexpected (or no) extension. A new file with the proper - " extension appended will be created - " let link_text = fnamemodify(source_file, ':p:t:r') endif endif