Saturday, November 26, 2011

NeoComplCache plugin set map to select from popup

I set NeoComplCache in my vimrc like this.
All of those are from help file of NeoComplCache.
I want to map <C-n>,<C-p> or <C-j>,<C-k> to select complete item from popup.
Does anybody knows how to set this ?
By the way, if you have good hints on my NeoComplCache setting. plese tell me.
I will apperciate it.
( I know this setting is long, you can jump to map setting directly. )

Bundle 'Shougo/neocomplcache.git'
" {{{
let g:acp_enableAtStartup = 0 " disable AutoComplPop
let g:neocomplcache_enable_at_startup = 1 " use neocomplcache
let g:neocomplcache_max_list = 20
let g:neocomplcache_max_keyword_width = 50
let g:neocomplcache_max_menu_width = 15
let g:neocomplcache_auto_completion_start_length = 2 " auto completion word length.
let g:neocomplcache_manual_completion_start_length = 2 " manual completion word length.
let g:neocomplcache_min_keyword_length = 3
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_enable_ignore_case = 1 " use ignorecase
let g:neocomplcache_enable_smart_case = 1 " use Smartcase
let g:neocomplcache_disable_auto_complete = 0 " if 1 to disable, can manual completion by <C-x><C-u>
let g:neocomplcache_enable_wildcard = 1 " enable wildcard like *
let g:neocomplcache_enable_cursor_hold_i = 1 " relative with updatetime event
let g:neocomplcache_enable_auto_select = 0 " =1 -> AutoComplPop like behavior.
let g:neocomplcache_enable_auto_delimiter = 0
let g:neocomplcache_cursor_hold_i_time = 100 " completion time
" ambiguous searching match
let g:neocomplcache_enable_camel_case_completion = 0 " disable camel case completion.
let g:neocomplcache_enable_underbar_completion = 0
let g:neocomplcache_enable_fuzzy_completion = 0
let g:neocomplcache_enable_caching_message = 1
let g:neocomplcache_caching_limit_file_size = 500000
let g:neocomplcache_disable_caching_file_path_pattern = ''
" let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
let g:neocomplcache_compare_function = 'neocomplcache#compare_rank'
let g:neocomplcache_enable_prefetch = 1
let g:neocomplcache_snippets_dir = '~/.vim/bundle/snipmate.vim/snippets/'
let g:neocomplcache_temporary_dir = '.neocon'
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" let g:neocomplcache_next_keyword_patterns =
" let g:neocomplcache_omni_patterns =
" let g:neocomplcache_tags_filter_patterns
" let g:neocomplcache_same_filetype_lists
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" let g:neocomplcache_dictionary_patterns
" let g:neocomplcache_filetype_include_lists
" let g:neocomplcache_text_mode_filetypes
let g:neocomplcache_disable_select_mode_mappings = 1
let g:neocomplcache_ctags_program = "ctags"
" let g:neocomplcache_ctags_arguments_list
" let g:neocomplcache_include_paths
" let g:neocomplcache_include_exprs
" let g:neocomplcache_include_patterns
" let g:g:neocomplcache_include_functions
" let g:neocomplcache_include_max_processes = 20
" let g:neocomplcache_filename_include_exprs
" let g:neocomplcache_filename_include_exts
" let g:neocomplcache_member_prefix_patterns
" let g:neocomplcache_member_patterns
" let g:neocomplcache_delimiter_patterns
" let g:neocomplcache_omni_functions
" let g:neocomplcache_vim_completefuncs
" let g:neocomplcache_plugin_disable
" let g:neocomplcache_plugin_completion_length
" let g:neocomplcache_plugin_rank
" let g:neocomplcache_force_overwrite_completefunc
let g:neocomplcache_snippets_disable_runtime_snippets = 0 " =1 avoid conflicting snippets.

"autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
"autocmd FileType c setlocal omnifunc=ccomplete#Complete
"autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
"autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
"autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
" Enable heavy omni completion.
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.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*::'

" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif

" Plugin key-mappings.
" <CR>: close popup and save indent.
inoremap <expr><CR> neocomplcache#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()
inoremap <expr><C-g> neocomplcache#undo_completion()
" FIXME use <C-n>, <C-p> or <C-j>, <C-k> to select from popup.

inoremap <expr><C-x><C-f> neocomplcache#manual_filename_complete()
inoremap <expr><C-j> neocomplcache#manual_omni_complete()
inoremap <expr><C-n> pumvisible() ? "\<C-n>" : neocomplcache#manual_keyword_complete()
inoremap <expr><C-l> neocomplcache#complete_common_string()
imap <expr><C-s> neocomplcache#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : "\<C-n>"
" inoremap <expr><Tab> neocomplcache#start_manual_complete()
" SuperTab like snippets behavior.
" imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" imap <C-k> <Plug>(neocomplcache_snippets_expand)
" smap <C-k> <Plug>(neocomplcache_snippets_expand)

" [ plugins ] {{{ autoload/neocomplcache/sources/
" }}}

" Require:
Bundle 'Shougo/vimproc.git'
" $ make -f make_gcc.mak (make proc.so)
" }}}

--
>> stardiviner << =>GPG: 5D9F64D8 Twitter: @numbchild
http://stardiviner.dyndns-blog.com/author.html

No comments:

Post a Comment