Action in block

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Action in block

Paul-425
If I wanted to to a search and replace within a block, such as inside a function that's defined by the current {}'s, what would be the best way to do that? I'm thinking something like :{,}s/from/to/gc would be neat, or :s/from/to/gc/ap to perform it on 'a paragraph'. Is there even a plugin that would do this?

--

.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Action in block

Tim Chase
Paul wrote:
> If I wanted to to a search and replace within a block, such as
> inside a function that's defined by the current {}'s, what
> would be the best way to do that? I'm thinking something like
> :{,}s/from/to/gc would be neat, or :s/from/to/gc/ap to perform
> it on 'a paragraph'. Is there even a plugin that would do
> this?

You can use your favorite text-objects to select a visual range
and the let Dr. Chip's vis.vim script[1][2] do the heavy lifting
to pass the selected text to your :s command.

-tim


[1] stable public release
http://www.vim.org/scripts/script.php?script_id=1195

[2] bleeding-edge
http://mysite.verizon.net/astronaut/vim/





--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Action in block

Paul-425
On Sat, Feb 13, 2010 at 11:01:35AM -0600, Tim Chase wrote:
> You can use your favorite text-objects to select a visual range and the
> let Dr. Chip's vis.vim script[1][2] do the heavy lifting to pass the
> selected text to your :s command.

Excellent, thanks!

--

.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php