

In the above mappings, the second one is a little more exotic: it simulates to bring up the omni completion menu, then it simulates to remove the longest common text, and finally it simulates again to keep a match highlighted. This way you can keep typing characters to narrow the matches, and the nearest match will be selected so that you can hit Enter at any time to insert it. What this accomplishes is it keeps a menu item always highlighted. In the above mappings, the first will make work the way it normally does however, when the menu appears, the key will be simulated. These two mappings further improve the completion popup menu: In that case the Enter key will simply select the highlighted menu item, just as does. The above mapping will change the behavior of the key when the popup menu is visible. The next enhancement is the following mapping: (The longest setting is responsible for the former effect and the menuone is responsible for the latter.)

The above command will change the 'completeopt' option so that Vim's popup menu doesn't select the first completion item, but rather just inserts the longest common text of all matches and the menu will come up even if there's only one match. The first step to "improve" the menu behavior is to execute this command: With Vim's initial popup menu settings, the behavior of the popup menu is a little less pleasant (for some people). In most IDEs, you normally type some code, press for a completion popup menu, type some more characters to select the menu item you want, then hit to insert that completion into the code. Your completion options may be full text from files (see :help 'complete'), Omni completion, or a custom complete function (see :help complete-functions). You can set multiple values to combine behaviours. The completion menu is controlled by completeopt.
