Completion for UltiSnipsEdit. Patch by Zhao Cai.

This commit is contained in:
Holger Rapp 2013-04-21 17:18:14 +02:00
parent 40af7c8480
commit 61291ecd83
2 changed files with 25 additions and 5 deletions

View File

@ -1316,6 +1316,7 @@ Contributors listed in chronological order:
Stanislav Golovanov - JazzCore Stanislav Golovanov - JazzCore
David Briscoe - DavidBriscoe David Briscoe - DavidBriscoe
Keith Welch - paralogiki Keith Welch - paralogiki
Zhao Cai - zhaocai
8.2 Snippets *UltiSnips-contrisnippets* 8.2 Snippets *UltiSnips-contrisnippets*

View File

@ -107,7 +107,8 @@ function! UltiSnipsEdit(...)
endfunction endfunction
" edit snippets, default of current file type or the specified type " edit snippets, default of current file type or the specified type
command! -nargs=? UltiSnipsEdit :call UltiSnipsEdit(<q-args>) command! -nargs=? -complete=customlist,UltiSnipsFiletypeComplete UltiSnipsEdit
\ :call UltiSnipsEdit(<q-args>)
" Global Commands {{{ " Global Commands {{{
function! UltiSnipsAddFiletypes(filetypes) function! UltiSnipsAddFiletypes(filetypes)
@ -220,6 +221,24 @@ endf
function! UltiSnips_LeavingBuffer() function! UltiSnips_LeavingBuffer()
exec g:_uspy "UltiSnips_Manager.leaving_buffer()" exec g:_uspy "UltiSnips_Manager.leaving_buffer()"
endf endf
" }}}
" COMPLETE FUNCTIONS {{{
function! UltiSnipsFiletypeComplete(arglead, cmdline, cursorpos)
let ret = {}
let items = map(
\ split(globpath(&runtimepath, 'syntax/*.vim'), '\n'),
\ 'fnamemodify(v:val, ":t:r")'
\ )
call insert(items, 'all')
for item in items
if !has_key(ret, item) && item =~ '^'.a:arglead
let ret[item] = 1
endif
endfor
return sort(keys(ret))
endfunction
" }}} " }}}
"" STARTUP CODE {{{ "" STARTUP CODE {{{