diff --git a/modules/prompt/functions/prompt_minimal_setup b/modules/prompt/functions/prompt_minimal_setup index 4cd791c..fc7bba1 100644 --- a/modules/prompt/functions/prompt_minimal_setup +++ b/modules/prompt/functions/prompt_minimal_setup @@ -7,7 +7,7 @@ # function +vi-git-status() { - # Untracked files. + # Check for untracked files or updated submodules since vcs_info does not. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then hook_com[unstaged]='%F{red}●%f' fi @@ -22,11 +22,14 @@ function prompt_minimal_setup { unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) + # Load required functions. autoload -Uz add-zsh-hook autoload -Uz vcs_info + # Add hook for calling vcs_info before each command. add-zsh-hook precmd prompt_minimal_precmd + # Set vcs_info parameters. zstyle ':vcs_info:*' enable bzr git hg svn zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' stagedstr '%F{green}●%f' @@ -36,6 +39,7 @@ function prompt_minimal_setup { zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b|%F{cyan}%r%f' zstyle ':vcs_info:git*+set-message:*' hooks git-status + # Define prompts. PROMPT='%2~${vcs_info_msg_0_} » ' } diff --git a/modules/prompt/functions/prompt_nicoulaj_setup b/modules/prompt/functions/prompt_nicoulaj_setup index 3b36c84..37f55a6 100644 --- a/modules/prompt/functions/prompt_nicoulaj_setup +++ b/modules/prompt/functions/prompt_nicoulaj_setup @@ -25,7 +25,7 @@ function prompt_nicoulaj_setup { unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) - # Load required modules. + # Load required functions. autoload -Uz add-zsh-hook autoload -Uz vcs_info @@ -42,7 +42,7 @@ function prompt_nicoulaj_setup { # Set vcs_info parameters. zstyle ':vcs_info:*' enable bzr git hg svn - zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. + zstyle ':vcs_info:*:*' check-for-changes true zstyle ':vcs_info:*:*' unstagedstr '!' zstyle ':vcs_info:*:*' stagedstr '+' zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 152b708..d1db67c 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -1,5 +1,5 @@ # -# A simple theme that only shows relevant information. +# A simple theme that displays relevant, contextual information. # # Authors: # Sorin Ionescu @@ -22,7 +22,10 @@ function prompt_sorin_setup { unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) + # Load required functions. autoload -Uz add-zsh-hook + + # Add hook for calling git-info before each command. add-zsh-hook precmd prompt_sorin_precmd zstyle ':omz:module:editor' completing '%B%F{red}...%f%b' @@ -45,6 +48,7 @@ function prompt_sorin_setup { 'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \ 'rprompt' '%A%B%S%a%d%m%r%U%u' + # Define prompts. PROMPT='%F{cyan}%1~%f${git_info:+${(e)git_info[prompt]}} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' RPROMPT='${editor_info[keymap]}${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '