Git hooks, ctags & Rails

Small adjustment to Tim Pope’s outstanding Effortless Ctags with Git:

To get ctags to also index all bundled gems (including Rails), make the following change to the ctags hook

Replace

git ls-files | \
  ctags --tag-relative -L - -f"$dir/$$.tags" --languages=-javascript,sql

with

ctags --recurse --tag-relative -f"$dir/$$.tags" --languages=-javascript,sql `bundle show --paths` `git ls-files`

After triggering the hook, the tags file takes a few seconds to generate in the background – have patience 🙂

Advertisements

2 thoughts on “Git hooks, ctags & Rails

  1. Amir says:

    Replace
    ctags –recurse –tag-relative -f”$dir/$$.tags” –languages=-javascript,sql `bundle show –paths` `git ls-files`

    With
    { bundle show –paths; git ls-files; } | \
    ctags –recurse –tag-relative -f”$dir/$$.tags” –languages=-javascript,sql

    … to handle spaces in file names the same way Tim’s script did.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: