commit 395cfec299f47244bc26022e433f4f3f8d861b4a
parent f7bacc3e752ca8429fff08bf996d560c46896de5
Author: Ivan Tishchenko <ivan.tishchenko@dsr-company.con>
Date: Thu, 6 Nov 2014 23:52:26 +0300
Extract links list generation to an individual function
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -560,8 +560,8 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
endif
endfunction " }}}
-" vimwiki#base#generate_links
-function! vimwiki#base#generate_links() "{{{only get links from the current dir
+" vimwiki#base#generate_globlinks
+function! vimwiki#base#get_globlinks() abort "{{{only get links from the current dir
" change to the directory of the current file
let orig_pwd = getcwd()
lcd! %:h
@@ -571,6 +571,13 @@ function! vimwiki#base#generate_links() "{{{only get links from the current dir
let globlinks = substitute(globlinks, '\'.VimwikiGet('ext').'\ze\n', '', 'g')
" restore the original working directory
exe 'lcd! '.orig_pwd
+ " return all links as a single newline-separated string
+ return globlinks
+endfunction " }}}
+
+" vimwiki#base#generate_links
+function! vimwiki#base#generate_links() "{{{only get links from the current dir
+ let globlinks = vimwiki#base#get_globlinks()
" We don't want link to itself. XXX Why ???
" let cur_link = expand('%:t:r')