3

I use auto completion in my shell (zsh) and I'm often a bit sloppy.

Scenario: Imagine I have the files sourcecode.c and sourcecode.h in the current directory. I type vim sour<TAB><ENTER> and get vim sourcecode.<ENTER> autocompleted. Vim opens a new file.

I'd like vim to ask me, if I forgot to mention the suffix and maybe even suggest the possible files (like in the directory open mode). Something like:

You opened sourcecode.
Did you mean: sourcecode.c
              sourcecode.h
            > create new file sourcecode.

Is this possible? Does a plugin exist that does something like that?

  • You may be interested in the DidYouMean plugin. – user938271 Oct 26 '18 at 13:05
  • @user938271 The use case in the plugin's readme is almost word for word OP's question so you can post that as an answer. Even if it's a short answer that would be a good one – statox Oct 26 '18 at 15:10
3

You may be interested in the didyoumean plugin, whose description is the following:

If you're like me and you want to edit a specific file with Vim, say, test.py, you type vim te into the terminal, then you hit <Tab> and <Enter> immediately because you think your shell expands the characters to the right file name. But if there's another file starting with te, Vim fires up with an empty file called te, laughing at you. That's annoying. This simple plugin makes Vim ask for the right file to open.

  • Great. I knew there must be something around – Jounathaen Oct 27 '18 at 14:07

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.