I just set up IDE env for Python 3. I was wondering how I can run the file being currently edited in vim. I remembered that the command was ":python %", but it did not work for Python 3.
Thank you very much.
I just set up IDE env for Python 3. I was wondering how I can run the file being currently edited in vim. I remembered that the command was ":python %", but it did not work for Python 3.
Thank you very much.
For Python 3, just simply execute :!python3 %
Furthermore, you might also want to map it to a hotkey in your settings, like what I did:
noremap <D-r> <esc>:w<CR>:!python3 %<CR>
So that you can just press Command+r
to execute the current code with Python 3 anytime (it will be saved automatically.
you could use
:!python %
and it will surely work. Now your python should be pointing to python3 in this case, if not just write :!python3 %
instead