I found this link for mapping a key for running python code in vim; however, when I open a second or third buffer the key doesn't work. How could I make the mapping permanent for all open buffers. Running Python code in Vim
thanks
I found this link for mapping a key for running python code in vim; however, when I open a second or third buffer the key doesn't work. How could I make the mapping permanent for all open buffers. Running Python code in Vim
thanks
What mapping are you talking about?
The mapping in the most upvoted answer is pretty good. Add these lines to your ~/.vimrc
to activate it every Python buffer:
augroup Python
autocmd!
autocmd FileType python nnoremap <buffer> <F9> :exec '!python' shellescape(@%, 1)<cr>
augroup END
If the mapping contains <buffer>
it means it creates the mapping for the buffer.
Remove <buffer>
from the mapping.