Is there a way to substitute a pattern only if it occurs inside the brace pair that the cursor is on?
For instance, if I have the text
int bar()
{
...
}
int foo()
{
char bar;
bar = 'a';
}
I can change all instances of bar to baz in the second brace pair using line numbers, e.g. :7,11s/bar/baz/g
. Is it possible to do this without the line numbers, only having the cursor on one of the braces?
Edit:
The version of Vi I have is 3.10, which doesn't appear to have visual mode