Created
July 9, 2010 11:27
-
-
Save cooldaemon/469369 to your computer and use it in GitHub Desktop.
neocomplcache + zencoding
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
*** zencoding.vim.org 2010-07-09 12:07:33.000000000 +0900 | |
--- zencoding.vim 2010-07-09 20:00:47.000000000 +0900 | |
*************** | |
*** 2131,2134 **** | |
--- 2131,2143 ---- | |
return [[line("'<"), col("'<")], [line("'>"), col("'>")]] | |
endfunction | |
+ function g:get_zen_snippets_list(type) | |
+ let type = a:type | |
+ if !has_key(s:zen_settings, type) | |
+ let type = 'html' | |
+ endif | |
+ if len(type) == 0 | let type = 'html' | endif | |
+ return s:zen_getResource(type, 'snippets', {}) | |
+ endfunction | |
+ | |
" vim:set et: |
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' : 'zencoding_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 = g:get_zen_snippets_list(ft) | |
if empty(snips) | |
return [] | |
endif | |
let l:abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10) | |
let l:menu_pattern = '<Z> %.'.g:neocomplcache_max_filename_width.'s' | |
let list = [] | |
for trig in keys(snips) | |
let s:triger = snips[trig] | |
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#zencoding_complete#define() | |
return s:source | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@cooldaemon
Could you make a plugin for neocomplcahce like vim-neco-calc