Skip to content

Instantly share code, notes, and snippets.

@bitqiu
Last active March 9, 2016 06:37
Show Gist options
  • Select an option

  • Save bitqiu/d53b2a0aeb069d121534 to your computer and use it in GitHub Desktop.

Select an option

Save bitqiu/d53b2a0aeb069d121534 to your computer and use it in GitHub Desktop.
zsh-theme
# Directory info.
local current_dir='${PWD/#$HOME/~}'
# Git info.
local git_info='$(git_prompt_info)'
local git_last_commit='$(git_last_commit_cm)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}on git:%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔︎"
# git last commit
git_last_commit_cm() {
if [ -n "$(git log --pretty=format:"%h \"%s\"" -1 2> /dev/null)" ]; then
echo -e
echo -n $(git log --pretty=format:"%h \"%s\"" -1 2> /dev/null)
fi
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT="%{$fg[cyan]%}%n%{$reset_color%} in \
%{$terminfo[bold]$fg[yellow]%}[${current_dir}]%{$reset_color%} \
${git_info} \
${git_last_commit}
${ret_status} %{$reset_color%}"

用法

下载主题

cd ~/.oh-my-zsh/themes/
wget https://gist.github.com/bitqiu/d53b2a0aeb069d121534/raw/100fa99858f5b0970e0e7a0b726b68da90a72403/bitqiu.zsh-theme

修改 .zshrc

vi ~/.zshrc

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