Some very useful commands for vim editor

VIM Editor’s Command

vim filename 		// Open a file
i            		// for insert mode
dd           		// delete a line
u			// undo
r 			// redo
:w			// save file
:wq			// save and quit
:q!			// quit without save
gg			// go to the first line of file
G 			// go to the last line of file
:set tabstop=4		// set tab size
:set filetype=html	// set file type
gg=G 			// indent the file
:g/^$/d 		// remove blank lines from file
:%s/\s\+$// 		// remove spaces from line end