Vim Search and Replace Cheatsheat

Search and Replace

  1. Utilizes a regular expression for searching every occurrence of [pattern] and replaces it with [replacement] without asking for confirmation.

Now if your pattern contains forward slashes such as a https:// protocal you can use the # separator instead

This pattern is good for doing search and replace on an sql file.

  1. Same as the previous command but asks for confirmation before replacing each instance of [pattern] with [replacement].
  1. Instead of replacing every single instance of [pattern] on your file, this Vim command will replace only those [pattern] that are in the current line with [replacement].
  1. select some text and go into to visual mode vim will put charaters in the prompt for you, then on the end of that put your search and replace
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.