Saturday, March 26, 2011

Re: Call user created command, select all lines and copy them to global buffer

On 03/26/2011 04:56 AM, Sapfeer wrote:
> So, I'm trying to define such command, here is it:
>
> command! -range=% QuoteLinesAndCopy :<line1>,<line2>/^\s*$/d;s/^/> /
> g;<line1>,<line2>y +
>
> ...but when I issue it I get the following error:
>
> E488: Trailing characters: :1,30/^\s*$/d;s/^/> /g;1,30y +
>
> I'm afraid that I can't issue more than one ex command in a row...

The command-separator in vim is spelled "|", not ";" and only
works with certain commands (though fortunately ":s" is one of them):

:help :bar

So your command would look something like one of these:

command! -range=% QuoteLinesAndCopy
:<line1>,<line2>/^\s*$/d|s/^/> /g|<line1>,<line2>y +

-tim


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