From 349d551181e9b0f979da390630508cd2d7df96f8 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Sun, 25 Nov 2018 17:55:43 +0100 Subject: [PATCH] Diary: make + in visual mode work correctly --- autoload/vimwiki/base.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 15e87fb..dd73479 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1951,17 +1951,22 @@ function! s:normalize_link_in_diary(lnk) let link_exists_in_wiki = filereadable(link_wiki) let link_is_date = a:lnk =~# '\d\d\d\d-\d\d-\d\d' - if ! link_exists_in_wiki || link_exists_in_diary || link_is_date + if link_exists_in_diary || link_is_date let str = a:lnk let rxUrl = vimwiki#vars#get_global('rxWord') let rxDesc = '' let template = vimwiki#vars#get_global('WikiLinkTemplate1') - else + elseif link_exists_in_wiki let depth = len(split(vimwiki#vars#get_wikilocal('diary_rel_path'), '/')) let str = repeat('../', depth) . a:lnk . '|' . a:lnk let rxUrl = '^.*\ze|' let rxDesc = '|\zs.*$' let template = vimwiki#vars#get_global('WikiLinkTemplate2') + else + let str = a:lnk + let rxUrl = '.*' + let rxDesc = '' + let template = vimwiki#vars#get_global('WikiLinkTemplate1') endif return vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template)