IDLE history, Python IDE, and Interactive Python with Vim

Kartic removethis.kartic.krishnamurthy at gmail.com
Thu Feb 3 07:44:11 EST 2005


Ashot said the following on 2/2/2005 9:45 PM:


> Vim related:
> ----------------------
> Ideally, it would be nice to have a command mapped to a keystroke that 
> can  append the last executed command to a file.  Even better would be a 
> system  that would integrate the file editing and interactive command 
> line tool  more seamlessly.  Something along the lines of a debugger + 
> file editor  + command line utility, where file editor = vim.  I know 
> that vim has a  utility for running python commands from its command 
> prompt, but I have  had a hard time getting this to work in windows and 
> haven't explored it.   Has anyone seen/tried a system along these lines, 
> perhaps incorporating  the python debugger (pdb)?  I can see something 
> that will run the file you  are editing in vim up to the cursor or a 
> mark with a set_trace at the line  you are editing.


I am VIM guy too but I have not got to the point of writing a VIM macro 
to execute a selection.

VIM on UNIXish OSes can be built with the Python interpreter (so using 
:python <expr or exec string> will execute it). AFAIK, Vim on Windows is 
  able to execute Python using the :python notation; I guess it uses the 
Python installation. I actually did not have to do anything other than 
install GVim; it just works on windows with :python.

Try :help python in Vim to read the relevant help entries.

I was considering writing a macro, map it to a keystroke for one to 
execute a selected code block in VIM but have not yet got around to 
doing it. May be one of these days..sigh...

This probably does not help you very much but there is hope :-)

Like Fuzzyman said you can set the EDITOR environment variable and use 
IPython. The magic %edit <slice notation from history or no arguments> 
will fire up your editor and the script will be saved to a temp file. 
Though I am not entirely happy with that feature (may be something that 
I am missing) but I live it. So if you set EDITOR as gvim.exe in 
Windows, IPython fires up Gvim instead of the default notepad (yuck!).

In IPython, you can type pdb at the prompt and it toggles the debugger 
state. So if your program raises an error, IPython starts pdb if debug 
is on. IPython is nifty but I am just getting a feel for it.

Thanks,
-Kartic



More information about the Python-list mailing list