running python in vim

I have tried Googling but I couldn't find anything relevant.

Is it possible to program in Python on VIM and do something like

:!iPython

to have Python execute the code?

Last time I tried that, it just opened up Python in the terminal.

2 Answers

Save the current buffer with :w, then :!/usr/bin/env python %.

10

or even better set aw in your .vimrc, follow by

:pyf %

this will not incur you to bring up shell and hence better.

if you want you can map it and save in your .vimrc following cmd

map <F8> pyf %<CR>

hitting F8 will execute your python file

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like