mac ~/.bash_profile
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
#Git-cli highlight
export PS1="\u@\h:\w \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
## functions start
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
function git_since_last_commit {
now=`date +%s`;
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return;
seconds_since_last_commit=$((now-last_commit));
minutes_since_last_commit=$((seconds_since_last_commit/60));
hours_since_last_commit=$((minutes_since_last_commit/60));
minutes_since_last_commit=$((minutes_since_last_commit%60));
echo "${hours_since_last_commit}h${minutes_since_last_commit}m ";
}
#列出当前目录
function tree
{
if [[ $1 ]]; then
find . -maxdepth $1 -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
else
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
fi
}
ws() { open -a WebStorm ${1-'.'}; } # 用指定的编辑器编辑当前文件或者指定的文件\
psm() { open -a PhpStorm ${1-'.'}; } # 用PhpStorm打开指定文件夹
PS1="\u:\W \[\033[0m\]\[\033[1;36m\]\$(git_branch)\[\033[0;33m\]\$(git_since_last_commit)\[\033[0m\]\$ "
### functions end
### Aliases
alias subl=\''/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'\'
alias ls='ls -G'
alias ll='ls -alh'