Skip to content

Instantly share code, notes, and snippets.

@akrabat
Last active January 28, 2021 06:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akrabat/c6b35f04e3b785e693a9e366680b3e29 to your computer and use it in GitHub Desktop.
Save akrabat/c6b35f04e3b785e693a9e366680b3e29 to your computer and use it in GitHub Desktop.
git hooks for ctags. Place in `.git_template/hooks/` & run: `git config --global init.templatedir '~/.git_template'`
#!/bin/sh
set -e
PATH="$HOME/bin:/usr/local/bin:$PATH"
mkdir .git/tags_lock 2>/dev/null || exit 0
trap 'rmdir .git/tags_lock; if [ -f .git/tags.$$ ]; then rm .git/tags.$$; fi' EXIT
# Assumes universal-ctags is on the path
ctags --tag-relative=yes -R -f .git/tags.$$
mv .git/tags.$$ .git/tags
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment