how to execute Python in VIM

D

DENG

hi,

im a newbie to VIM(gVIM under WINXP), i want to execute python in vim
like press F5 in SciTE.

i try to search in google and config as follows in my _vimrc:
-----------------------------------------------------------
map <f5>:D:\python24\python.exe %

if has("autocmd")


autocmd FileType python setlocal et | setlocal sta | setlocal sw=4
autocmd FileType python compiler pyunit
autocmd FileType python setlocal makeprg=python\ ./alltests.py
autocmd BufNewFile,BufRead test*.py setlocal makeprg=python\ %


endif

----------------------------------------------------------

but neither F5 nor MAKE works.....

who can help me ?

thanks in advance
 
D

DENG

i change the path

autocmd FileType python setlocal makeprg=\"d:\\Python24\\python.exe\"\

autocmd BufNewFile,BufRead test*.py setlocal
makeprg=\"d:\\Python24\\python.exe\"\ %
 
D

DENG

ok

i find it

map <F12> <Esc>:!d:\python24\python.exe %<CR>


but it comes with a new pop-up windows........dame~
 
D

Diez B. Roggisch

DENG said:
ok

i find it

map <F12> <Esc>:!d:\python24\python.exe %<CR>


but it comes with a new pop-up windows........dame~

I'm no windows expert - but maybe pythonw.exe helps here?
 
B

bradya

map said:
I'm no windows expert - but maybe pythonw.exe helps here?

I find that using pythonw.exe and the silent prefix in Vim works best
for me:

map <F5> <Esc>:silent !pythonw.exe %<CR>

Regards,

Aaron
 
D

DENG

thanks Aaron

i've changed that, but this time, even worse...

when i press F5, the pop-up windows appears, and then, it disppears
very quickly...(less than 1 second)

i cant see anything~ :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top