Last active
March 18, 2019 02:41
-
-
Save wastemobile/e7aebc2078b2aae5bdfa93d99f93cbd6 to your computer and use it in GitHub Desktop.
bash_profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
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 "; | |
} | |
PS1="[\[\033[1;32m\]\w\[\033[0m\]] \[\033[0m\]\[\033[1;36m\]\$(git_branch)\[\033[0;33m\]\$(git_since_last_commit)\[\033[0m\]$ " | |
[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh | |
PATH=/usr/local/sbin:$PATH:/Users/usrname/bin | |
# 手動使用 git 安裝 NVM 的設置 | |
# export NVM_DIR="/Users/urname/.nvm" | |
# [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | |
# NVM from Homebrew | |
source $(brew --prefix nvm)/nvm.sh | |
# 用 rbenv 安裝比系統自帶更新的 ruby 版本 | |
eval "$(rbenv init -)" | |
# 直接以 brew install php 安裝的是最新版 PHP 7.3 | |
# 若指定安裝 PHP 7.2 或較低版本,需要額外設置 | |
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | |
export PATH="/usr/local/opt/[email protected]/sbin:$PATH" | |
export LDFLAGS="-L/usr/local/opt/[email protected]/lib" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment