Login

Build tags files for emacs and vim

Author:
ramen
Posted:
November 19, 2009
Language:
Python
Version:
1.1
Tags:
tags emacs vim
Score:
0 (after 0 ratings)

Save this shell script to the root of your Django project as "tags.sh", make it executable with "chmod +x tags.sh", and run it from the project root with "./tags.sh", and you will have a "tags" file for vim and a "TAGS" file for emacs.

Tags will be created for Python, JavaScript, and block names found in HTML templates. You may need to change "/usr/share/pyshared/django" to the location of your Django installation.

Documentation on Tags in emacs | Tags in vim

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/bin/sh
:>TAGS
:>tags
for dir in . /usr/share/pyshared/django; do
  find $dir -name '*.py' | etags -a -
  find $dir -name '*.py' | ctags -a -
  find $dir -name '*.js' | etags -a -
  find $dir -name '*.js' | ctags -a -
  find $dir -name '*.html' | etags -a --regex='/.*{%[ \t]+block[ \t]+\([^ \t%]+\)/\1/' -
  find $dir -name '*.html' | ctags -a --regex='/.*{%[ \t]+block[ \t]+\([^ \t%]+\)/\1/' -
done

More like this

  1. Upgrade django url tags by Craterdome 1 year, 12 months ago
  2. Google Closure support in django-compress by fabrice.bonny 5 years, 4 months ago
  3. Generic admin action export selected rows to excel by jordic 3 years, 5 months ago
  4. Generic admin action export selected rows to excel by aemb87 2 years, 5 months ago
  5. Autoload Django Models When Using ./manage.py shell by sheats 7 years, 2 months ago

Comments

Scanner (on November 19, 2009):

I do something like that, but instead of hardcoding '.' and '/usr/share/pyshared/django' for every project I am working on I tend to have 'PYTHONPATH' set up so I use this pattern:

for dir in `echo $PYTHONPATH | sed 's/:/ /g'`; do

#

Please login first before commenting.