diff --git a/init.zsh b/init.zsh index f6573e3..e500d96 100644 --- a/init.zsh +++ b/init.zsh @@ -139,7 +139,7 @@ SPACESHIP_PACKAGE_SYMBOL=" " autoload -U promptinit && promptinit prompt spaceship # Change cursor shape for different vi modes. -function zle-line-init zle-keymap-select { +function __zsh_vim_key_prompt_handler { SPACESHIP_CHAR_SYMBOL="❮" local _shape=0 case "${KEYMAP}" in @@ -157,9 +157,37 @@ function zle-line-init zle-keymap-select { zle reset-prompt printf '\e[%d q' "${_shape}" } +function __zsh_check_disabled_git_prompt_dirs { + local excluded=false + for file in ${(s:\0:)__ZSH_PROMPT_EXCLUDE_GIT_STATUS}; do + if [[ "${PWD:P}/" = "${file}/"* ]]; then + SPACESHIP_GIT_STATUS_SHOW=false + excluded=true + break + fi + done + if ! $excluded; then + SPACESHIP_GIT_STATUS_SHOW=true + fi +} +function chpwd { + __zsh_check_disabled_git_prompt_dirs +} +function zle-line-init { + __zsh_vim_key_prompt_handler +} +function zle-keymap-select { + __zsh_vim_key_prompt_handler +} zle -N zle-keymap-select zle -N zle-line-init +# Exclude DIR from spaceship's git status module +# prompt_exclude_git_status