Skip to content

Instantly share code, notes, and snippets.

@necocen

necocen/necocen.zsh-theme Secret

Last active Dec 24, 2015
Embed
What would you like to do?
oh-my-zsh用のテーマファイル。自分好みのがなかったのでysとfishyをベースに自作。
# Based on ys(http://ysmood.org/wp/2013/03/my-ys-terminal-theme/) and fishy.
# Modified by necocen.
# Machine name.
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
# git info+sha+status
function git_prompt_info_sha_status() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty) $(git_prompt_short_sha)$(git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
# Prompt format: \n # USER@MACHINE DIRECTORY [BRANCH SHA STATE] [DATE TIME] \n $
PROMPT='
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%{$fg[cyan]%}%n\
%{$fg[white]%}@\
%{$fg[green]%}$(box_name)\
%{$fg[white]%} \
%{$fg[yellow]%}%~%{$reset_color%} \
$(git_prompt_info_sha_status)%{$reset_color%}\
%{$fg[white]%}[%{$fg[white]%}%D{%F %T}%{$fg[white]%}]
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}[%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[white]%}]%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"
@necocen

This comment has been minimized.

Copy link
Owner Author

@necocen necocen commented Oct 8, 2013

スクリーン・ショット: http://gyazo.com/e8ef633125f0d737ee2648ad99a56d97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment