omartinex
9/8/2017 - 2:58 AM

VIM Cheatsheet

VIM commands

#Find FOO and remove previous characters
%s/^.*\(FOO\)/\1/

#Find FOO in all lines and remove the entire line
g/"FOO"/d

#Find FOO and replace it in all lines
%s/FOO/BAR/g

#Find FOO and replace it in current line
s/FOO/BAR/g

#Delete all blank lines
g/^$/d

#To format a line to the left I use :left. Use this format an entire file:
:%le