Restyle git branch information in eshell prompt

Just an idea.
This commit is contained in:
Daniel - 2022-08-27 16:38:55 +02:00
parent 925a55de1e
commit c174080d4a
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 3 additions and 3 deletions

View File

@ -74,12 +74,12 @@ git repository."
(let* ((git-branch (string-trim
(shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
(base-dir (file-name-base (string-trim-right repo-dir "/?"))))
(format "%s::%s" base-dir git-branch))))))
(format "%s@%s" git-branch base-dir))))))
(defun eshell/default-prompt-function ()
"A prompt for eshell of the form
[$USER@$HOST] [$PWD] (current-git-branch)
$USER@$HOST $PWD (current-git-branch)
Information about the current git branch will be empty when the
@ -95,7 +95,7 @@ formatting."
(propertize (abbreviate-file-name (eshell/pwd))
'face '(:foreground "#dc322f"))
(when-let ((git-branch (db/eshell-git-branch-string)))
(format " (%s)" git-branch))
(format " (git:%s)" git-branch))
"\n"
(propertize "└─" 'face head-face)
(if (zerop (user-uid)) "#" "$")