无聊装了个neocomplcache试下,初步用下来感觉效果的确不错,不过要和 snipMate superTab zencoding插件和谐共存还是要设置一下。。。
首先如果你不需要让他自动启用 (不加 let g:NeoComplCache_EnableAtStartup = 1),或者不需要让他自动弹出提示 (加了 let g:NeoComplCache_DisableAutoComplete = 1),那似乎就不用设置什么了。
如果用了 zencoding.vim,那么vimrc里面不要有 let g:use_zen_complete_tag = 1 ,如果加了这句会使NeoComplCache自动启用那句没做用。。。
另外如果要 snipMate 和 superTab的话,也要修改下,因为snipMate为了与superTab兼容,在提示菜单弹出的时候是不会展开的,即使你修改了触发snipMate的热键也没用,他只会执行superTab的动作。。。
所以我就想把snipMate为了兼容superTab的代码去掉。
打开 ~/.vim/plugin/snipMate.vim 134行开始
if pumvisible()
if exists('SuperTabKey')
call feedkeys(SuperTabKey) | return ''
endif
call feedkeys("\<esc>a", 'n')
call feedkeys("\<tab>") | return ''
endif
<font color="#FF0000">---------------- 2010-08-22 更新 --------------</font>
根据snipMate在github中的最新代码,从149行,开始,从新调整一下TriggerSnippet函数,并且下面再增加一个小函数
fun! TriggerSnippet()
if exists('g:SuperTabMappingForward')
if g:SuperTabMappingForward == "<tab>"
let SuperTabKey = "\<c-n>"
elseif g:SuperTabMappingBackward == "<tab>"
let SuperTabKey = "\<c-p>"
endif
endif
if exists('g:snipPos') | return snipMate#jumpTabStop(0) | endif
let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
let [trigger, snippet] = s:GetSnippet(word, scope)
" If word is a trigger for a snippet, delete the trigger & expand
" the snippet.
if snippet != ''
if exists('g:loaded_neocomplcache')
let g:neocomplcache_disable_auto_complete = 1
inoremap <ESC> <ESC>:call SetNeocomplBack()<CR>
snoremap <ESC> <ESC>:call SetNeocomplBack()<CR>
endif
let col = col('.') - len(trigger)
sil exe 's/\V'.escape(trigger, '/\.').'\%#//'
return snipMate#expandSnip(snippet, col)
endif
endfor
if exists('SuperTabKey')
call feedkeys(SuperTabKey)
return ''
endif
return "\<tab>"
endf
fun! SetNeocomplBack()
let g:neocomplcache_disable_auto_complete = 0
inoremap <ESC> <ESC>
snoremap <ESC> <ESC>
endf-----------------------------------------------
这几句注释掉后就行了,不管是否兼容了,反正用了NeoComplCache自动提示,superTab的作用也体现不出多少了,主要是为了可以用tab键来选择提示菜单中的项目。
还有个办法不需要修改snipMate的代码就是修改superTab的热键,但是如果改掉的话那还能叫superTab不? 哈哈
这里也有个参考,不过他是把NeoComplCache的自动提示关闭了。
http://sinolog.it/?p=1399
评论
我是从 autocomplpop 转到的
verdana 发布
我是从 autocomplpop 转到的 neocomplcache, 用了一段时间就受不了了, ncc 实在是太慢了, 严重影响输入, 流畅感尽失. ncc 如果不改进性能, 功能再强劲也没用啊~
相比autocomplpop似乎是稍微慢一点,不过在cac
harry 发布
相比autocomplpop似乎是稍微慢一点,不过在cache完成后就比较流畅了,你可以试试最新的版本,changelog上有不少优化和修复的条目。
只用 NeoComplCache 跟 snipMate
Seatle 发布
只用 NeoComplCache 跟 snipMate ,没有用superTab,为什么也冲突了?按Tab键snipMate无效了,不会自动补齐了,什么原因哦