vim neocomplete 安裝

來源:互聯網
上載者:User

標籤:

功能

neocomplete 為 vim 提供智能提示功能,將 vim 改造成強大的IDE,效果如。

安裝

安裝neocomplete 外掛程式需要lua支援,並且vim版本大於Vim 7.3.885。

1. 環境檢測

  開啟vim,輸入 :version,查看版本與lua模組,若版本不符合,先升級版本;若vim中不支援lua,則需要

重新編譯vim,可以參考 recompile vim with lua。

 

  注意: +lua 表示支援lua, -lua表示不支援,需要重新編譯。

 

2. 下載neocomplete

  GitHub:https://github.com/Shougo/neocomplete.vim

  CSDN:http://download.csdn.net/detail/spch2008/8828389

  將autoload 檔案夾置於 ~/.vim/autoload

  將plugin     檔案夾置於 ~/.vim/plugin

 

3. 啟用neocomplete  

  在 ~/.vimrc 中,寫入: let g:neocomplete#enable_at_startup = 1

  至此,neocomplete配置完成。同時,作者提供了一份neocomplete的配置,

如果沒有特殊需要,可以直接使用。

 1 " Use neocomplete. 2 let g:neocomplete#enable_at_startup = 1 3 " Use smartcase. 4 let g:neocomplete#enable_smart_case = 1 5 " Set minimum syntax keyword length. 6 let g:neocomplete#sources#syntax#min_keyword_length = 3 7 let g:neocomplete#lock_buffer_name_pattern = ‘\*ku\*‘ 8  9 " Define dictionary.10 let g:neocomplete#sources#dictionary#dictionaries = {11     \ ‘default‘ : ‘‘,12     \ ‘vimshell‘ : $HOME.‘/.vimshell_hist‘,13     \ ‘scheme‘ : $HOME.‘/.gosh_completions‘14         \ }15 16 " Define keyword.17 if !exists(‘g:neocomplete#keyword_patterns‘)18     let g:neocomplete#keyword_patterns = {}19 endif20 let g:neocomplete#keyword_patterns[‘default‘] = ‘\h\w*‘21 22 " Plugin key-mappings.23 inoremap <expr><C-g>     neocomplete#undo_completion()24 inoremap <expr><C-l>     neocomplete#complete_common_string()25 26 " Recommended key-mappings.27 " <CR>: close popup and save indent.28 inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>29 function! s:my_cr_function()30   return neocomplete#close_popup() . "\<CR>"31   " For no inserting <CR> key.32   "return pumvisible() ? neocomplete#close_popup() : "\<CR>"33 endfunction34 " <TAB>: completion.35 inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"36 " <C-h>, <BS>: close popup and delete backword char.37 inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"38 inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"39 inoremap <expr><C-y>  neocomplete#close_popup()40 inoremap <expr><C-e>  neocomplete#cancel_popup()41 " Close popup by <Space>.42 "inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"43 44 " For cursor moving in insert mode(Not recommended)45 "inoremap <expr><Left>  neocomplete#close_popup() . "\<Left>"46 "inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"47 "inoremap <expr><Up>    neocomplete#close_popup() . "\<Up>"48 "inoremap <expr><Down>  neocomplete#close_popup() . "\<Down>"49 " Or set this.50 "let g:neocomplete#enable_cursor_hold_i = 151 " Or set this.52 "let g:neocomplete#enable_insert_char_pre = 153 54 " AutoComplPop like behavior.55 "let g:neocomplete#enable_auto_select = 156 57 " Shell like behavior(not recommended).58 "set completeopt+=longest59 "let g:neocomplete#enable_auto_select = 160 "let g:neocomplete#disable_auto_complete = 161 "inoremap <expr><TAB>  pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"62 63 " Enable omni completion.64 autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS65 autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags66 autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS67 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete68 autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags69 70 " Enable heavy omni completion.71 if !exists(‘g:neocomplete#sources#omni#input_patterns‘)72   let g:neocomplete#sources#omni#input_patterns = {}73 endif74 "let g:neocomplete#sources#omni#input_patterns.php = ‘[^. \t]->\h\w*\|\h\w*::‘75 "let g:neocomplete#sources#omni#input_patterns.c = ‘[^.[:digit:] *\t]\%(\.\|->\)‘76 "let g:neocomplete#sources#omni#input_patterns.cpp = ‘[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::‘77 78 " For perlomni.vim setting.79 " https://github.com/c9s/perlomni.vim80 let g:neocomplete#sources#omni#input_patterns.perl = ‘\h\w*->\h\w*\|\h\w*::‘

 

vim neocomplete 安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.