Add a rebase indicator for eshell

This commit is contained in:
Alexander Rosenberg 2024-01-09 15:16:54 -08:00
parent e03cfe1b73
commit a474ebf152
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

13
init.el
View File

@ -840,11 +840,16 @@ Take directly from doom-modeline."
("trm" "trash-rm $*")
("rm" "echo 'rm: I''m unsafe! Don''t use me.'; false")
("\\rm" "eshell/rm")))
(defvar my/eshell-bm-auto-ls t
"Weather or not to run ls after `eshell/bm'")
(defun eshell/bm (&optional name)
"Change to directory of bookmark NAME.
If no name is given, list all bookmarks instead."
(if name
(eshell/cd (bookmark-get-filename name))
(progn
(eshell/cd (bookmark-get-filename name))
(when my/eshell-bm-auto-ls
(eshell/ls)))
(eshell-print (string-join (bookmark-all-names) " "))))
(defun my/-replace-home-with-tilda (path)
(let ((home (getenv "HOME")))
@ -930,7 +935,9 @@ If no name is given, list all bookmarks instead."
(let ((git-dir (expand-file-name ".git" (vc-git-root default-directory))))
(cond
((file-exists-p (expand-file-name "REVERT_HEAD" git-dir))
"REVERTING"))))
"REVERTING")
((file-exists-p (expand-file-name "rebase-merge" git-dir))
"REBASING"))))
(defun my/-eshell-prompt-git-status ()
"Get git status for `my/-eshell-prompt-function'"
(let ((branch (car (vc-git-branches)))
@ -942,7 +949,7 @@ If no name is given, list all bookmarks instead."
(propertize (concat " [" state "]") 'face '(:foreground "red")))
(when operation
(concat " (" (propertize operation 'face
'(:weight 'bold :foreground "yellow")) ")")))))
'(:inherit '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))