Skip to content

Instantly share code, notes, and snippets.

@masudak
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masudak/c9dc9270cf3cc71dc454 to your computer and use it in GitHub Desktop.
Save masudak/c9dc9270cf3cc71dc454 to your computer and use it in GitHub Desktop.
# Created by newuser for 5.0.5
source /home/vagrant/zaw/zaw.zsh
#bindkey '^t' zaw
bindkey '^R' zaw-history
bindkey '^p' zaw-cdr
#bindkey '^g' zaw-git-branches
bindkey '^g' zaw-git-recent-branches
bindkey '^@' zaw-git-files
zstyle ':filter-select' case-insensitive yes # 絞り込みをcase-insensitiveに
# auto-fu.zsh(補完強化)
if [ -f ~/.zsh/auto-fu.zsh ]; then
source ~/.zsh/auto-fu.zsh
function zle-line-init () {
auto-fu-init
}
zle -N zle-line-init
fi
# autojump(移動履歴)
#[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
HISTFILE=${HOME}/.zsh_history
HISTSIZE=1000
export SAVEHIST=100000
setopt EXTENDED_HISTORY
setopt hist_ignore_all_dups
autoload -Uz compinit && compinit
autoload bashcompinit
bashcompinit
source ~/git-completion.zsh
#zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
#zstyle ':completion:*:*:git:*' script /usr/share/doc/git-1.7.1/contrib/completion/git-completion.bash
# ----- PROMPT -----
## PROMPT
PROMPT=$'[%*] → '
## RPROMPT
RPROMPT=$'`branch-status-check` %~' # %~はpwd
setopt prompt_subst #表示毎にPROMPTで設定されている文字列を評価する
# {{{ methods for RPROMPT
# fg[color]表記と$reset_colorを使いたい
# @see https://wiki.archlinux.org/index.php/zsh
autoload -U colors; colors
function branch-status-check {
local prefix branchname suffix
# .gitの中だから除外
if [[ "$PWD" =~ '/\.git(/.*)?$' ]]; then
return
fi
branchname=`get-branch-name`
# ブランチ名が無いので除外
if [[ -z $branchname ]]; then
return
fi
prefix=`get-branch-status` #色だけ返ってくる
suffix='%{'${reset_color}'%}'
echo ${prefix}${branchname}${suffix}
}
function get-branch-name {
# gitディレクトリじゃない場合のエラーは捨てます
echo `git rev-parse --abbrev-ref HEAD 2> /dev/null`
}
function get-branch-status {
local res color
output=`git status --short 2> /dev/null`
if [ -z "$output" ]; then
res=':' # status Clean
color='%{'${fg[green]}'%}'
elif [[ $output =~ "[\n]?\?\? " ]]; then
res='?:' # Untracked
color='%{'${fg[yellow]}'%}'
elif [[ $output =~ "[\n]? M " ]]; then
res='M:' # Modified
color='%{'${fg[red]}'%}'
else
res='A:' # Added to commit
color='%{'${fg[cyan]}'%}'
fi
# echo ${color}${res}'%{'${reset_color}'%}'
echo ${color} # 色だけ返す
}
# }}}
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment