0

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

Community
  • 1
  • 1
miatech
  • 2,086
  • 8
  • 38
  • 72

2 Answers2

1

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
Community
  • 1
  • 1
romainl
  • 172,579
  • 20
  • 259
  • 291
0

If the mapping contains <buffer> it means it creates the mapping for the buffer.

Remove <buffer> from the mapping.

FDinoff
  • 29,583
  • 5
  • 70
  • 94