In my file system, I have some files which start with a plus sign. When I try to open these with vim an error is thrown.

For example, when typing...

vim +foo.out

I get the following error...

Error detected while processing command line:
E492: Not an editor command: foo.out

I can see that vim thinks that since there is a plus sign, I must be trying to run some kind of command, but since it's followed by a filename it doesn't know what to do. Any suggestions on how I get around this and open/edit the files?


1 Answer 1


Yes, vim does not interpret +foo.out as a filename. There are at least two solutions:

  1. Make the argument look like an absolute or relative path, so it doesn't start with + or -. In this case

    vim ./+foo.out

    In general this is useful when the argument is a filename. If it's not (e.g. grep -string-to-find) then you need to use another method.

  2. Inform the tool when it should stop parsing options. A common way is to use a double dash. In this case it will be

    vim -- +foo.out

    In general this is useful when the tool supports this meaning of --. Vim does, many tools do (note: supporting -- is one of the POSIX guidelines); but some don't.

If each method can be used then using them both is kinda excessive but by no means an error:

vim -- ./+foo.out

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .