Fixed misprint in comments; corrected completion to escape filenames properly; add documentation.

This commit is contained in:
Ivan Tishchenko 2014-11-10 23:04:06 +03:00
parent f7df798b25
commit 6b9edefecc
3 changed files with 20 additions and 2 deletions

View File

@ -560,7 +560,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
endif
endfunction " }}}
" vimwiki#base#generate_globlinks
" vimwiki#base#get_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()
@ -575,6 +575,15 @@ function! vimwiki#base#get_globlinks() abort "{{{only get links from the current
return globlinks
endfunction " }}}
" vimwiki#base#get_globlinks_escaped
function! vimwiki#base#get_globlinks_escaped() abort "{{{only get links from the current dir
let globlinks = vimwiki#base#get_globlinks()
let lst = split(globlinks, '\n')
call map(lst, 'fnameescape(v:val)')
let globlinks = join(lst, "\n")
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()
@ -1813,6 +1822,13 @@ function! vimwiki#base#complete_links(ArgLead, CmdLine, CursorPos) abort " {{{
return vimwiki#base#get_globlinks()
endfunction " }}}
" vimwiki#base#complete_links_escaped
function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort " {{{
" We can safely ignore args if we use -custom=complete option, Vim engine
" will do the job of filtering.
return vimwiki#base#get_globlinks_escaped()
endfunction " }}}
"}}}
" -------------------------------------------------------------------------

View File

@ -597,6 +597,8 @@ il A single list item.
:VimwikiGoto HelloWorld
< opens opens/creates HelloWorld wiki page.
Supports |cmdline-completion| for link name.
*:VimwikiDeleteLink*
Delete the wiki page that you are in.

View File

@ -283,7 +283,7 @@ exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links
command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped
\ VimwikiGoto call vimwiki#base#goto(<f-args>)