1

I have started using neocomplete and there's one thing that confuses me. What's actually the difference between

neocomplete#smart_close_popup()

and

neocomplete#cancel_popup()

I am definitely not an expert at vimscript, but to me this looks like they are exactly the same:

function! neocomplete#smart_close_popup()
  return neocomplete#mappings#smart_close_popup()
endfunction

function! neocomplete#mappings#smart_close_popup() "{{{
  return neocomplete#mappings#cancel_popup()
endfunction

function! neocomplete#mappings#cancel_popup() "{{{
  let neocomplete = neocomplete#get_current_neocomplete()
  let neocomplete.complete_str = ''
  let neocomplete.skip_next_complete = 1

  return pumvisible() ? "\<C-e>" : ''
endfunction
"}}}

I tracked those down in the github repo. Anyway, does smart_close_popup just call cancel_popup? If yes, is there anything smart about that?

Also, when I do :map <C-e> or :map <C-h> it says No mapping found although I clearly see are bound to stuff (and they do stuff when I test them).

I'd love to get some clarification on this.

  • For meaning of <C-e> in popup completion context, see :h popupmenu-keys and scroll down to CTRL-E. Also, you don't get map results for default Vim key bindings (unless they were set in a script). – VanLaser Aug 16 '15 at 17:04
  • Well :map <expr><TAB> and the likes return the same result, even though they are explicitly set in my .vimrc (they were recommended by neocomplete). Why is that? – Mattias Aug 16 '15 at 17:52
  • Try :verbose imap <TAB> – VanLaser Aug 16 '15 at 17:57
  • Thanks for suggesting imap. But about the main question, is smart_close_popup the same as cancel_popup? – Mattias Aug 16 '15 at 18:47
  • By reading the help, the smart version would regenerate the popup menu, when you press <BS>, but only if g:neocomplete#enable_auto_select is set to 1. All these functions and options are documented. – VanLaser Aug 16 '15 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.