diff --git a/init.el b/init.el index e0f1a06..2c4c877 100644 --- a/init.el +++ b/init.el @@ -914,14 +914,24 @@ If no name is given, list all bookmarks instead." (when branch-status (push branch-status status-arr)) (apply 'string status-arr))) + (defun my/-eshell-prompt-git-get-operation () + "Return the current git operation. For example, a revert." + (let ((git-dir (expand-file-name ".git" (vc-git-root default-directory)))) + (cond + ((file-exists-p (expand-file-name "REVERT_HEAD" git-dir)) + "REVERTING")))) (defun my/-eshell-prompt-git-status () "Get git status for `my/-eshell-prompt-function'" (let ((branch (car (vc-git-branches))) - (state (my/-eshell-prompt-git-state-chars))) + (state (my/-eshell-prompt-git-state-chars)) + (operation (my/-eshell-prompt-git-get-operation))) (concat (propertize (concat " 󰊢 " branch) 'face '(:foreground "medium purple")) (unless (string-empty-p state) - (propertize (concat " [" state "]") 'face '(:foreground "red")))))) + (propertize (concat " [" state "]") 'face '(:foreground "red"))) + (when operation + (concat " (" (propertize operation 'face + '(:weight 'bold :foreground "yellow")) ")"))))) (defun my/-eshell-prompt-vc-status () "Get vc status for `my/-eshell-prompt-function'." (if-let (backend (vc-responsible-backend default-directory t))