VI - Search and Replace


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Change to normal mode with <ESC>.
  2.  
  3. Search (Wraped around at end of file):
  4.  
  5. Search STRING forward : / STRING.
  6. Search STRING backward: ? STRING.
  7.  
  8. Repeat search: n
  9. Repeat search in opposite direction: N (SHIFT-n)
  10.  
  11. Replace: Same as with sed, Replace OLD with NEW:
  12.  
  13. First occurrence on current line: :s/OLD/NEW
  14.  
  15. Globally (all) on current line: :s/OLD/NEW/g
  16.  
  17. Between two lines #,#: :#,#s/OLD/NEW/g
  18.  
  19. Every occurrence in file: :%s/OLD/NEW/g

URL: http://www.felixgers.de/teaching/emacs/vi_search_replace.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.