Koumbit.org

For freedom and solidarity online

Using Exuberant Ctags for Drupal

The two most common powerful editors for Unix, emacs and vim, both include the ability to reference a list of PHP function names so that you can jump to their definition while editing. You'll have to build the file yourself first, though, using ctags. The best implementation I know of is Exuberant Ctags by Darren Hiebert, which is available in most Linux distributions (although it's generally not the version installed by default). Normally this is called just by running ctags -R, but by default ctags assumes that all PHP code is in files with names ending in .php. For Drupal, I suggest the following command, to be run from the base directory of your Drupal installation:

ctags --langmap=php:.engine.inc.module.theme.install.php --php-kinds=cdfi --languages=php --recurse

This simply runs ctags recursively from the current directory, parsing .engine, .inc, .module, .theme, .install, and .php files as PHP. This will leave a file called tags in the current directory; you can then configure your editor to look for it there. The --php-kinds option tells ctags to only list classes, constant definitions, functions, and interfaces (by default it would also list all variables). The --languages option tells ctags not to index anything other than PHP (for example, Javascript files would be ignored).

ctags and both editors I mentioned are also available for Windows and Mac OS, if you're so inclined.

Add new comment

Call us

☏ +1 514 907 9494
Lun: 10h à 12h
Mar/Mer: 10h à 12h et 13h à 16h
Jeu: 10h à 12h
Mon: 10AM to 12PM
Tue/Wed: 10AM to 12PM et 13AM to 16PM
Thu: 10AM to 12PM

Come and See Us!

1883, rue Atateken,
Montréal (Québec) H2L 3L7, Canada
Veuillez noter que nos bureaux n'ont pas de stationnement attitré.
1883 Atateken Street,
Montreal, Quebec, H2L 3L7, Canada
Please note that you'll need to find on-street parking.

Write to Us

Informations générales

Support technique

Pour une demande de devis, voir le formulaire à la page contact.

Nos clefs PGP

General inquiries

Technical support

For a free estimate, see the form on our contact page.

Our PGP keys

Follow Us

ktweb_menu_social