我不确定标签到HTML文件中下一个空标签对的功能来自哪里。我想完全禁用它。
问题只出在同时使用SuperTab和SnipMate,如果我删除SuperTab选项卡回到正常扩展,如果我删除SnipMate,选项卡将返回显示完成。
在过去,我一直都很好,并希望再次这样做。
我正在使用:
http://github.com/msanders/snipmate.vim
http://github.com/scrooloose/snipmate-snippets
http://github.com/ervandew/supertab
使用vim-update-bundles。两者的默认配置。我启用的其他选项是语法。自动缩进。 smartindent。 expandtab。 nocompatible。文件类型缩进插件。
答案 0 :(得分:2)
SnipMate和SuperTab都使用⇥,这使得他们的组合非常烦人且不可预测。
经过多年的TextMate,⇥扩张是一种我不能/不想放弃的习惯所以我很快就放弃了SuperTab,并学会了喜欢Vim的原生Omni完成:
inoremap <leader>, <C-x><C-o>
inoremap <leader>: <C-x><C-f>
inoremap <leader>= <C-x><C-l>
为了获得更精简的体验,autocomplpop出人意料地快速而聪明。
答案 1 :(得分:1)
符合我需求的解决方案是neocomplcache。
autocomplpop,supertab和snipmate之间的混合很好。嗯,片段部分只是一个小小的车,但非常实用。
但是我不使用⇥进行扩展,弹出的omnicompletion在第3个写字符后出现。您通过列表移动⇥,并使用 Ctrl K 展开片段(la textmate),但您可以将其映射到您选择。
这些是我的.vimrc
设置。
""""""""""""""""""""""""""""""
" => neocomplcache plugin
""""""""""""""""""""""""""""""
" TODO: Still need to tweak behavior with <TAB> to expand
" snippets, change throughout the autocompletion list
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_snippets_dir = '~/.vim/snippet/'
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" SuperTab like snippets behavior.
imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Recommended key-mappings.
" <CR>: close popup and save indent.
" inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
" AutoComplPop like behavior.
"let g:neocomplcache_enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplcache_enable_auto_select = 1
"let g:neocomplcache_disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
"inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
au BufNewFile,BufRead *.snip set syntax=snippet ft=snippet foldmethod=indent