473,586 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2789
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*********@gma il.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
automatical ly 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
automatical ly 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*********@gma il.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
6272
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 following isn't working:
220
18938
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 any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it...
5
2273
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. Create a function in that module(say, "MyFunction") The Python-code would look like this: MyClass.py:
4
2644
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 (I've already done that), importing all of them, and then introspecting on each module to discover its functions, globals and classes. But for now I...
17
2030
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 see about hosting it on Sourceforge or something like that. Is this a good forum for exposing modules to the public, or is there somewhere...
5
2146
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 feature in Python # Copyright (C) 2007 Johann C. Rocholl <johann@rocholl.net> # # Permission is hereby granted, free of charge, to any person #...
0
330
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 ( +4) / 253 closed ( +2) / 525 total ( +6) New / Reopened Patches ______________________
0
1175
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 2.5.1 (r251:54863, Oct 30 2007, 13:45:26) i isolated the memory leak problem to a function that uses datetime module extensively. i use...
13
2078
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 teach myself this aspect of Python by working up a trial project, part of which calls for pulling in data from a serial data connection at regular...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.