From ad86b0608c25d51e923d2ac910519c54d196c99d Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 27 Mar 2018 22:48:18 +0100 Subject: [PATCH] fixing create_tag, adding git top dir lookup. --- config/.bashrc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) 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