-
-
Save cooldaemon/165090 to your computer and use it in GitHub Desktop.
neocomplcache + snipMate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** snipMate.vim.old 2009-04-23 02:30:12.703125000 +0900 | |
--- snipMate.vim 2009-04-23 01:41:56.890625000 +0900 | |
*************** | |
*** 187,190 **** | |
--- 187,202 ---- | |
let num = inputlist(snippet) - 1 | |
return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1] | |
endf | |
+ | |
+ fun GetSnippetsList(ft) | |
+ let s = {} | |
+ for i in ['s:snippets["_"]', 's:multi_snips["_"]', | |
+ \ 's:snippets[a:ft]', 's:multi_snips[a:ft]'] | |
+ if exists(i) | |
+ let s = extend(s, deepcopy(eval(i))) | |
+ endif | |
+ endfor | |
+ return s | |
+ endf | |
+ | |
" vim:noet:sw=4:ts=4:ft=vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:source = { | |
\ 'name' : 'snipMate_complete', | |
\ 'kind' : 'plugin', | |
\} | |
function! s:source.initialize() | |
let s:snip_list = {} | |
endfunction | |
function! s:source.finalize() | |
endfunction | |
function! s:source.get_keyword_list(cur_keyword_str) | |
let ft = neocomplcache#get_context_filetype() | |
if has_key(s:snip_list, ft) | |
return neocomplcache#keyword_filter(copy(s:snip_list[ft]), a:cur_keyword_str) | |
end | |
let snips = GetSnippetsList(ft) | |
if empty(snips) | |
return [] | |
endif | |
let l:abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10) | |
let l:menu_pattern = '<S> %.'.g:neocomplcache_max_filename_width.'s' | |
let list = [] | |
for trig in keys(snips) | |
if type(snips[trig]) == type([]) | |
let s:triger = 'multi snips - ' . snips[trig][0][1] | |
else | |
let s:triger = snips[trig] | |
endif | |
let l:abbr = substitute( | |
\ substitute(s:triger, '\n', '', 'g'), | |
\ '\s', ' ', 'g') | |
let l:menu = printf(l:menu_pattern, trig) | |
let list += [{'word' : trig, 'menu' : l:menu, 'abbr' : l:abbr}] | |
endfor | |
let s:snip_list[ft] = list | |
return neocomplcache#keyword_filter(copy(list), a:cur_keyword_str) | |
endfunction | |
function! neocomplcache#sources#snipMate_complete#define() | |
return s:source | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks