Question

I'd like to search and replace to the end of the code block I'm in.

Essentially I want to search over the motion ]}.

I tried

:]}s/=/+=/gc

and it didn't work. "Parse error"

I'm working with VsVIM in Visual Studio if that makes a difference.

Was it helpful?

Solution

The : ranges do not take motion arguments. You could do this via visual mode:

v]}:s/=/+=/gc

Note that when you hit : in visual mode, it will embed the ranges for you.

OTHER TIPS

You can select the block with { Shift-v }

then make:

:s/src/dst/g

I'm not sure if that will work in VsVim but you could do something like this in Vim:

[{v]}:s/=/+=/gc

Note that you can use a numeric range too:

:56,75s/=/+=/gc

As hepta said, you could do visual mode then your replace.

You could also do :.,.5s/old/new/gc

Or :.,/}/-1s/old/new/gc

See vim.wikia.com/wiki/Ranges

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top