GNU Info

Info Node: (viper)Search and Replace

(viper)Search and Replace


Next: Yanking Prev: Changing Text Up: Text Handling
Enter node , (file) or (file)node

Search and Replace
------------------

   Note: Groundwork, for Ex address syntax.  Note: Options, to see
how to get literal (non-regular-expression) search and how to stop
search from wrapping around.

`<count>  /<string>'
     To the <count>th occurrence of <string>.

`<count>  ?<string>'
     To the <count>th previous occurrence of <string>.

`<count>  g<move>'
     Search for the text described by move.  (off by default)

`n'
     Repeat latest `/' `?' (next).

`N'
     Idem in opposite direction.

`%'
     Find the next bracket and go to its match

`:[x,y]g/<string>/<cmd>'
     Search globally [from line x to y] for <string> and execute the Ex
     <cmd> on each occurrence.

`:[x,y]v/<string>/<cmd>'
     Execute <cmd> on the lines that don't match.

`#g<move>'
     Execute the last keyboard macro for each line in the region.
     Note: Macros and Registers, for more info.

`Q'
     Query Replace.

`:ta <name>'
     Search in the tags file where <name> is defined (file, line), and
     go to it.

`:[x,y]s/<pat>/<repl>/<f>'
     Substitute (on lines x through y) the pattern <pat> (default the
     last pattern) with <repl>.  Useful flags <f> are `g' for `global'
     (i.e. change every non-overlapping occurrence of <pat>) and `c' for
     `confirm' (type `y' to confirm a particular substitution, else
     `n').  Instead of `/' any punctuation character other than <space>
     <tab> and <lf> can be used as delimiter.

     Note: _The newline character (inserted as `C-qC-j') can be used in
     <repl>_.

`&'
     Repeat latest Ex substitute command, e.g. `:s/wrong/right'.

`:global /<pattern>/<ex-command>'
`:g /<pattern>/<ex-command>'
     Execute <ex-command> on all lines that match <pattern>.

`:vglobal /<pattern>/<ex-command>'
`:v /<pattern>/<ex-command>'
     Execute <ex-command> on all lines that do not match <pattern>.


automatically generated by info2www version 1.2.2.9