* git.zsh is now themable: * git_prompt_info() now will look in the following variables for formatting strings: * ZSH_THEME_GIT_PROMPT_PREFIX - Prefix for the prompt (before the branch name) * ZSH_THEME_GIT_PROMPT_SUFFIX - The very end of the prompt * ZSH_THEME_GIT_PROMPT_DIRTY - Displayed when the branch is dirty * ZSH_THEME_GIT_PROMPT_CLEAN - Displayed when the branch is clean * Updated geoffgarside, robbyrussell, and maran to work with new git theme * Added the Risto theme, which is very similar to a number of bash prompts, and allows me to use zsh in with out my co-workers knowing I have the advantage. Think of it as a ninja theme.main
parent
30b43dc9a1
commit
6f001b9b12
@ -1,16 +1,26 @@
|
|||||||
|
#
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="git:("
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="*"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
# get the name of the branch we are on
|
# get the name of the branch we are on
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
if [[ -d .git ]]; then
|
if [[ -d .git ]]; then
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||||
branch=${ref#refs/heads/}
|
branch=${ref#refs/heads/}
|
||||||
CURRENT_BRANCH="git:(%{$fg[red]%}${branch}%{$fg[blue]%})%{$reset_color%}$(parse_git_dirty)"
|
CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
else
|
else
|
||||||
CURRENT_BRANCH=''
|
CURRENT_BRANCH=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $CURRENT_BRANCH
|
echo $CURRENT_BRANCH
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_git_dirty () {
|
parse_git_dirty () {
|
||||||
[[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}"
|
if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
|
else
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) "
|
# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) "
|
||||||
PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) '
|
PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) '
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
# Theme with full path names and hostname
|
# Theme with full path names and hostname
|
||||||
# Handy if you work on different servers all the time;
|
# Handy if you work on different servers all the time;
|
||||||
PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
|
PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) '
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:("
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||||
|
@ -1 +1,6 @@
|
|||||||
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||||
|
Loading…
Reference in new issue