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,150
  • 8
  • 41
  • 78

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
  • 186,200
  • 21
  • 280
  • 313
0

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

Remove <buffer> from the mapping.

FDinoff
  • 30,689
  • 5
  • 75
  • 96