Try this the function below.  I'm a very novice vim programmer so
forgive me if there's an easier way to do this.  However, what's below
seemed to work for me.  

Chuck




function! ExecuteCurBufAsPython()
        let buffer = getline(1, line("$"))
        let newbuf = ""
        let index = 0
        while index < len(buffer)
                let line = buffer[index]
                let newbuf = newbuf . "\n" . line
                let index = index + 1
        endwhile
        execute "python " . newbuf
endfunc

:nmap <F5> :call ExecuteCurBufAsPython()




-----Original Message-----
From: Carroll, Barry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 23, 2006 5:39 PM
To: [email protected]
Subject: Python Script Execution Support in ViM

Greetings:

 

This is my first posting to this list.  I have used ViM off and on for
many years.  For the past year I have been using it exclusively to write
Python programs for the Windows (2000/XP) and Linux (Fedora) platforms.
I am using version 6.3 with python/dyn enabled on Windows and 6.2 with
Python enabled on Linux.  

 

Currently, when I want to run a script I am working on I have to open a
separate command or interpreter window and do my work there.  I would
like to be able to execute the open buffer from inside ViM, open a split
window and have the Python interpreter start automatically and import
the open buffer,  and other IDE-like actions.  Does ViM offer this kind
of support for Python?  I have read tantalizing bits on various web
pages that indicate it might be so, but can find nothing that tells just
what is supported and how to make it work.  

 

Can someone point me in the right direction?  Thank you in advance for
your help.  

 

Regards,

 

Barry

[EMAIL PROTECTED]

541-302-1107

________________________

We who cut mere stones must always be envisioning cathedrals.

-Quarry worker's creed

 


Reply via email to