Skip to content

Instantly share code, notes, and snippets.

@pvdb
Last active April 23, 2025 07:50
Show Gist options
  • Save pvdb/a66e6f28efd65bc166578ea0b4e05d6c to your computer and use it in GitHub Desktop.
Save pvdb/a66e6f28efd65bc166578ea0b4e05d6c to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# INSTALLATION
#
# ln -s ${PWD}/git-ctags $(brew --prefix)/bin/
# sudo ln -s ${PWD}/git-ctags /usr/local/bin/
#
# https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html
# https://github.com/tpope/vim-fugitive/commit/63a05a6#r35299123
#
# EXUBERANT - http://ctags.sourceforge.net/ - brew install ctags
# UNIVERSAL - https://ctags.io/ - brew install universal-ctags
#
set -e ;
[ "$(uname -s)" = 'Darwin' ] && PATH="$(brew --prefix)/bin:${PATH}" ;
(
unset GIT_DIR GIT_WORK_TREE ;
git_toplevel="$(git rev-parse --show-toplevel)" ;
trap 'rm -f "${git_toplevel}/$$.tags"' EXIT INT TERM ;
git ls-files | ctags --tag-relative -L - -f "${git_toplevel}/$$.tags" ;
mv "${git_toplevel}/$$.tags" "${git_toplevel}/tags" ;
)
# That's all Folks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment