mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
add zsh and kubectl prompts to agnoster prompt
This commit is contained in:
parent
f1e69071c7
commit
7bafb5e1d4
2 changed files with 15 additions and 4 deletions
|
|
@ -73,10 +73,7 @@ DISABLE_UNTRACKED_FILES_DIRTY="false"
|
||||||
#plugins=(git zsh-git-prompt zsh-completions fasd systemd zsh-syntax-highlighting)
|
#plugins=(git zsh-git-prompt zsh-completions fasd systemd zsh-syntax-highlighting)
|
||||||
plugins=(git git-extras docker docker-compose docker-machine helm fast-syntax-highlighting zsh-git-prompt)
|
plugins=(git git-extras docker docker-compose docker-machine helm fast-syntax-highlighting zsh-git-prompt)
|
||||||
|
|
||||||
# build up the prompt from the theme and *-prompt plugins:
|
|
||||||
PROMPT="${PROMPT} ZSH_GIT_PROMPT ZSH_KUBECTL_PROMPT"
|
|
||||||
# The following lines were added by compinstall
|
# The following lines were added by compinstall
|
||||||
|
|
||||||
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
|
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
|
||||||
zstyle ':completion:*' max-errors 3
|
zstyle ':completion:*' max-errors 3
|
||||||
zstyle ':completion:*' prompt 'e%e'
|
zstyle ':completion:*' prompt 'e%e'
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,14 @@ prompt_git() {
|
||||||
#PL_BRANCH_CHAR=$'\ue0a0' #
|
#PL_BRANCH_CHAR=$'\ue0a0' #
|
||||||
PL_BRANCH_CHAR=$'\u2693' # anchor
|
PL_BRANCH_CHAR=$'\u2693' # anchor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ ! -z "${ZSH_GIT_PROMPT}" ]]; then
|
||||||
|
# just use zsh-git-prompt with our segment coloring
|
||||||
|
prompt_segment yellow red
|
||||||
|
echo -n ${PL_BRANCH_CHAR} ${ZSH_GIT_PROMPT}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
local ref dirty mode repo_path
|
local ref dirty mode repo_path
|
||||||
|
|
||||||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||||
|
|
@ -138,11 +146,16 @@ prompt_git() {
|
||||||
zstyle ':vcs_info:*' formats ' %u%c'
|
zstyle ':vcs_info:*' formats ' %u%c'
|
||||||
zstyle ':vcs_info:*' actionformats ' %u%c'
|
zstyle ':vcs_info:*' actionformats ' %u%c'
|
||||||
vcs_info
|
vcs_info
|
||||||
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
|
||||||
|
|
||||||
|
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_kubectl() {
|
||||||
|
prompt_segment magenta blue
|
||||||
|
echo -n ${ZSH_KUBECTL_PROMPT}
|
||||||
|
}
|
||||||
|
|
||||||
prompt_bzr() {
|
prompt_bzr() {
|
||||||
(( $+commands[bzr] )) || return
|
(( $+commands[bzr] )) || return
|
||||||
|
|
||||||
|
|
@ -262,6 +275,7 @@ build_prompt() {
|
||||||
prompt_context
|
prompt_context
|
||||||
prompt_dir
|
prompt_dir
|
||||||
prompt_git
|
prompt_git
|
||||||
|
prompt_kubectl
|
||||||
prompt_bzr
|
prompt_bzr
|
||||||
prompt_hg
|
prompt_hg
|
||||||
prompt_end
|
prompt_end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue