vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 53ba047a18f1a8b154963f5f9203a01177bbb112
parent 839a5bf608101c8660cbc64dc39ac35bb5bad6d4
Author: tinmarino <tinmarino@gmail.com>
Date:   Mon,  7 Oct 2019 15:25:52 +0200

Clean code: : mutualise bash: is_wiki_link: command not found in a script function

Diffstat:
Mautoload/vimwiki/base.vim | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim @@ -104,6 +104,12 @@ function! vimwiki#base#find_wiki(path) endfunction +" helper: check if a link a well formed wiki link +function! s:is_wiki_link(link_infos) + return a:link_infos.scheme =~# '\mwiki\d\+' || a:link_infos.scheme ==# 'diary' +endfunction + + " THE central function of Vimwiki. Extract infos about the target from a link. " If the second parameter is present, which should be an absolute file path, it " is assumed that the link appears in that file. Without it, the current file @@ -147,7 +153,7 @@ function! vimwiki#base#resolve_link(link_text, ...) let link_text = matchstr(link_text, '^'.vimwiki#vars#get_global('rxSchemes').':\zs.*\ze') endif - let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' || link_infos.scheme ==# 'diary' + let is_wiki_link = s:is_wiki_link(link_infos) " extract anchor if is_wiki_link @@ -328,7 +334,7 @@ function! vimwiki#base#open_link(cmd, link, ...) return endif - let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' || link_infos.scheme =~# 'diary' + let is_wiki_link = s:is_wiki_link(link_infos) let update_prev_link = is_wiki_link && \ !vimwiki#path#is_equal(link_infos.filename, vimwiki#path#current_wiki_file())