Change to normal mode with
Search (Wraped around at end of file):
Search STRING forward : / STRING.
Search STRING backward: ? STRING.
Repeat search: n
Repeat search in opposite direction: N (SHIFT-n)
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
copied from http://www.felixgers.de/teaching/emacs/vi_search_replace.html
1 comment:
Cut and paste is simple too:
D - delete the line
p - paste the line
http://www.tech-recipes.com/rx/429/cut-and-paste-text-in-vi-or-vim/
Post a Comment