dotfiles/zsh/.config/zsh/prompt.zsh
2022-12-19 23:00:58 -08:00

45 lines
1.1 KiB
Bash

# allows substitution in the prompt
setopt PROMPT_SUBST
# ========== VCS info ==========
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
#zstyle ':vcs_info:git*' formats "%{$fg[grey]%} %{$fg[blue]%}%b%{$reset_color%}%m %u %c%{$reset_color%}"
zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%{$fg[blue]%}%b%{$reset_color%}%m %u %c%{$reset_color%}"
# ========== Vim Command Mode ==========
vim_ins_mode='ins'
vim_cmd_mode='cmd'
vim_mode=${vim_ins_mode}
zle-keymap-select() {
vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
zle reset-prompt
}
zle -N zle-keymap-select
zle-line-finish() {
vim_mode=${vim_ins_mode}
}
zle -N zle-line-finish
# ========== Final Prompt ==========
precmd() {
vcs_info
}
# ----- Left Prompts -----
# <user>@<host> >
#PS1='%F{blue}%n%f@%m %F{green}%3~%f > '
# <path> >
#PS1='%F{green}%3~%f %F{blue}>%f '
# <path> <host> >
PS1='%F{green}%3~%f %F{yellow}%m%f %F{blue}>%f '
# ----- Right Prompts -----
# Git and vim mode info
#RPS1='%F{green}${vim_mode}%f ${vcs_info_msg_0_} [%F{red}%?%f]'
# Git info only
RPS1='${vcs_info_msg_0_} [%F{red}%?%f]'