Skip to content

Instantly share code, notes, and snippets.

@sluger
Forked from chrisnolet/.zshrc
Created March 21, 2023 10:18
Show Gist options
  • Save sluger/950a9d8d5864235be46cd55886ba99f9 to your computer and use it in GitHub Desktop.
Save sluger/950a9d8d5864235be46cd55886ba99f9 to your computer and use it in GitHub Desktop.

Revisions

  1. @chrisnolet chrisnolet revised this gist Oct 10, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,9 @@ autoload -Uz vcs_info
    add-zsh-hook precmd vcs_info

    zstyle ':vcs_info:*' enable git
    zstyle ':vcs_info:*' formats " %F{green}%c%u(%b)%f"
    zstyle ':vcs_info:*' actionformats " %F{green}%c%u(%b)%f %a"
    zstyle ':vcs_info:*' stagedstr "%F{red}"
    zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f"
    zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a"
    zstyle ':vcs_info:*' stagedstr "%F{green}"
    zstyle ':vcs_info:*' unstagedstr "%F{red}"
    zstyle ':vcs_info:*' check-for-changes true

  2. @chrisnolet chrisnolet created this gist Jan 12, 2022.
    23 changes: 23 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    autoload -Uz compinit && compinit
    autoload -Uz add-zsh-hook
    autoload -Uz vcs_info

    add-zsh-hook precmd vcs_info

    zstyle ':vcs_info:*' enable git
    zstyle ':vcs_info:*' formats " %F{green}%c%u(%b)%f"
    zstyle ':vcs_info:*' actionformats " %F{green}%c%u(%b)%f %a"
    zstyle ':vcs_info:*' stagedstr "%F{red}"
    zstyle ':vcs_info:*' unstagedstr "%F{red}"
    zstyle ':vcs_info:*' check-for-changes true

    zstyle ':vcs_info:git*+set-message:*' hooks git-untracked

    +vi-git-untracked() {
    if git --no-optional-locks status --porcelain 2> /dev/null | grep -q "^??"; then
    hook_com[staged]+="%F{red}"
    fi
    }

    setopt PROMPT_SUBST
    export PROMPT='%n:%1~$vcs_info_msg_0_ %# '