Skip to content

Instantly share code, notes, and snippets.

@murarisumit
Created June 3, 2015 05:49
Show Gist options
  • Save murarisumit/0e205bd544d9e193372d to your computer and use it in GitHub Desktop.
Save murarisumit/0e205bd544d9e193372d to your computer and use it in GitHub Desktop.
Search and replace in Vim
Find for sting in vim
/searchString
"press n for cursor on next occurence of string
"Press N to move cursor on previous occurence of string
==================================
Replace in vim:
"Replace All occurence of string in current line :
:s/srcString/destString/g
"Replace All occurence of string in current line(case-insensitive) :
:s/srcString/destString/gi
"Replace All occurent of string in complete file:
:%s/srcString/destString/gi
":% is the same as a range of 1,$ which equates to the entire file
===================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment