473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

using vim as a python class/module/function etc.. browser

I'm trying to make sense of a python program and was wondering if vim
has any python-oriented functionalities (apart from syntax highlighting)
that would make it somewhat easier to browse the source code.

What I had in mind is something that would let me use CTRL+] to
automatically display whatever object is under the cursor (a bit like
ctags for code written in C..)

I have read somewhere about something called 'ptags' but could not find
it in debian - and I'm not 100% sure it's really a python equivalent of
ctags.

I'm not too keen on using a gui IDE and would much prefer to stick with
vim if at all possible.

Any pointers or tips from python/vim folks welcome.

CJ
Apr 11 '06 #1
7 2771
Chris Jones wrote:
I'm trying to make sense of a python program and was wondering if vim
has any python-oriented functionalities (apart from syntax highlighting)
that would make it somewhat easier to browse the source code.

What I had in mind is something that would let me use CTRL+] to
automatically display whatever object is under the cursor (a bit like
ctags for code written in C..)

I have read somewhere about something called 'ptags' but could not find
it in debian - and I'm not 100% sure it's really a python equivalent of
ctags.


On ptags:
http://www.vim.org/tips/tip.php?tip_id=1188

Of course, modern versions of Exuberant Ctags also support Python, too.

--
Robert Kern
ro*********@gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Apr 11 '06 #2
Robert Kern wrote:
Chris Jones wrote:
I'm trying to make sense of a python program and was wondering if vim
has any python-oriented functionalities (apart from syntax highlighting)
that would make it somewhat easier to browse the source code.

What I had in mind is something that would let me use CTRL+] to
automatically display whatever object is under the cursor (a bit like
ctags for code written in C..)

I have read somewhere about something called 'ptags' but could not find
it in debian - and I'm not 100% sure it's really a python equivalent of
ctags.

On ptags:
http://www.vim.org/tips/tip.php?tip_id=1188

Of course, modern versions of Exuberant Ctags also support Python, too.


I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.

Just need to verify that the stable version (sarge) is modern enough..

Thanks..!
Apr 11 '06 #3
Robert Kern wrote:
Chris Jones wrote:
I'm trying to make sense of a python program and was wondering if vim
has any python-oriented functionalities (apart from syntax highlighting)
that would make it somewhat easier to browse the source code.

What I had in mind is something that would let me use CTRL+] to
automatically display whatever object is under the cursor (a bit like
ctags for code written in C..)

I have read somewhere about something called 'ptags' but could not find
it in debian - and I'm not 100% sure it's really a python equivalent of
ctags.

On ptags:
http://www.vim.org/tips/tip.php?tip_id=1188

Of course, modern versions of Exuberant Ctags also support Python, too.


I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.

Just need to verify that the stable version (sarge) is modern enough..

Thanks..!
Apr 11 '06 #4
Chris Jones wrote:
Robert Kern wrote:
Of course, modern versions of Exuberant Ctags also support Python, too.


I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.


You will probably want to read the vim documentation on how to use ctags from
vim. That will tell you all you need to know without extraneous cruft.
Just need to verify that the stable version (sarge) is modern enough..


It ought to be. It has supported Python for years and years.

--
Robert Kern
ro*********@gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Apr 11 '06 #5
> >>Of course, modern versions of Exuberant Ctags also support Python, too.

I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.


You will probably want to read the vim documentation on how to use ctags
from
vim. That will tell you all you need to know without extraneous cruft.
Just need to verify that the stable version (sarge) is modern enough..


It ought to be. It has supported Python for years and years.


For browsing source code I found the folding feature of vim very
useful. It collapses the body of function and class definitions into
one line so you can have a general overview of definitions in the
code. It is available from version 6 up and I recently wrote a vim
plugin specifically for folding python source code. You can find it
here: http://www.vim.org/scripts/script.php?script_id=1494

There is also an excellent vim plugin by Yegappan Lakshmanan for
working with 'tags' files using ctags. It displays all your function
and class definitions (from multiple files if you wish) in a narrow
vertical window where you can easily jump to the file containing a
chosen definition. This script is here:
http://www.vim.org/scripts/script.php?script_id=273

HTH,
Daniel
Apr 11 '06 #6
Daniel Nogradi wrote:
Of course, modern versions of Exuberant Ctags also support Python, too.

I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.
You will probably want to read the vim documentation on how to use ctags
from
vim. That will tell you all you need to know without extraneous cruft.

Just need to verify that the stable version (sarge) is modern enough..


It ought to be. It has supported Python for years and years.

For browsing source code I found the folding feature of vim very
useful. It collapses the body of function and class definitions into
one line so you can have a general overview of definitions in the
code. It is available from version 6 up and I recently wrote a vim
plugin specifically for folding python source code. You can find it
here: http://www.vim.org/scripts/script.php?script_id=1494


I'm currently re-evaluating my vim habits .. see what new stuff I can
integrate so as to be more productive.. so it's probably a good time to
look into the folding feature...

There is also an excellent vim plugin by Yegappan Lakshmanan for
working with 'tags' files using ctags. It displays all your function
and class definitions (from multiple files if you wish) in a narrow
vertical window where you can easily jump to the file containing a
chosen definition. This script is here:
http://www.vim.org/scripts/script.php?script_id=273
this sounds very useful. Thanks very much for pointing me in the right
direction.

HTH,
Daniel


Apr 11 '06 #7
Daniel Nogradi wrote:
Of course, modern versions of Exuberant Ctags also support Python, too.

I apt-installed this package but the man page is rather intimidating so
I thought I might as well make sure I was going in the right direction.
You will probably want to read the vim documentation on how to use ctags
from
vim. That will tell you all you need to know without extraneous cruft.

Just need to verify that the stable version (sarge) is modern enough..


It ought to be. It has supported Python for years and years.

For browsing source code I found the folding feature of vim very
useful. It collapses the body of function and class definitions into
one line so you can have a general overview of definitions in the
code. It is available from version 6 up and I recently wrote a vim
plugin specifically for folding python source code. You can find it
here: http://www.vim.org/scripts/script.php?script_id=1494


I'm currently re-evaluating my vim habits .. see what new stuff I can
integrate so as to be more productive.. so it's probably a good time to
look into the folding feature...

There is also an excellent vim plugin by Yegappan Lakshmanan for
working with 'tags' files using ctags. It displays all your function
and class definitions (from multiple files if you wish) in a narrow
vertical window where you can easily jump to the file containing a
chosen definition. This script is here:
http://www.vim.org/scripts/script.php?script_id=273
this sounds very useful. Thanks very much for pointing me in the right
direction.

HTH,
Daniel

Apr 11 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: MK | last post by:
I'm working with IIS on W2K server. I'm trying to use module "wmi" in a CGI script but with no success. The following works: import cgitb; cgitb.enable() cgi.test() .... but the...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
5
by: eq | last post by:
Hi, I'm trying to create a program(written in C) that does the following things using embedded Python: 1. Create a module(say, "MyModule") 2. Create a class in that module(say, "MyClass") 3....
4
by: Benjamin Rutt | last post by:
I'm trying to learn about introspection in Python. my ultimate goal is to be able to build a module "text database" of all modules that are in the sys.path, by discovering all candidate modules...
17
by: Jacob Page | last post by:
I have created what I think may be a useful Python module, but I'd like to share it with the Python community to get feedback, i.e. if it's Pythonic. If it's considered useful by Pythonistas, I'll...
5
by: Johann C. Rocholl | last post by:
The following is my first attempt at adding a taint feature to Python to prevent os.system() from being called with untrusted input. What do you think of it? # taint.py - Emulate Perl's taint...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29) Bugs : 965 open ( -9) / 6555 closed (+35) / 7520 total (+26) RFE : 272 open...
0
by: rkmr.em | last post by:
the memory usage of a python app keeps growing in a x86 64 linux continuously, whereas in 32 bit linux this is not the case. Python version in both 32 bit and 64 bit linux - 2.6.24.4-64.fc8 Python...
13
by: John Dann | last post by:
A Python newbie, but some basic understanding of how classes, objects etc work in eg VB.Net. However, I'm struggling a little to translate this knowledge into the Python context. I'm trying to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.