The current mapping of my F5 key is:
imap :w\\|!python %
Now I want that if I\'m editing any python
Try this:
au BufEnter *.py map :w\|!python %
au BufEnter *.java imap :w\|!javac %
au BufEnter *.c, *.cpp imap :w\|!make %
I'm not 100% sure about the comma separated file types, trying to verify...
The vim docs are usually pretty nasty to try to figure out how to use commands, but these should help get you started:
:h BufEnter
:h :autocmd
Note: You may have to restart vim for these changes to overwrite the current autocommand groups.