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 | |
ありがとうございます!
Vim Shell に疎いので、zencoding と neocomplcache が連携するという発想だけ、お汲み取りいただければ幸いです。
いまさら感が抜群ですが(2 years ago ぇ)...
zencoding#getSnippets(type)
という形で取り込ませて頂きました。
$B$"$6!<$C$9(B(w;
On Thu, May 31, 2012 at 7:28 PM, mattn ***@***.*** wrote:
$B$$$^$5$i46$,H472$G$9$,(B(2 years ago $B$'(B)...
zencoding#getSnippets(type)
$B$H$$$&7A$G<h$j9~$^$;$FD:$-$^$7$?!#(B
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/469369
##
cooldaemon
@cooldaemon
Could you make a plugin for neocomplcahce like vim-neco-calc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
取り入れ検討します。最近仕事が忙しいのでちょっと時間下さい。