1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-09 08:50:40 +01:00

Create an alias to open up sublime project (#5258)

* Adding an alias to open up the sublime project

* README update for stp command
This commit is contained in:
Peter Han
2016-08-14 18:00:19 -07:00
committed by Robby Russell
parent 95371afdd8
commit 073ea01cce
2 changed files with 33 additions and 2 deletions

View File

@@ -56,3 +56,32 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
fi
alias stt='st .'
find_project()
{
local PROJECT_ROOT="${PWD}"
local FINAL_DEST="."
while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do
PROJECT_ROOT=$(dirname $PROJECT_ROOT)
done
if [[ $PROJECT_ROOT != "/" ]]; then
local PROJECT_NAME="${PROJECT_ROOT##*/}"
local SUBL_DIR=$PROJECT_ROOT
while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do
SUBL_DIR=$(dirname $SUBL_DIR)
done
if [[ $SUBL_DIR != "/" ]]; then
FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project"
else
FINAL_DEST=$PROJECT_ROOT
fi
fi
st $FINAL_DEST
}
alias stp=find_project