Vim's popup menu is a very cool and modern feature. However, if the list is very long (such as completion) and I keep pressing <C-N> to navigate through the menu quickly, the popup menu will flash to refresh the content, which is sometimes a little dizzy.
So what may be the cause? Is this a limit of the terminal or is there any plugin which make Vim inefficient?
Thanks very much!


2 Answers 2


I think this is an issue with Vim itself. When exploring the popup menu with Ctrl-N or Ctrl-P, Vim replaces your text with the highlighted item, which implies switching back-and-forth between the menu and the window behind it. You can bypass the issue by using the up and down arrows instead of Ctrl-P and Ctr-N, because in that case Vim does not perform text replacement (but then you'll need to press Enter to accept the highlighted item). Personally, I dislike the arrow keys so I use remappings to avoid them; for example:

inoremap <expr> n pumvisible() ? "\<Down>" : "n"
inoremap <expr> p pumvisible() ? "\<Up>" : "p"
  • Thanks for your advice! I will check it later! I didin't notice this subtle difference before.
    – tamlok
    Jan 13, 2017 at 5:20
  • Keep me posted, as the flickering may have other causes too Jan 14, 2017 at 12:18
  • Currently I do not have the condition to test it enough. Anyway, I map <C-J> and <C-K> to navigate the popup menu. inoremap <expr> <C-J> pumvisible() ? "<Down>" : "<C-J>" and inoremap <expr> <C-K> pumvisible() ? "<Up>" : "<C-K>".
    – tamlok
    Jan 19, 2017 at 2:31
  • By the way, what does \ in "\<Down>" mean?
    – tamlok
    Jan 19, 2017 at 2:43
  • Sorry about the backslash, it means nothing and I put it out of habit (it is needed in string constants), but the mapping should work without it, as your own example shows. Jan 19, 2017 at 18:08

So what may be the cause? Is this a limit of the terminal or is there any plugin which make Vim inefficient?

In order to understand if it is a terminal limitation you could try to reproduce the problem in different terminals and using gVim.

If you are suspicious that it could be a plugin that may be causing the problem then you could follow the procedure described on Vim-FAQ 2.5. Some relevant parts follows:

2.5. I have a "xyz" (some) problem with Vim. How do I determine it is a problem with my setup or with Vim? / Have I found a bug in Vim?

First, you need to find out, whether the error is in the actual runtime files or any plugin that is distributed with Vim or whether it is a simple side effect of any configuration option from your .vimrc or .gvimrc. So first, start vim like this:

vim -u NONE -U NONE -N -i NONE

this starts Vim in nocompatible mode (-N), without reading your viminfo file (-i NONE), without reading any configuration file (-u NONE for not reading .vimrc file and -U NONE for not reading a .gvimrc file) or even plugin.

If the error does not occur when starting Vim this way, then the problem is either related to some plugin of yours or some setting in one of your local setup files. You need to find out, what triggers the error, you try starting Vim this way:

vim -u NONE -U NONE -N

If the error occurs, the problem is your .viminfo file. Simply delete the viminfo file then. If the error does not occur, try:

vim -u ~/.vimrc --noplugin -N -i NONE

This will simply use your .vimrc as configuration file, but not load any plugins. If the error occurs this time, the error is possibly caused by some configuration option inside your .vimrc file. Depending on the length of your vimrc file, it can be quite hard to trace the origin within that file.

The best way is to add :finish command in the middle of your .vimrc. Then restart again using the same command line. If the error still occurs, the bug must be caused because of a setting in the first half of your .vimrc. If it doesn't happen, the problematic setting must be in the second half of your .vimrc. So move the :finish command to the middle of that half, of which you know that triggers the error and move your way along, until you find the problematic option. If your .vimrc is 350 lines long, you need at a maximum 9 tries to find the offending line (in practise, this can often be further reduced, since often lines depend on each other).

If the problem does not occur, when only loading your .vimrc file, the error must be caused by a plugin or another runtime file (indent autoload or syntax script). Check the output of the :scriptnames command to see what files have been loaded and for each one try to disable each one by one and see which one triggers the bug. Often files that are loaded by vim, have a simple configuration variable to disable them, but you need to check inside each file separately.

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.