add zsh and kubectl prompts to agnoster prompt

This commit is contained in:
Ghasem Shirazi 2021-04-14 14:10:59 -07:00
commit 7bafb5e1d4
2 changed files with 15 additions and 4 deletions

View file

@ -73,10 +73,7 @@ DISABLE_UNTRACKED_FILES_DIRTY="false"
#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)
# 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
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' prompt 'e%e'

View file

@ -107,6 +107,14 @@ prompt_git() {
#PL_BRANCH_CHAR=$'\ue0a0' # 
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
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:*' actionformats ' %u%c'
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
}
prompt_kubectl() {
prompt_segment magenta blue
echo -n ${ZSH_KUBECTL_PROMPT}
}
prompt_bzr() {
(( $+commands[bzr] )) || return
@ -262,6 +275,7 @@ build_prompt() {
prompt_context
prompt_dir
prompt_git
prompt_kubectl
prompt_bzr
prompt_hg
prompt_end