2

There is a CompleteDone and MenuPopup event. However, I can't find an event for the triggering of the insert mode completion popup menu. So if I want to do something when triggering the completion popup menu, what should I do?
Since when navigating fast through a long long completion popup menu the menu usually flickers, I want to disable cursorline and cursorcolumn when I am navigating it in order to get a better performance. After the completion done, I can enable cursorline and cursorcolumn again using the CompletionDone event.
If there isn't any event for this, can I at least make the cursorcolumn still when I am navigating the completion menu? Now the highlighted cursor column will change all the time when I am navigating the menu.
Thanks very much!
One more question: is there any way to detect <C-e> and <C-y>, that is when the screen is scrolling? For now, I will disable cursorline when CursorMoved is triggered. But <C-e> and <C-y> sometimes won't trigger the CursorMoved event.

UPDATE: These are all the plugins that I have installed:

Plugin 'VundleVim/Vundle.vim'
Plugin 'gtags.vim'
Plugin 'tpope/vim-surround'
Plugin 'closetag.vim'
Plugin 'majutsushi/tagbar'
Plugin 'Yggdroot/LeaderF'
1

First, addressing the low level issue…

There's no flickering at all in the popup menu, no matter how long it is or if cursorline and/or cursorcolumn are enabled or not.

Flickering only happens in YCM (and possibly other bloated "autocompletion" plugins) where — judging by the volume of flicker issues — it is a very common annoyance. I'd suggest trying to work with that plugin's author toward a proper solution.

Second, addressing the high level issue…

The standard way to customize the behavior of the popup menu consists of checking if you are in the popup menu from within insert mode mapping. Given the relative complexity of your requirements, you should put your logic into a proper function that you would use like that:

inoremap <C-n> <C-n><C-r>=pumvisible() ? MyFunction() : "\<lt>C-n>"<CR>
  • Thanks for your solution! I didn't install YCM or any other completion plugin. The popup menu sometimes does flicker in my experience. If I set the pumheight to 10 instead of 0, it works better. – tamlok Apr 10 '16 at 10:53
  • actually there is some flickering depending on your configuration. I think this might be a bug. – Christian Brabandt Jul 10 '16 at 11:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.