Editor with Python backend

Tres Seaver tseaver at starbase.neosoft.com
Thu Mar 23 00:20:51 EST 2000


In article <38D94FFD.F0BA60C8 at udel.edu>,
Charles Boncelet  <boncelet at udel.edu> wrote:
>Johann Hibschman wrote:
>
>> Charles Boncelet writes:
>>
>> > I use vim and have read these man pages, but I still haven't
>> > figured out why? What would I use python for from within vim?
>> > How do you use python within vim (or any other editor)?
>>
>> (stuff deleted)
>>
>> Here's an example.  Say I have a file with ^M's and spurious spaces at
>> the end of the lines.  I can type in the interpreter window:
>>
>> for line in buffer["filename"].modifiable_line_iter():
>>   line.set(string.rstrip(line.get())+"\n")
>
>I know you are just giving an example of what you want to do,
>but deleting ^M's is more easily done with vim commands
>:%s/^M$//
>
>My point is that vim is a pretty powerful editor and for routine
>editing tasks I see no need for python.  I suppose for tricky
>editing that one has to do repeatedly, having python around
>might be a good thing.
>
>Some things I'd like to see:
>1. Being able to execute the highlighted line or lines.  This would
>greatly
>enhance vim as a python development environment.  (If this can
>be done now, I'd appreciate a quick pointer.)

:py import vim, string
:py exec( string.join( vim.current.range, '\n' ) )

(I leave binding that to a key as an exercise...)
>
>2. An outline mode for vim.  Maybe one can be written in python.
>
>3. Python would really be useful if it ran in the background,
>automatically interpreting editing events.

My current vim/python project is an attempt to use python's ftplib to allow
for remote editing, a la ange-ftp.  I am close, but not there yet;  when I
get there, and can edit Zope methods in vim, I can probably die happy.

Tres.
-- 
---------------------------------------------------------------
Tres Seaver           tseaver at palladion.com       713-523-6582
Palladion Software    http://www.palladion.com



More information about the Python-list mailing list