I cannot figure out how to open a file that starts with +, e.g. +models/File.m. This is a naming convention for packages in Matlab.

I've tried escaping \+models/File.m. This doesn't work because the backslash is interpreted by the shell. Double escaping \\+models/File.m allows vim to receive the backslash, but it then opens \+models/File.m literally.

The only way to do this seems to be by creating the file first with touch or whatever, and then opening inside vim with Ctrl-P. I don't want to cd into +models because I am also working on files in sibling directories. Any Ideas?


My shell is bash if that makes a difference.

  • 1
    On the command line: vim -- +models/File.m. From Vim: :e \+models/File.m Jul 7, 2016 at 10:13
  • @SatoKatsura Please add the command line part as an answer.
    – diestl
    Jul 7, 2016 at 10:16

3 Answers 3


From vim --help:

   --                   Only file names after this

So this works on the command line:

vim -- +models/File.m

From inside Vim you need to escape the +:

:e \+models/File.m
  • I was thrown off inside vim because tab-completion no longer works with the \. I never thought to just try it. Doh.
    – diestl
    Jul 7, 2016 at 10:23
  • 1
    @maxf130 Tab completion works if you write the directory: :e \+models/<Tab> Jul 7, 2016 at 10:25
  • Clearly my attention span is to low. I never made it past the first few characters.
    – diestl
    Jul 7, 2016 at 10:27
  • 3
    @maxf130 Note that using -- to stop argument parsing is pretty standard for commandline tools. e.g. rm -- -r, less -- -f, etc. Jul 7, 2016 at 12:16

More generally, you can start by specifying a directory name, so that the + (plus sign) appears in the middle of the file specification instead of at the beginning.

Because all *nix operating systems, and others like MS-DOS / Windows that adopted Unix conventions, (just about any place you can run vim...,) refer to the current directory as . ("dot", "period", and so on,) then you can specify any file name beginning with an unusual symbol by preceding it with the string ./ (or in Windows with back- instead of forward-slash .<) and thus:


just about anywhere that you can use a "regular" file name.


You can open vim without any arguments. And then, in command line, type :e! \+filename

  • 1
    +1 This works, though it would be better if this were possible from the command line.
    – diestl
    Jul 7, 2016 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.