Monday, December 31, 2012

Re: Opening/creating a filename with a space using the :e command?

On Monday, December 31, 2012 1:45:48 PM UTC-6, stillLearningVim wrote:
> > :e ~/File name
> >
> > E172: Only one file name allowed
> The space is causing vim to think it's trying to open more than one file
>
> > :e "~/File name"
> >
> > E32: No file name
> " is for a comment in vimscript, so vim is ignoring the rest of the command.
>
> > :e ~/"File name"
> >
> > "~/" Illegal file name
> This is the same problem, vim ignores everything after the ". Since this ends in a / vim thinks it's a directory, not a file.
>
>
> > Do I need to do some kind of special escape sequence in order to open it, or is VIM just designed such that I can't do this?
> All the previous posts about using the \ character to escape a space should work.

Actually, I figured this out myself after looking up "escape sequences," and this was the second one I tried. First I tried using a %20 as a space, which didn't work, and then I tried proceeding the backslash with a space... and that worked perfectly.

Thanks for your post though, the explanation about VIM script was interesting because I was wondering why VIM can't understand quotes. Bash and the Windows Command Line both recognize that usage to input long file names, so I was rather confused when it didn't work here.

I'm actually using Ubuntu Linux right now, but I do use GVIM on my Windows machine as well... I've been avoiding spaces and/or renaming files to get around this limitation for a while now, and finally decided to look up how to deal with it properly.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: