diff --git a/config/.bashrc b/config/.bashrc index bc62c81..e444b75 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -282,6 +282,7 @@ function cgrep() { fi } + function create_tags() { #Bloomberg if [ -e /opt/swt/bin/ctags ]; then @@ -294,21 +295,19 @@ function create_tags() { CTAGS_OPT+='--totals=yes ' CTAGS_OPT+='--tag-relative=yes ' - CTAGS_DIR='.ctags_dir' - if [ -f $PWD/$CTAGS_DIR ]; then - CTAGS_ROOT="$PWD" - elif [ -f $PWD/../$CTAGS_DIR ]; then - CTAGS_ROOT="$PWD/.." - elif [ -f $PWD/../../$CTAGS_DIR]; then - CTAGS_ROOT="$PWD/../.." - else - CTAGS_ROOT="$PWD" + CTAGS_DIR_CFG='.ctags_dir' + CTAGS_ROOT="$PWD" + if [ ! -f $PWD/$CTAGS_DIR_CFG ]; then + GIT_ROOT=$(git top pwd) + if [ -f $GIT_ROOT/$CTAGS_DIR_CFG ]; then + CTAGS_ROOT="$GIT_ROOT" + fi fi - if [ -f $CTAGS_ROOT/$CTAGS_DIR ]; then + if [ -f $CTAGS_ROOT/$CTAGS_DIR_CFG ]; then CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR" else - CTAGS_SRC="$%" + CTAGS_SRC="$@" fi cd $CTAGS_ROOT