Monday, May 20, 2013

Re: vim: format each long lines and insert just one break afterward

On 05/20/2013 01:03 PM, Gary Johnson wrote:
> The action of the first exec is to expand and execute its arguments,
> which in this case is a single argument, the string
>
> a:firstline . "," . a:lastline . "g/^/exec " . "normal! gqq"
>
> Assuming for sake of a concrete example a firstline of 123 and a
> lastline of 456, that string expands to this:
>
> 123,456g/^/exec normal! gqq
>
> Note that this second exec sees "normal!" and "gqq" not as strings
> but as variables. That is what is causing the error message you
> reported previously.
>
> You don't need that second "exec" at all, so a better way to write
> that command is this:
>
> a:firstline . "," . a:lastline . "g/^/normal! gqq"
I Got it now, thanks!

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment