Skip to content

Instantly share code, notes, and snippets.

@pvdb
Last active February 27, 2023 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 ;
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