[Israel.pm] OT: how can you limit your search to a block in vi or emacs?

Shlomi Fish shlomif at iglu.org.il
Sun Sep 7 21:02:48 PDT 2008


On Sunday 07 September 2008, Oron Peled wrote:
> On Sunday, 7 בSeptember 2008, Gabor Szabo wrote:
> > I often need to find (and maybe rename) all the ocurances of a variable.
>
> Referring to vim:
> > The problem is
> > 1) if the same name is used in multiple places then my search keeps
> >      going to the other places as well an does not stay within the scope.
>
> Substitute, like any ':' command, may be prefixed with a line range.
>
> E.g:
>   :1,$s/all lines/every line/
>   :/from/,/to/s/all lines in range/including from and to/
>
> If you mark the start/end of your range with arbitrary letters
> (using the 'm' operator -- e.g: 'ma' and 'mb')
>
> than you may refer these marks as well with the apostrophe:
>   :'a,'bs/from mark a/to mark b included/

You can also do:

:'a,'b /regex

Regards,

	Shlomi Fish

-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
First stop for Perl beginners - http://perl-begin.org/

Shlomi, so what are you working on? Working on a new wiki about unit testing 
fortunes in freecell? -- Ran Eilam



More information about the Perl mailing list