Closed flyingfishercn closed 11 years ago
In my environment, when I tab select words in the popupwindow, press the two key makes no difference. They all complete the word.
I think you should use neocomplcache#smart_close_popup()
and neocomplcache#smart_close_popup()
.
In my environment, when I tab select words in the popupwindow, press the two key makes no difference. They all complete the word.
neocomplcache#close_popup()
insert current candidate, but neocomplcache#cancel_popup()
does not insert current candidate.
I tried as you said again, but nothing different happened. They finished the same job. Fortunately, it didn't trouble my daily work.
The following is my config:
705 " neocomplcache {
706 let g:acp_enableAtStartup = 0
707 let g:neocomplcache_enable_at_startup = 1
708 let g:neocomplcache_enable_camel_case_completion = 1
709 let g:neocomplcache_enable_smart_case = 1
710 let g:neocomplcache_enable_underbar_completion = 1
711 let g:neocomplcache_enable_auto_delimiter = 1
712 let g:neocomplcache_force_overwrite_completefunc = 1
713 let g:neocomplcache_min_syntax_length = 3
714 let g:neocomplcache_enable_auto_select = 1
715
716 " SuperTab like snippets behavior.
717 imap <silent><expr><TAB> neosnippet#expandable() ?
718 \ "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ?
719 \ "\<C-e>" : "\<TAB>")
720 smap <TAB> <Right><Plug>(neosnippet_jump_or_expand)
721
722 " Define dictionary.
723 let g:neocomplcache_dictionary_filetype_lists = {
724 \ 'default' : '',
725 \ 'vimshell' : $HOME.'/.vimshell_hist',
726 \ 'scheme' : $HOME.'/.gosh_completions'
727 \ }
728
729 " Define keyword.
730 if !exists('g:neocomplcache_keyword_patterns')
731 let g:neocomplcache_keyword_patterns = {}
732 endif
733 let g:neocomplcache_keyword_patterns._ = '\h\w*'
734
735 " <TAB>: completion.
736 inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
737 inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
738
739 " <CR>: close popup
740 " <s-CR>: close popup and save indent.
741 inoremap <buffer> <expr><s-CR> pumvisible() ? neocomplcache#close_popup(): "\<CR>\<CR>"
742 inoremap <buffer> <expr><CR> pumvisible() ? neocomplcache#close_popup() : "\<CR>"
743 inoremap <buffer> <expr><SPACE> pumvisible() ? neocomplcache#cancel_popup() : "\<SPACE>"
745 " <C-h>, <BS>: close popup and delete backword char.
746 inoremap <buffer> <expr><BS> neocomplcache#smart_close_popup() "\<C-h>"
747 inoremap <buffer> <expr><C-h> neocomplcache#smart_close_popup() "\<C-h>"
748 inoremap <buffer> <expr><C-y> neocomplcache#smart_close_popup()
749 inoremap <buffer> <expr><C-e> neocomplcache#cancel_popup()
750
751 " Enable omni completion.
752 autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
753 autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
754 autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
755 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
756 autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
757 autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
758
759 " Enable heavy omni completion.
760 if !exists('g:neocomplcache_omni_patterns')
761 let g:neocomplcache_omni_patterns = {}
762 endif
763 let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
764 let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
765 let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
766 let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
767 let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::'
768
769 " Use honza's snippets.
770 let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
771
772 " Enable neosnippet snipmate compatibility mode
773 let g:neosnippet#enable_snipmate_compatibility = 1
774
775 " For snippet_complete marker.
776 if has('conceal')
777 set conceallevel=2 concealcursor=i
778 endif
779
780 " Disable the neosnippet preview candidate window
781 " When enabled, there can be too much visual noise
782 " especially when splits are used.
783 set completeopt-=preview
784 "endif
785 " }
I use neocomplete.vim. And this settings are works. I don't want to change neocomplcache. Can you test it in neocomplete.vim?
" <C-y>: paste.
inoremap <expr><C-y> pumvisible() ? neocomplete#close_popup() : "\<C-r>\""
" <C-e>: close popup.
inoremap <expr><C-e> pumvisible() ? neocomplete#cancel_popup() : "\<End>"
God. I thought use OmniCppComplete as neocomplete by mistake. I checked my vim plugin and found the key error.
It is said neocomplete was better than OmniCppComplete everywhere , I will try it later. Thank you,Shougo !!
OK.
inoremap <buffer> <expr><C-y> neocomplcache#close_popup()
inoremap <buffer> <expr><C-e> neocomplcache#cancel_popup()
In my environment, when I tab select words in the popupwindow, press the two key makes no difference. They all complete the word.
for example, when i type "th", "this" and "that" list in the popup-window, when i select "that", type the two key is all complete "th" to "that", and popup-window disappeared.