From My Wiki
Jump to: navigation, search

basic .vimrc

set backspace=indent,eol,start
set ai
set si
set hlsearch
syntax enable
set ruler

delete blank lines
:g will execute a command on lines which match a regex. The regex is 'blank line' and the command is :d (delete)

fix indent in file
=, the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G.

Good .rc file

git clone git:// ~/.vim_runtime
sh ~/.vim_runtime/

Pasting protip

:set paste

Then paste your code. Note that the text in the tooltip now says -- INSERT (paste) --. After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.

:set nopaste