Basic vi tricks
vi - Turning off auto indent
Whenever I paste code into a vi session, it always adds crazy indenting. The easy way around this is to enter the command :set noautoindent. Simple!
vi - indenting a specific number of lines
If you want to indent a set number of lines using vi, try using the command :.,.+10s/^/ /. This will indent 10 lines with a space - or you could use tabs by changing the code to :.,.+10s/^/\t\t\t/.
.