vim .zshrc
# zsh-completions(補完機能)の設定 if [ -e /usr/local/share/zsh-completions ]; then fpath=(/usr/local/share/zsh-completions $fpath) fi autoload -U compinit compinit -u #vim系 alias v='vim' alias vi='vim' #ls系 alias ls='ls -G' alias la='ls -a' alias ll='ls -lh' #cd系 alias tm='cd ~/Work/hoge/' # 同時に起動しているzshの間でhistoryを共有する setopt share_history # 同じコマンドをhistoryに残さない setopt hist_ignore_all_dups # スペースから始まるコマンドをhistoryに残さない setopt hist_ignore_space # ブランチ名を色付きで表示させるメソッド function rprompt-git-current-branch { local branch_name st branch_status if [ ! -e ".git" ]; then # gitで管理されていないディレクトリは何も返さない return fi branch_name=`git rev-parse --abbrev-ref HEAD 2> /dev/null` st=`git status 2> /dev/null` if [[ -n `echo "$st" | grep "^nothing to"` ]]; then # 全てcommitされてクリーンな状態 branch_status="%F{green}" elif [[ -n `echo "$st" | grep "^Untracked files"` ]]; then # gitに管理されていないファイルがある状態 branch_status="%F{red}?" elif [[ -n `echo "$st" | grep "^Changes not staged for commit"` ]]; then # git addされていないファイルがある状態 branch_status="%F{red}+" elif [[ -n `echo "$st" | grep "^Changes to be committed"` ]]; then # git commitされていないファイルがある状態 branch_status="%F{yellow}!" elif [[ -n `echo "$st" | grep "^rebase in progress"` ]]; then # コンフリクトが起こった状態 echo "%F{red}!(no branch)" return else # 上記以外の状態の場合は青色で表示させる branch_status="%F{blue}" fi # ブランチ名を色付きで表示する echo "${branch_status}[$branch_name]" } # プロンプトが表示されるたびにプロンプト文字列を評価、置換する setopt prompt_subst # プロンプトの右側(RPROMPT)にメソッドの結果を表示させる RPROMPT='`rprompt-git-current-branch`'