LoginSignup
4

More than 5 years have passed since last update.

Quick Reference for Git Mark of oh-my-zsh 'wedisagree' Theme

Last updated at Posted at 2014-11-26

mac のヒトにはお勧めの、oh-my-zsh の wedisagree テーマを使うと、git の状態をマークで表示してくれます。
ですがそのマークがちと分かりづらい。覚えてしまえば楽なのだろうけれども、なかなか覚えられない。
というワケで、クイック・リファレンスになる関数を作りました。

function ph() {
  local prompt_descriptions
  prompt_descriptions=(
    $ZSH_THEME_GIT_PROMPT_DIRTY 'dirty\tclean でない'
    $ZSH_THEME_GIT_PROMPT_UNTRACKED 'untracked\tトラックされていないファイルがある'
    $ZSH_THEME_GIT_PROMPT_CLEAN 'clean'
    $ZSH_THEME_GIT_PROMPT_ADDED 'added\t追加されたファイルがある'
    $ZSH_THEME_GIT_PROMPT_MODIFIED 'modified\t変更されたファイルがある'
    $ZSH_THEME_GIT_PROMPT_DELETED 'deleted\t削除されたファイルがある'
    $ZSH_THEME_GIT_PROMPT_RENAMED 'renamed\tファイル名が変更されたファイルがある'
    $ZSH_THEME_GIT_PROMPT_UNMERGED 'unmerged\tマージされていないファイルがある'
    $ZSH_THEME_GIT_PROMPT_AHEAD 'ahead\tmaster リポジトリよりコミットが進んでいる'
  )

  local i
  for ((i = 1; i <= $#prompt_descriptions; i += 2))
  do
    local p=$prompt_descriptions[$i]
    local d=$prompt_descriptions[$i+1]
    echo `echo $p | sed -E 's/%.| //g'` $reset_color $d
  done
}

~/.zshrc の oh-my-zsh を読み込んでるトコ (source $ZSH/oh-my-zsh.sh の行) の後に追加して下さい。

実行結果
screenshot.png

以下を参考にしました。
https://www.eisbahn.jp/yoichiro/2013/01/oh-my-zsh-wedisagree-git.html

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4