Diary: make + in visual mode work correctly

This commit is contained in:
EinfachToll 2018-11-25 17:55:43 +01:00
parent dcd1c0a364
commit 349d551181

View File

@ -1951,17 +1951,22 @@ function! s:normalize_link_in_diary(lnk)
let link_exists_in_wiki = filereadable(link_wiki) let link_exists_in_wiki = filereadable(link_wiki)
let link_is_date = a:lnk =~# '\d\d\d\d-\d\d-\d\d' 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 str = a:lnk
let rxUrl = vimwiki#vars#get_global('rxWord') let rxUrl = vimwiki#vars#get_global('rxWord')
let rxDesc = '' let rxDesc = ''
let template = vimwiki#vars#get_global('WikiLinkTemplate1') 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 depth = len(split(vimwiki#vars#get_wikilocal('diary_rel_path'), '/'))
let str = repeat('../', depth) . a:lnk . '|' . a:lnk let str = repeat('../', depth) . a:lnk . '|' . a:lnk
let rxUrl = '^.*\ze|' let rxUrl = '^.*\ze|'
let rxDesc = '|\zs.*$' let rxDesc = '|\zs.*$'
let template = vimwiki#vars#get_global('WikiLinkTemplate2') let template = vimwiki#vars#get_global('WikiLinkTemplate2')
else
let str = a:lnk
let rxUrl = '.*'
let rxDesc = ''
let template = vimwiki#vars#get_global('WikiLinkTemplate1')
endif endif
return vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) return vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template)