]> git.sev.monster Git - dotfiles.git/commitdiff
zsh vcs: reformat; add hash, revert action, patch
authorsev <git@sev.monster>
Tue, 25 Jul 2023 07:43:09 +0000 (02:43 -0500)
committersev <git@sev.monster>
Fri, 5 Apr 2024 21:27:40 +0000 (16:27 -0500)
etc/zsh/functions/Prompts/prompt_arrows_setup

index 71004207b80e9a600c7312f4027c8f5b787fae70..f0bcfeada05a1d2010d73382e7ff302970022593 100644 (file)
@@ -75,8 +75,15 @@ function prompt_arrows_setup() {
     PROMPT="$PROMPT%(1j,%F{$c}%j,)$vicol%#%F{$p}%n%F{$n}@%F{$p}%2m%(?..%F{$n}/%F{$r}\$?)%F{$n}: "
     POSTEDIT="$(print -P "%F{$n}%f")"
     autoload -Uz vcs_info
-    zstyle ':vcs_info:git*' formats "%c%u%%F{$p}%r/%b%%F{$n}/%%F{$d}%S%%f"
-    zstyle ':vcs_info:git*' actionformats "%%F{$r}(%a)%f %c%u%%F{$p}%r/%b%f/%%F{$d}%S%f"
+    zstyle ':vcs_info:git*' get-revision true
+    local gitformat="%c%u%F{$p}%r%F{$n} %F{$c}%7.7i%F{$n}:%F{$p}%b%F{$n} %F{$d}%S%f"
+    zstyle ':vcs_info:git*' formats $gitformat
+    zstyle ':vcs_info:git*' get-unapplied true
+    local patchformat=' %n/%a'
+    zstyle ':vcs_info:git*' patch-format $patchformat
+    zstyle ':vcs_info:git*' nopatch-format $patchformat
+    zstyle ':vcs_info:git*+post-backend:*' hooks prompt_arrows_revertfix
+    zstyle ':vcs_info:git*' actionformats "%F{$r}(%a%m)%f $gitformat"
     zstyle ':vcs_info:git*' stagedstr   "%F{$c}+"
     zstyle ':vcs_info:git*' unstagedstr "%F{$r}!"
 
@@ -109,4 +116,8 @@ function prompt_arrows_preview {
   fi
 }
 
+function +vi-prompt_arrows_revertfix() {
+    [[ -f "$gitdir/REVERT_HEAD" ]] && hook_com[action]=revert
+}
+
 prompt_arrows_setup "$@"
This page took 0.034758 seconds and 4 git commands to generate.