Vim Keymap

In your ~/.vimrc, do yourself a favor, and do something like this:

 map <f1> :up<cr> " Make F1 save. If you want help, do :help xyz
 map <f2> :up<cr>:!./%<cr> " Execute the current file
 map <f4> :up<cr>:make<cr> " Run "make"
 "...and so on
 imap <f1> <esc><f1>
 imap <f2> <esc><f2>
 imap <f3> <esc><f3>
 imap <f4> <esc><f4>
 imap <f5> <esc><f5>
 imap <f6> <esc><f6>
 imap <f7> <esc><f7>
 imap <f8> <esc><f8>
 imap <f9> <esc><f9>
 imap <f10> <esc><f10>
 imap <f11> <esc><f11>
 imap <f12> <esc><f12>

All those imap's are just so you can run these in insert mode. Believe me, once you get in a habit of typing a line of code then hitting just one key to Escape, save, and run the tests, you'll wonder how you ever did it any other way.

Also, consider also adding this to your ~/.vimrc:

 set exrc " See :help 'exrc'

Then you can put .vimrc's everywhere, that make the shell feel context-specific. This is especially useful in the root directories of projects - everyone can share the same settings.


EditText of this page (last edited August 2, 2010) or FindPage with title or text search