" ======================================== " Mac 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 apple-k or apple-d, and add Shift " to type dashes imap _ imap _ imap - imap - " Change inside various enclosures with Cmd-" and Cmd-' " 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 " Cmd-Shift-N for nerd tree nmap :NERDTreeToggle " move up/down quickly by using Cmd-j, Cmd-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 numbers to pick the tab you want (like iTerm) 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 " Resize windows with arrow keys nnoremap + nnoremap - nnoremap < nnoremap > " ============================ " Tabularize - alignment " ============================ " Hit Cmd-Shift-A then type a character you want to align by nmap :Tabularize / vmap :Tabularize / " Source current file Cmd-% (good for vim development) map :so %