1
laskuma OP 自顶一下…没人用过吗?或者推荐一款自动补全插件也行,主要用来写java和c++
|
2
AlloVince 2012-08-27 13:49:57 +08:00
|
3
ivenvd 2012-08-27 13:56:38 +08:00 1
我的配置:
""""""""""""""""""""""""""""""""""""""" "neocomplcache """"""""""""""""""""""""""""""""""""""" let g:acp_enableAtStartup = 0 let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_max_list = 20 let g:neocomplcache_enable_smart_case = 1 let g:neocomplcache_enable_auto_select = 1 let g:neocomplcache_enable_auto_delimiter = 1 let g:neocomplcache_enable_fuzzy_completion = 1 let g:neocomplcache_min_syntax_length = 2 let g:neocomplcache_min_keyword_length = 2 let g:neocomplcache_manual_completion_start_length = 2 let g:neocomplcache_enable_cursor_hold_i = 1 let g:neocomplcache_enable_insert_char_pre = 1 if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.python = '[^. *\t]\.\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.python3 = '[^. *\t]\.\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*' let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::' "let g:neocomplcache_snippets_disable_runtime_snippets = 1 "imap <C-k> <Plug>(neocomplcache_snippets_expand) "smap <C-k> <Plug>(neocomplcache_snippets_expand) "inoremap <expr><C-g> neocomplcache#undo_completion() imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr><C-l> neocomplcache#complete_common_string() inoremap <expr><C-e> neocomplcache#cancel_popup() "imap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" |
5
laskuma OP @ivenvd 还是不理解各行的意思… 日本作者敢不敢把文档写全点 貌似我的帮助文档还进不去 是不是vundle install之后还需要做些设置?
|
6
AlloVince 2012-08-27 20:33:42 +08:00 1
@laskuma 我的配置里同时用了snipmate和neocomplcache,没有做特殊设置,也没什么冲突
Bundle "snipmate-snippets" https://github.com/AlloVince/vim-of-allovince/blob/master/_vimrc |
7
laskuma OP |
8
humiaozuzu 2012-08-27 21:38:11 +08:00
|
9
laskuma OP @humiaozuzu 求教该怎么让supertab跟snipmate兼容呢?
|
10
humiaozuzu 2012-08-27 22:10:32 +08:00
@laskuma 看我的配置,已经让他们兼容了,很简单的几行代码
|
11
laskuma OP @humiaozuzu 求地址。。表示没找到= =
|
12
humiaozuzu 2012-08-27 22:24:46 +08:00
@laskuma
在vimrc文件里面啊 " NeoComplCache set completeopt-=preview let g:neocomplcache_enable_at_startup=1 "let g:neoComplcache_disableautocomplete=1 let g:neocomplcache_enable_smart_case=1 let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' imap <C-k> <Plug>(neocomplcache_snippets_force_expand) smap <C-k> <Plug>(neocomplcache_snippets_force_expand) "imap <C-l> <Plug>(neocomplcache_snippets_expand) "smap <C-l> <Plug>(neocomplcache_snippets_expand) "imap <C-t> <Plug>(neocomplcache_snippets_jump) "smap <C-t> <Plug>(neocomplcache_snippets_jump) imap <C-l> <Plug>(neocomplcache_snippets_force_jump) smap <C-l> <Plug>(neocomplcache_snippets_force_jump) " 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 " SuperTab let g:SuperTabDefaultCompletionType="<c-n>" |
13
laskuma OP @humiaozuzu 原来是neo的snip插件… 想再问下omnifunc的问题 那些xxxComplete需要另外装吗?
|
14
humiaozuzu 2012-08-27 23:11:44 +08:00
@laskuma 直接用homebrew 安装macvim,大部分支持都有了,终端下替换默认的vim为macvim的vim就行了。
|
15
laskuma OP @humiaozuzu 是编译选项的问题吗? 我主要写java和c++都支持吗?
|
16
nouh 2012-08-27 23:35:24 +08:00 1
有neocomplcache还要什么supertab呢,同类型的东西用一个终极的就可以了,贴下我的配置吧,自动弹出补全菜单,snippet仍然用的是snipmate的,snippets会显示在补全菜单里,有比较明显的标识区别与其他的补全。 触发补全仍然是tab,上关键字是enter, 轮转菜单是tab
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\*' " 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>" inoremap <expr><silent> <CR> <SID>my_cr_function() "use <CR> to choose the candidate under cursor function! s:my_cr_function() return pumvisible() ? neocomplcache#close_popup() : "\<CR>" endfunction inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" imap <expr><Tab> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>" " <TAB>: completion. " <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-j> neocomplcache#close_popup() inoremap <expr><C-e> neocomplcache#cancel_popup() " AutoComplPop like behavior. let g:neocomplcache_enable_auto_select = 1 " 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 |
17
humiaozuzu 2012-08-27 23:36:46 +08:00
@laskuma omnicomplete对C++/java无能为力,虽然有插件cppomnicomplete,但是不是很好用。
非vim的方案cpp直接上Xcode,java可以试试IntelliJ IDEA |
18
whenov 2012-08-27 23:38:32 +08:00
为什么我开了neocomplcache后变得这么卡?
|
20
laskuma OP @nouh 按照你的配置了一下。。不知道为什么貌似没用。。
其实我只是希望能把snipmate的snips放进neocomplcache的自动补全列表中,自动补全列表自动显示,按tab自动补全为第一个候选项那么简单。。 |
21
ivenvd 2012-08-30 13:41:55 +08:00
@humiaozuzu 请教一下,那个 snip 怎么使用默认的值?比如我想输入 #include <stdio.h>,输入 inc<Tab> 之后,补全为 #include <stdio.h><`0`>,这时候怎么不修改 stdio ,而直接跳到行尾呢?
|
22
humiaozuzu 2012-08-30 15:40:25 +08:00
@ivenvd 我的设置是Ctrl+l跳转到下一个占位符,也就是<`0`>。你按一下Ctrl+l就OK了。
|