Wednesday, August 17, 2011

Re: Quote character on command line

On Aug 13, 5:20 am, "John Beckett" <johnb.beck...@gmail.com> wrote:
> I want to insert the following line after the current line:
>     abc "def" ghi
>
> This command works (each quote is escaped):
>     :put ='abc \"def\" ghi'
>
> These commands also work (no escaping):
>     :let line = 'abc "def" ghi'
>     :put =line
>
> But this command fails (the first quote starts a comment):
>     :put ='abc "def" ghi'
>
> Why does :let not require escaping, but :put does?
>
> The above is simplified from the original which uses :argdo
> to put the text into multiple files.
>

I don't know WHY it happens, but at least it's documented.
From :help :put

The expression continues until the end of
the command. You need to escape the '|' and '"'
characters to prevent them from terminating the
command. Example: >
:put ='path' . \",/test\"

--
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: