[vi] Search & Replace - achishis2/achishis2.github.io GitHub Wiki

Replace: Same as with sed, Replace OLD with NEW:

First occurrence on current line:              :s/OLD/NEW
Globally (all) on current line:                :s/OLD/NEW/g 
Between two lines #,#:                         :#,#s/OLD/NEW/g
Every occurrence in file:                      :%s/OLD/NEW/g 
Replace all Occurenece with confirmations      :%s/old/new/gc

http://www.digilife.be/quickreferences/QRC/vi%20Quick%20Reference.pdf

http://www.worldtimzone.com/res/vi.html

multiple windows

If you want, you can probably do everything from one vim session! :) Here are some commands to turn one vim session (inside one xterm) into multiple windows.

 :e filename      - edit another file
 :split filename  - split window and load another file
 ctrl-w up arrow  - move cursor up a window
 ctrl-w ctrl-w    - move cursor to another window (cycle)
 ctrl-w_          - maximize current window
 ctrl-w=          - make all equal size
 10 ctrl-w+       - increase window size by 10 lines
 :vsplit file     - vertical split
 :sview file      - same as split, but readonly
 :hide            - close current window
 :only            - keep only this window open
 :ls              - show current buffers
 :b 2             - open buffer #2 in this window

http://www.cs.swarthmore.edu/help/vim/windows.html