Quick Overview[edit]

TODO: Write guide from onenote.

Tips[edit]

Execute Current File using Preset Key[edit]

To make vi execute a script that is being edited using a function key (in this case, F5), add the following to your .vimrc

" Mapping F5 to run hashbang scripts
" Will save, then run the interpreter.
au BufEnter * if match( getline(1) , '^\#!') == 0

Toggle Line Numbers[edit]

To make vi toggle line numbers using a key (in this case, F4), add the following to your .vimrc

" Map F4 to toggle line numbers
map <F4> :set nonumber!<CR>

Multi-line Edit[edit]

Indent lines 1-33 with 2 spaces.

1,33s/^/  /g

Vi Visual Bell Flash[edit]

Out of the box vim flashes to the point where I feel like I'll get a seizure. To turn it off:

:set noflash

Force Tabs[edit]

Force tabs instead of soft tabs with tab stops and width set to 4.

:set autoindent noexpandtab tabstop=4 shiftwidth=4

Force Soft Tabs[edit]

The reverse of the above:

:set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab