grr. I’m struggling with Vim’s learning curve.
And trying to get a simple mapping in my vimrc to execute the current buffer’s python script.
The mapping is well-formed and works after I enter it into the command line in Vim. This is the mapping:
map <buffer> <S-e> :w<CR>:!usr/bin/env python % <CR>
But it won’t load from my vimrc 🙁 I’m using the basic .vimrc_sample with only this mapping appended. What’s weird is that I could get a different mapping working from the vimrc:
map <S-t> itest<Esc>
This one works, but not the script executer? What gives?
Ubuntu 10.10 Python 2.6 Vim 7.2
Help is very appreciated!
I suspect that you have something before
map:<buffer>argument means that mapping is defined for current buffer only, so adding it to vimrc without something likeautocmd FileType pythonbefore it is weird. Maybe it is the reason why it does not work: you somehow switch to another buffer before testing this mapping.Some additional things to concern:
mapwhere can usenoremapinstead.<C-u>beforew) and select modes, and definitely don’t want it to be defined for operator-pending modes, so usennoremap.<S-e>andEare equivalent.wand!...in one command using pipe symbol::w | !/usr/bin/env python %<CR>.usr.