Monday, February 28, 2011

Re: Editing contents of a register?

On 1/03/11 12:49 PM, Rostyslaw Lewyckyj wrote:
> Suppose that I have a collection of editing commands such as
> %g/pattern_a/
> %g/pattern_b/
> %g/pattern_c/
> ........................
> that find and list all the lines of a file that satisfy some patterns.
> After I visually inspect a given list of lines, I may want to delete them.
>
> I have thought to do this as follows:
> -- yank a list command into a register "ayy
> -- execute the command :@a"
> -- inspect the lines as they are listed
>
> Then if I'd now like to delete this set of lines, I'd like to append a d
> to the contents of register a changing it from a list to a delete command,
> and execute the command.
>
> So how do I _easily_ modify, edit, the contents of a register?
>
> I'd like something simpler than loading a list command into the clipboard
> via highlighting and ^C followed by :^V and if choosing to delete
> then :^Vd ???

You can enter any register onto the commandline by using ^R, so just do
this if you want (after pressing a, the contents of the register will
appear on the commandline)

:^Rad

If you prefer, you could issue a command to append a d to the register
and then execute the modified register

:let @a.="d"
:@a

And there are other possibilities too....

Ben.

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