Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2012 10:47
Show Gist options
  • Save anonymous/4335885 to your computer and use it in GitHub Desktop.
Save anonymous/4335885 to your computer and use it in GitHub Desktop.
This shell script is inspired by dirtags.sh in: http://ctags.sourceforge.net/faq.html#15 This thing does 2 things written in the website. 1. Makes "tags" file in each directory under the given directory. 2. Makes "tags" file in the given directory, which contains all tags under the directory. Example: When you have this structure: ~/project/hoge…
#!/bin/sh
# Inspired by dirtags.sh from: http://ctags.sourceforge.net/faq.html#15
# Using "Approach 3" written in the website, but there are two changes.
# 1. Type one command and you are done. For current dir: $ dirtags_mac.sh .
# I'm pretty sure you don't want do this at $HOME, so handle with care!
# 2. Use ctags in MacVim.app directory. Do not use the Mac default. It sucks.
# Please do not forget to chmod +x
CMDNAME=`basename $0`
if [ $# -ne 1 ]; then
echo "Usage: $CMDNAME dir" 1>&2
exit 1
fi
cd $1
pwd
for var in `find * -type d`
do
cd $var
/Applications/MacVim.app/Contents/MacOS/ctags *
cd - > /dev/null # cd yells when used with - option, so /dev/null it.
done
/Applications/MacVim.app/Contents/MacOS/ctags --file-scope=no -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment