Search and Replace in Vim

search only the current line and match and replace only the first occurrence of a term

:8,10 s/search/replace/g
search and replace all occurrences from line 8 to 10

search and replace in whole document

same as previous but will ask for confirmation on replacements

No comments

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Find Me Around

User login