Useful vimrc settings - YaleSTC/reservations GitHub Wiki

Standardizing code

set expandtab automatically expands your tabs to spaces

autocmd VimEnter *.rb :%s/\s\+$//e
autocmd VimEnter *.rb :%s/\t/  /ge
autocmd VimEnter *.rb :w

automatically strips trailing whitespace and replaces existing tabs with 2 spaces, and saves the file when opening a file