commit f7df798b25a3f8948a51d225df6b7aee0a1e0ddc
parent 395cfec299f47244bc26022e433f4f3f8d861b4a
Author: Ivan Tishchenko <ivan.tishchenko@dsr-company.con>
Date: Fri, 7 Nov 2014 00:02:37 +0300
Support autocompletion of link argument for VimwikiGoto command
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -1804,6 +1804,17 @@ endfunction "}}}
" }}}
+" Command completion functions {{{
+
+" vimwiki#base#complete_links
+function! vimwiki#base#complete_links(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()
+endfunction " }}}
+
+"}}}
+
" -------------------------------------------------------------------------
" Load syntax-specific Wiki functionality
for s:syn in vimwiki#base#get_known_syntaxes()
diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim
@@ -283,7 +283,8 @@ exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
-command! -buffer -nargs=+ VimwikiGoto call vimwiki#base#goto(<f-args>)
+command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links
+ \ VimwikiGoto call vimwiki#base#goto(<f-args>)
" list commands