Saturday, March 26, 2011

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

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...
Maybe I should create a function that can do all these in one run?..

On Mar 24, 3:29 pm, Ben Fritz <fritzophre...@gmail.com> wrote:
> On Mar 24, 6:38 am, Sapfeer <sapf...@gmail.com> wrote:
>
> > Is there a simple way to do this?.. Say I've created command QuoteAllLines,
> > that puts specific symbol at the end of the line and a mapping that copies
> > selected text into global, OS-level clipboard. Now, I want to issues these
> > in one move, but select all lines before copying. Can I somehow run defined
> > command from mapping or it'd be better to define a function instead?..
>
> You can yank all lines easily with either:
>
> :%y +
> (command-line, script)
>
> or
>
> gg"+yG
> (normal mode)

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