mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Merge branch 'plugin-git' into merge
Conflicts: custom/aliases.zsh plugins/git/git-aliases.plugin.zsh plugins/git/git-prompt-old.plugin.zsh plugins/git/git-prompt.plugin.zsh plugins/git/git.plugin.zsh themes/ashleydev.zsh-theme
This commit is contained in:
commit
415bdbfe6d
135 changed files with 2170 additions and 1523 deletions
|
|
@ -6,45 +6,66 @@
|
|||
# SCREENSHOT:
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
|
||||
PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)]
|
||||
%# '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
|
||||
RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
|
||||
else
|
||||
PROMPT='[%n@%m:%~$(git_prompt_info)]
|
||||
%# '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%? ↵)"
|
||||
|
||||
RPROMPT='${return_code}$(git_prompt_status)'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED=" ✚"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED=" ✖"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED=" ➜"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED=" ═"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭"
|
||||
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_COLORS" != "true" ]]; then
|
||||
local R="%{$terminfo[sgr0]%}"
|
||||
local MAGENTA="%{$fg[magenta]%}"
|
||||
local YELLOW="%{$fg[yellow]%}"
|
||||
local GREEN="%{$fg[green]%}"
|
||||
local BLUE="%{$fg[blue]%}"
|
||||
local CYAN="%{$fg[cyan]%}"
|
||||
local RED="%{$fg[red]%}"
|
||||
fi
|
||||
|
||||
PROMPT='[$RED%n$R@$MAGENTA%m$R:$BLUE%~$R$GIT_PROMPT_INFO]
|
||||
%# '
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..$RED%? ↵$R)"
|
||||
RPROMPT='${return_code}$GIT_RPROMPT_INFO$R'
|
||||
|
||||
git_prompt_info ()
|
||||
{
|
||||
if [ -z "$(git_prompt__git_dir)" ]; then
|
||||
GIT_PROMPT_INFO=''
|
||||
GIT_RPROMPT_INFO=''
|
||||
return
|
||||
fi
|
||||
|
||||
local branch=''
|
||||
|
||||
git_prompt__branch
|
||||
branch="$GIT_PROMPT_BRANCH"
|
||||
|
||||
git_prompt__rebase_info
|
||||
branch="${branch}$GIT_PROMPT_REBASE_INFO"
|
||||
|
||||
GIT_PROMPT_INFO=" on $GREEN${branch}$R"
|
||||
|
||||
local rprompt=''
|
||||
git_prompt__dirty_state
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
|
||||
rprompt="$GREEN ✚"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$BLUE ✹"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$BLUE ✹"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$RED ✖"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$RED ✖"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$MAGENTA ➜"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$YELLOW ═"
|
||||
fi
|
||||
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
|
||||
rprompt="${rprompt}$CYAN ✭"
|
||||
fi
|
||||
GIT_RPROMPT_INFO=$rprompt
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue