Context Sensitive Python Help in VIM
David LeBlanc
whisper at oz.nospamnet
Wed May 16 20:01:52 EDT 2001
[This followup was posted to comp.lang.python and a copy was sent to the
cited author.]
In article <14bud9.u5u.ln at demonseed.net>, jp at NOSPAMdemonseed.net says...
> I've written an extension for VIM to allow context sensitive help for python
> code. It looks up the __doc__ or __dict__ field for builtins, modules and
> module members when you hit F2.
>
> It does a little more than idle and pythonwin. I hope to add more when I find
> some time. Please send me your ideas!
>
> You can grab it at:
> http://www.demonseed.net/~jp/code/pyhelp.py
>
> You will need a version of VIM compiled with an embedded python interpreter.
>
> -jason
>
For windows users:
In the pyhelp file where it says "copy this file to .vim" it means a
subdirectory of your "home" directory called ".vim". You won't be able to
create a directory starting with a "." from the file explorer, but you
should (on Windows NT or Windows 2000) be able to from a console window.
Alternatively for Windows 9x and ME, you can use a "_" as the first
letter of the directory where pyhelp.py will live, then change the ".vim"
in the sys.path.append below to "_vim". (Remeber, this is a directory,
not the name of a file!.)
If you don't have a "home" directory, then you should add to your
environment (autoexec.bat for Windows 9x or ME; settings|control
panel|system|Environment):
setOME=<drive>:/some/nice/place/to/put/settings/
WITH NO SPACES IN THE PATH would be best - vim seems not to like paths
with spaces in them! After doing this, you'll have to reboot (Windows 9x
or ME) or quit and restart any console windows (Windows NT, 2000).
The alternative is to change the line:
py import sys,os; sys.path.append(os.path.expanduser("~/.vim/"))
to:
py import sys,os; sys.path.append("<drive>:/my/home/.vim/")
Instead of your .vimrc (or _vimrc file as used on Windows), put the lines
mentioned in item #2 of the directions in your .gvimrc or _gvimrc file
if you use the GUI version of vim.
I believe this is correct: it worked for me on Windows NT and should work
on the other MS os's.
Dave LeBlanc
More information about the Python-list
mailing list