diff options
| -rw-r--r-- | zsh/index.zsh | 6 | ||||
| -rw-r--r-- | zsh/prompt.zsh | 48 |
2 files changed, 35 insertions, 19 deletions
diff --git a/zsh/index.zsh b/zsh/index.zsh index f3cded4..80c2e37 100644 --- a/zsh/index.zsh +++ b/zsh/index.zsh @@ -13,6 +13,12 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' menu select # End lf lines added by compinstall +# cdr utility - see zshcontrib(1) +autoload -Uz chpwd_recent_dirs cdr add-zsh-hook +add-zsh-hook chpwd chpwd_recent_dirs +zstyle ':completion:*:*:cdr:*:*' menu selection + + source ~/.config/zsh/prompt.zsh source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 2ccbd69..4dcd4de 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -1,6 +1,4 @@ - # init prompts -# my fancy prompt autoload -Uz promptinit promptinit @@ -8,22 +6,23 @@ autoload -Uz vcs_info setopt PROMPT_SUBST -GIT_INFO="" - -zstyle ':vcs_info:git*' formats " %b %c%u%m%a" +GREY=0 +GREEN=2 +BLUE=4 +RED_UNSTAGED=88 +GREEN_STAGED=22 +# %b - branch +# %F{color} %f - foreground +# %K{color} %k - background +# %u - unstaged +# %c - staged +# %m - misc (cherry-pick and rebase for git) +# %a - action +zstyle ':vcs_info:git*' formats "%K{$BLUE} %b%u%c%m%a%k%F{$BLUE}%f" zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' check-for-changes true -zstyle ':vcs_info:*' stagedstr '%K{green} ✚ %k' -zstyle ':vcs_info:*' unstagedstr '%K{red} ● %k' - -PS_GIT_TAGS="" -PS_NODE="" - -PS_ERR="%0(?..%K{red}(%?%)%k)"; -PS_GIT='%K{blue}$vcs_info_msg_0_%k' -PS_USER='%K{blue}[%n@%M] %k' -PS_SSH='%K{green}${SSH_TTY:+ [%n@%M]}%k' -PS_DIR='%K{green} %3~ %k' +zstyle ':vcs_info:*' stagedstr "%F{$GREEN_STAGED} %f" +zstyle ':vcs_info:*' unstagedstr "%F{$RED_UNSTAGED} ?%f" get_pkg_manager() { if [[ -f yarn.lock ]]; then @@ -37,10 +36,21 @@ get_pkg_manager() { fi } -precmd() { +precmd() { vcs_info - PS_NODE="$(get_pkg_manager)" + ERR="%0(?..%F{red} %?%f)"; + GIT="$vcs_info_msg_0_" + # USER="%K{blue}[%n@%M] %k" + SSH="%K{$GREEN}${SSH_TTY:+ [%n@%M]}%k" + DIR="%K{$GREEN} %3~%k" + NODEJS="$(get_pkg_manager)" JOBS="%(1j.%F{magenta}%K{black} JOBS:%j%k%f.)" - PROMPT="%B${PS_ERR}${PS_SSH}${PS_DIR}${PS_GIT}${PS_NODE}${JOBS} %# %b" + NEWLINE=$'\n' + TIP="%F{$GREEN}%f" + + if [ -n "$vcs_info_msg_0_" ]; then + TIP="%K{$GREEN} %k" + fi + PROMPT="%K{$GREY} %* %k%B${SSH}${DIR}${TIP}${GIT}${ERR}${NODEJS}${JOBS}%b${NEWLINE} %# " } |
