dotar/vim/settings/neocomplete.vim

64 lines
2.6 KiB
VimL
Raw Normal View History

2017-08-02 00:15:51 +08:00
let g:acp_enableAtStartup = 0 " Disable AutoComplPop.
let g:neocomplete#enable_at_startup = 1 " Use neocomplete.
2014-05-14 00:58:03 +08:00
let g:neocomplete#enable_camel_case = 1
2013-12-20 03:13:27 +08:00
let g:neocomplete#enable_smart_case = 1
" Default # of completions is 100, that's crazy.
let g:neocomplete#max_list = 5
2017-08-02 00:15:51 +08:00
let g:neocomplete#auto_completion_start_length = 3 " Set minimum syntax keyword length.
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
let g:neocomplete#enable_auto_select = 1 " AutoComplPop like behavior.
2013-12-20 02:42:44 +08:00
" Map standard Ctrl-N completion to Ctrl-Space
inoremap <C-Space> <C-n>
2017-08-02 00:15:51 +08:00
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
2013-12-20 03:13:27 +08:00
" This makes sure we use neocomplete completefunc instead of
" the one in rails.vim, otherwise this plugin will crap out.
2014-05-14 00:58:03 +08:00
let g:neocomplete#force_overwrite_completefunc = 1
2013-12-20 02:42:44 +08:00
" Define keyword.
2013-12-20 03:13:27 +08:00
if !exists('g:neocomplete#keyword_patterns')
2014-05-14 00:58:03 +08:00
let g:neocomplete#keyword_patterns = {}
2013-12-20 02:42:44 +08:00
endif
2013-12-20 03:13:27 +08:00
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
2013-12-20 02:42:44 +08:00
2017-08-02 00:15:51 +08:00
" Enable heavy omni completion.
"if !exists('g:neocomplete#sources#omni#input_patterns')
" let g:neocomplete#sources#omni#input_patterns = {}
"endif
"let g:neocomplete#force_omni_input_patterns.go = '[^.[:digit:] *\t]\.'
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.go = '[^.[:digit:] *\t]\.'
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
2013-12-20 02:42:44 +08:00
" 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
2014-01-21 01:21:25 +08:00
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
2017-08-02 00:15:51 +08:00
" Recommended key-mappings.
" <CR>: close popup and save indent.
imap <expr><silent> <CR> <SID>my_cr_function()
function! s:my_cr_function()
return pumvisible() ? neocomplcache#close_popup() . "\<CR>" : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"