[CentralOH] Browsing Python Modules
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Sun Jul 24 07:42:08 CEST 2011
On Wed, 20 Jul 2011 08:12:19 -0400, Mark Erbaugh <mark at microenh.com> wrote:
> How do folks using vi to write their Python code find the
> Python source of libraries used by their application?
I don't use vi as an IDE. I lean towards the Unix philosophy of
having many small programs where each one does one thing well.
The magic is how one uses them (alone and in combination with
other programs). The shell is the closest I come to using an IDE.
I had never tried to do what you asked about. I would probably
use the locate program. For example:
[jep at localhost ~]$ locate os.py
/etc/rpm/macros.python26
/usr/lib/python2.4/os.py
/usr/lib/python2.4/os.pyc
/usr/lib/python2.4/os.pyo
/usr/lib/python2.4/encodings/palmos.py
/usr/lib/python2.4/encodings/palmos.pyc
/usr/lib/python2.4/encodings/palmos.pyo
/usr/lib/python2.4/site-packages/libsvn/repos.py
/usr/lib/python2.4/site-packages/libsvn/repos.pyc
/usr/lib/python2.4/site-packages/libsvn/repos.pyo
/usr/lib/python2.4/site-packages/svn/repos.py
/usr/lib/python2.4/site-packages/svn/repos.pyc
/usr/lib/python2.4/site-packages/svn/repos.pyo
/usr/lib/python2.4/site-packages/yum/repos.py
/usr/lib/python2.4/site-packages/yum/repos.pyc
/usr/lib/python2.4/site-packages/yum/repos.pyo
/usr/lib/python2.4/test/test_os.py
/usr/lib/python2.4/test/test_os.pyc
/usr/lib/python2.4/test/test_os.pyo
/usr/lib/python2.6/os.py
/usr/lib/python2.6/os.pyc
/usr/lib/python2.6/os.pyo
/usr/lib/python2.6/encodings/palmos.py
/usr/lib/python2.6/encodings/palmos.pyc
/usr/lib/python2.6/encodings/palmos.pyo
[jep at localhost ~]$
Slightly refined to:
[jep at localhost ~]$ locate os.py | grep '/os.py'
/usr/lib/python2.4/os.py
/usr/lib/python2.4/os.pyc
/usr/lib/python2.4/os.pyo
/usr/lib/python2.6/os.py
/usr/lib/python2.6/os.pyc
/usr/lib/python2.6/os.pyo
[jep at localhost ~]$
I could do that within vim with the following vim commands:
!!locate os.py
!!locate os.py | grep /os.py
:r!locate os.py
:r!locate os.py | grep /os.py
That said, there are other folks who try to do much with vim
for messing with Python. I.e., to use vim as a Python IDE.
http://wiki.python.org/moin/Vim
http://dancingpenguinsoflight.com/2009/02/python-and-vim-make-your-own-ide/
http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/
http://www.sontek.net/python-with-a-modular-ide-vim
Search for Python here: http://www.vim.org/scripts/index.php
More information about the CentralOH
mailing list