From wikistone
Jump to: navigation, search
(Created page with "==multiple files== vi ''file1 file2 ...'' * :n : move to next file * :N : move to prev file * :buffers : list open files * :buffer n : move to n buffer * :e file : open/edit '...")
 
 
Line 12: Line 12:
 
==substitution==
 
==substitution==
 
<pre>:%s/[search]/[replace]/[args]</pre>
 
<pre>:%s/[search]/[replace]/[args]</pre>
−
* % : range of lines, % = 1,$, $ = last
+
* % : range of lines, % = 1,$ ; $ = last
 
* s : substitution command
 
* s : substitution command
 
* args:
 
* args:

Latest revision as of 15:42, 7 December 2013

multiple files

vi file1 file2 ...

  • :n : move to next file
  • :N : move to prev file
  • :buffers : list open files
  • :buffer n : move to n buffer
  • :e file : open/edit file
  • :r file : inserts file before the cursor into current file


substitution

:%s/[search]/[replace]/[args]
  •  % : range of lines, % = 1,$ ; $ = last
  • s : substitution command
  • args:
    • g : global, ie all occurrences on the line; omition means only 1st occurrence
    • c : confirm
      • y : yes
      • n : no
      • a : yes to this and all subsequent
      • l : last sub, ie yes to this then quit
      • q : quit subing
      • Esc : quit subing
      • ctrl-e : scroll down for context
      • ctrl-y : scroll up for context