Restyle git branch information in eshell prompt
Just an idea.
This commit is contained in:
parent
925a55de1e
commit
c174080d4a
|
@ -74,12 +74,12 @@ git repository."
|
||||||
(let* ((git-branch (string-trim
|
(let* ((git-branch (string-trim
|
||||||
(shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
|
(shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
|
||||||
(base-dir (file-name-base (string-trim-right repo-dir "/?"))))
|
(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 ()
|
(defun eshell/default-prompt-function ()
|
||||||
"A prompt for eshell of the form
|
"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
|
Information about the current git branch will be empty when the
|
||||||
|
@ -95,7 +95,7 @@ formatting."
|
||||||
(propertize (abbreviate-file-name (eshell/pwd))
|
(propertize (abbreviate-file-name (eshell/pwd))
|
||||||
'face '(:foreground "#dc322f"))
|
'face '(:foreground "#dc322f"))
|
||||||
(when-let ((git-branch (db/eshell-git-branch-string)))
|
(when-let ((git-branch (db/eshell-git-branch-string)))
|
||||||
(format " (%s)" git-branch))
|
(format " (git:%s)" git-branch))
|
||||||
"\n"
|
"\n"
|
||||||
(propertize "└─" 'face head-face)
|
(propertize "└─" 'face head-face)
|
||||||
(if (zerop (user-uid)) "#" "$")
|
(if (zerop (user-uid)) "#" "$")
|
||||||
|
|
Loading…
Reference in New Issue