Now I play with autocomplete in vim, and I decided to use supertab to handle my terminations. Although it works very smoothly and (I think) exactly as it was designed, I would like to know how to change something.
Firstly, I am running 7.3.429 on Ubuntu 12.04LTS with
set completeopt=menuone,preview,longest
so i have bash -type autocompletion with supertab and the default value is complete.
Suppose my file has the following:
aaabbbcccddd aaabbccddeef aaabbcddeeff
If I type aa and press Tab , then vim realized that aaabb is the longest common string among the matches, so it inserts aaabb and displays a menu containing three parameters. If I really need one of these options, then all is well. But maybe I really wanted aaaaazzzzz , but I didn’t understand that I hadn’t dialed it yet.
Is there a good way to say vim: "Oh, sorry, I was not going to write in the end! Please pretend that I did not."
Currently, the following options are obvious to me:
- Hit Tab or Shift + Tab enough time to get back to my original one. But if there are many similar words, especially to different lengths, it is annoying.
- Hit backspace as many times as you like, or another naive delete. But this, of course, extra keystrokes.
- Press Esc + u to cancel, but it cancels my entire word (or more if I type quickly). This is completely unacceptable. And then I need to enter insert mode again and repeat. Gross
- Press Ctrl + u to cancel without leaving paste mode. But it also tends to remove too much.
- Press Ctrl + W to delete the last word. As long as I get this without leaving insert mode, I still have to retype. This is the best I've found so far.
If I did not have longest enabled, then I could use Ctrl + E , which leaves the menu without inserting anything. But since it is longer, it stops autocomplete, but leaves the longest overall match.
Of course, there must be a better way to do this.