Pythonising the vim (e.g. syntax popups)

Micah Elliott mde at micah.elliott.name
Wed Nov 9 16:28:25 EST 2005


On Nov 09, Christoph Haas wrote:
> I'm an addicted vim user and don't really use the IDLE for anything
> more than calculations where I'm too lazy to start KCalc. But one
> feature is very pretty: the built-in help for function calls while
> you type. Like you enter...
> 
> var1,var2=mystring.split(
> ...and the IDLE shows me a popup saying...
> "S.split([sep [,maxsplit]]) -> list of strings

The PIDA IDE <http://pida.berlios.de/index.php/PIDA:Features> claims
to be able to do something like this.  I have not used PIDA, but I too
am a vim zealot and I think wrapping vim with extra functionality is a
great idea, and I'll try it out when I get a chance.

> Is there a decent way to get that help into vim? Or like showing
> docstrings or help that I get through pydoc on request?

You can set 'keywordprg' to something like "pydoc" to enable "K" to
pull up the help.  Its default setting is to open manpages for words
under the cursor.  I don't use it since I've got an interpreter shell
sitting in the corner of most virtual desktops -- doesn't everyone?

And ctags features are excessively prevalent in vim, and ctags works
fine with python IME.  You can create a tags file of your whole
python installation.

> I've been working myself through a pile of vim macros/plugins but
> couldn't find even one which simplifies programming in Python.

Matchit is a good one for %-matching:
http://www.vim.org/scripts/script.php?script_id=39

> Further issues would be handling the indentation

Eric McSween wrote a python indenter:
http://www.vim.org/scripts/script.php?script_id=974

> - maybe a plugin which syntax colors

Sure, that's builtin.  But Dmitry Vasiliev wrote some useful
enhancements:
http://www.vim.org/scripts/script.php?script_id=790
Note that you'll have to enable some variables in the macro.

> syntax colors different levels of indentation so I don't have to use
> my plastic ruler on the screen.

That's kind of a nice idea, and it should be an easy one to write (but
I'm not volunteering).  You could write it (:h syntax-highlighting) or
maybe post a request to the vim mailing list <vim at vim.org>.

Otherwise, folding would be useful for this.  Pyfold might be helpful,
though I haven't tried it:
http://www.vim.org/scripts/script.php?script_id=781

I like the ruler idea!  Usually when I find myself straining to figure
out what level I'm at it means it's time to refactor.

-- 
_ _     ___
|V|icah |- lliott  http://micah.elliott.name  mde at micah.elliott.name
" "     """



More information about the Python-list mailing list