Clean code: : mutualise bash: is_wiki_link: command not found in a script function
This commit is contained in:
parent
839a5bf608
commit
53ba047a18
@ -104,6 +104,12 @@ function! vimwiki#base#find_wiki(path)
|
|||||||
endfunction
|
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.
|
" 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
|
" 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
|
" 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')
|
let link_text = matchstr(link_text, '^'.vimwiki#vars#get_global('rxSchemes').':\zs.*\ze')
|
||||||
endif
|
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
|
" extract anchor
|
||||||
if is_wiki_link
|
if is_wiki_link
|
||||||
@ -328,7 +334,7 @@ function! vimwiki#base#open_link(cmd, link, ...)
|
|||||||
return
|
return
|
||||||
endif
|
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 &&
|
let update_prev_link = is_wiki_link &&
|
||||||
\ !vimwiki#path#is_equal(link_infos.filename, vimwiki#path#current_wiki_file())
|
\ !vimwiki#path#is_equal(link_infos.filename, vimwiki#path#current_wiki_file())
|
||||||
|
Loading…
Reference in New Issue
Block a user