betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

19 March 2007

Generating Tags for Python Code (including Subfolders)

Another of those Unix / Shell "reminder to self" posts

If you want to create a "tags" file for use with vi / vim (or even emacs [makes sign of cross]), there are a couple of tools out there. ctags(1) comes with most modern OSs, but it doesn't do python. So hint 1: Use the script that came with your python distribution [1]. To build tags for all python files in a directory the usage is something like: *.py

Hint 2: If you want to build tags for all python scripts in a folder hierarchy (say for some project) you can use:

find -X . -name \*.py -print | xargs
These of course assume that you moved to somewhere in your shell's $PATH. Hint 3 would be the -X argument to find(1), it's a safety switch that tells find(1) to ignore filenames xargs would choke on.

1: If your system has python but doesn't have, download the matching tarball from, just untar it and find it in the contents (Tools/scripts/

Posted by betabug at 08:53 | Comments (1) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Exceptions, PGP, and Athens by Night and Bike | Main | PGP Talk for HelMUG >>
Re: Generating Tags for Python Code (including Subfolders)

Thanks, this was really helpful. I mapped the command to \ptags using the following:

noremap \ptags :! find -X . -name \*.py -print \| xargs ~/Development/Tools/


Posted by: Toby de Havilland at September 15,2009 16:02
You can trackback to:
There are no trackbacks.
Leave a comment