" ======================================== " Linux specific General vim sanity improvements " ======================================== " " ======================================== " RSI Prevention - keyboard remaps " ======================================== " Certain things we do every day as programmers stress " out our hands. For example, typing underscores and " dashes are very common, and in position that require " a lot of hand movement. Vim to the rescue " " Now using the middle finger of either hand you can type " underscores with Alt-k or Alt-d, and add Shift " to type dashes imap _ imap _ imap - imap - " Change inside various enclosures with Alt-" and Alt-' " The f makes it find the enclosure so you don't have " to be standing inside it nnoremap f'ci' nnoremap f"ci" nnoremap f(ci( nnoremap f)ci) nnoremap f[ci[ nnoremap f]ci] " ==== NERD tree " Alt-Shift-N for nerd tree nmap :NERDTreeToggle " move up/down quickly by using Alt-j, Alt-k " which will move us around by functions nnoremap } nnoremap { autocmd FileType ruby map ]m autocmd FileType ruby map [m autocmd FileType rspec map } autocmd FileType rspec map { autocmd FileType javascript map } autocmd FileType javascript map { " Command-/ to toggle comments map :TComment imap :TCommenti " Use Alt- numbers to pick the tab you want map :tabn 1 map :tabn 2 map :tabn 3 map :tabn 4 map :tabn 5 map :tabn 6 map :tabn 7 map :tabn 8 map :tabn 9 " Create window splits easier. The default " way is Ctrl-w,v and Ctrl-w,s. I remap " this to vv and ss nnoremap vv v nnoremap ss s " Resize windows with arrow keys nnoremap + nnoremap - nnoremap < nnoremap > " ============================ " Tabularize - alignment " ============================ " Hit Alt-Shift-A then type a character you want to align by nmap :Tabularize / vmap :Tabularize / " Source current file Alt-% (good for vim development) map :so %