Extract links list generation to an individual function

This commit is contained in:
Ivan Tishchenko 2014-11-06 23:52:26 +03:00
parent f7bacc3e75
commit 395cfec299

View File

@ -560,8 +560,8 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
endif endif
endfunction " }}} endfunction " }}}
" vimwiki#base#generate_links " vimwiki#base#generate_globlinks
function! vimwiki#base#generate_links() "{{{only get links from the current dir function! vimwiki#base#get_globlinks() abort "{{{only get links from the current dir
" change to the directory of the current file " change to the directory of the current file
let orig_pwd = getcwd() let orig_pwd = getcwd()
lcd! %:h 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') let globlinks = substitute(globlinks, '\'.VimwikiGet('ext').'\ze\n', '', 'g')
" restore the original working directory " restore the original working directory
exe 'lcd! '.orig_pwd 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 ??? " We don't want link to itself. XXX Why ???
" let cur_link = expand('%:t:r') " let cur_link = expand('%:t:r')