I finally decided to try out Vim, as I am getting increasingly frustrated by GUI editors. So far, I'm loving it, but I can't find any help for a issue I'm having...
I am trying to map the command :Pyrun
to :!python %
in Vim using cmap
. The mapping shows up fine if I type :cmap
. However, on typing :Pyrun
, I get this error message:
Not an editor command: Pyrun.
Here is what I'm trying in .vimrc:
:autocmd FileType python :cmap Pyrun<cr> !python %<cr>
:autocmd FileType python :cmap Intpyrun<cr> !python -i %<cr>
What can I do to solve this problem?
I would try something like this in your .vimrc or your ftplugin/python_ft.vim
command Pyrun execute "!python %"
command Intpyrun execute "!python -i %"
Then :Pyrun
and :Intpyrun
should work
You could then map a function key to each
map <F5> :Pyrun<CR>
map <F6> :Intpyrun<CR>