Right now I'm playing with autocompletions in vim, and I've settled on supertab to handle my completions. While it's running very smoothly and (I think) exactly as it's designed, I'd like to know how to change something.
Firstly, I'm running 7.3.429 on Ubuntu 12.04LTS with
set completeopt=menuone,preview,longest
so that I have bash-type autocompletion with supertab, and default complete.
Let's suppose I have the following in my file:
aaabbbcccddd
aaabbccddeef
aaabbcddeeff
If I type aa
and hit Tab, then vim realized that aaabb
is the longest common string among the matches, so it inserts aaabb
and displays a menu containing the three options. If I really did want one of those options, then all is good. But maybe I really wanted aaaaazzzzz
, but didn't realize I hadn't typed it yet.
Is there a good way to say to vim, "Oh, I'm sorry! I didn't mean to tabcomplete after all! Please pretend I didn't."
Right now, the options apparent to me are to:
- Hit Tab or Shift+Tab enough times to get back to my initial. But if there are many similar words, especially up to different lengths, this is annoying.
- Hit backspace however many times necessary, or some other naive deletion. But these are surely unnecessary key strokes.
- Hit Esc+u to get an undo, but this undoes my whole word (or more if I typed quickly). This is entirely unacceptable. And afterwards, I need to re-enter insert mode and retype. Gross.
- Hit Ctrl+U to undo without leaving insert-mode. But this also has a tendency to remove way too much.
- Hit Ctrl+W to delete the last word. While I get to do this without exiting insert-mode, I still have to retype. This is the best I have found so far.
If I didn't have longest
enabled, then I could use Ctrl+E, which quits the menu without inserting anything else. But since longest is on, it stops autocomplete but leaves the longest common match entered.
Surely there has to be a better way to do this.