feat: move zsh prompt to its own file
also tweak it a bit -> $ is colored depending on last command exit code -> git infos polished
This commit is contained in:
parent
5a8d91d346
commit
60aea94875
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Enable colors and change prompt:
|
# Enable colors and change prompt:
|
||||||
autoload -U colors && colors
|
autoload -U colors && colors
|
||||||
PS1="[ %B%{$fg[magenta]%}%(4~|%-1~/.../%2~|%~)%}%{$reset_color%} ] $%b "
|
source $XDG_CONFIG_HOME/zsh/zsh_prompt
|
||||||
|
|
||||||
# Home/End/Insert/Del keys
|
# Home/End/Insert/Del keys
|
||||||
bindkey '^[[P' delete-char # Delete
|
bindkey '^[[P' delete-char # Delete
|
||||||
@ -12,18 +12,6 @@ bindkey '^[[4~' end-of-line # End
|
|||||||
bindkey '^[[5~' up-line-or-history # PageUp
|
bindkey '^[[5~' up-line-or-history # PageUp
|
||||||
bindkey '^[[6~' down-line-or-history # PageDown
|
bindkey '^[[6~' down-line-or-history # PageDown
|
||||||
|
|
||||||
# Git infos on the right
|
|
||||||
autoload -Uz vcs_info
|
|
||||||
precmd_vcs_info() { vcs_info }
|
|
||||||
precmd_functions+=( precmd_vcs_info )
|
|
||||||
setopt prompt_subst
|
|
||||||
RPROMPT=\$vcs_info_msg_0_
|
|
||||||
zstyle ':vcs_info:git:*' check-for-changes true
|
|
||||||
zstyle ':vcs_info:git:*' stagedstr '*'
|
|
||||||
zstyle ':vcs_info:git:*' unstagedstr '!'
|
|
||||||
zstyle ':vcs_info:git:*' formats '%F{214}%r%f %F{208}(%b): %c/%u'
|
|
||||||
zstyle ':vcs_info:*' enable git
|
|
||||||
|
|
||||||
# History in cache directory:
|
# History in cache directory:
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
|
13
.config/zsh/zsh_prompt
Normal file
13
.config/zsh/zsh_prompt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Git infos on the right
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
precmd_vcs_info() { vcs_info }
|
||||||
|
precmd_functions+=( precmd_vcs_info )
|
||||||
|
setopt prompt_subst
|
||||||
|
zstyle ':vcs_info:git:*' check-for-changes true
|
||||||
|
zstyle ':vcs_info:git:*' stagedstr '*'
|
||||||
|
zstyle ':vcs_info:git:*' unstagedstr '!'
|
||||||
|
zstyle ':vcs_info:git:*' formats '(%F{208}%b%F{015}: %c/%u%F{015}) '
|
||||||
|
zstyle ':vcs_info:*' enable git
|
||||||
|
|
||||||
|
PROMPT="[ %B%{$fg[magenta]%}%(4~|%-1~/.../%2~|%~)%}%{$reset_color%} ] \
|
||||||
|
\$vcs_info_msg_0_%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})$%{$reset_color%}%b "
|
Reference in New Issue
Block a user