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

1
  • 1
    What mapping are you talking about? Commented Jul 23, 2014 at 16:23

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

Comments

0

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

Remove <buffer> from the mapping.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.