Skip to content

Instantly share code, notes, and snippets.

@Thilakeswar
Created June 23, 2023 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thilakeswar/f8b4160d5d09d4e01150541626576292 to your computer and use it in GitHub Desktop.
Save Thilakeswar/f8b4160d5d09d4e01150541626576292 to your computer and use it in GitHub Desktop.
Some useful vi commands that I had used
* Search and replace across multiple lines :
:%s/<SearchString>/<ReplaceString>/g
Eg: :%s/Vijay/Thalapathy/g
* Delete multiple lines based on SearchString :
:g/<SearchString>/d
Eg: :g/^Garbage.*$/d
* Delete multiple lines based on range :
:<StartRange>,<EndRange>d
Eg: :1,13d
Delimiter meaning
%s - Search
g - global
d - delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment