term/eshell: optimize branch display in prompt #1882
This commit is contained in:
parent
2485cac2e0
commit
3e947d39b5
1 changed files with 4 additions and 5 deletions
|
@ -12,11 +12,10 @@
|
||||||
|
|
||||||
|
|
||||||
(defun +eshell--current-git-branch ()
|
(defun +eshell--current-git-branch ()
|
||||||
(let ((branch (car (cl-loop for match in (split-string (shell-command-to-string "git branch") "\n")
|
(cl-destructuring-bind (status . output)
|
||||||
if (string-match-p "^\*" match)
|
(doom-call-process "git" "name-rev" "--name-only" "HEAD")
|
||||||
collect match))))
|
(if (equal status 0)
|
||||||
(if (not (eq branch nil))
|
(format " [%s]" output)
|
||||||
(format " [%s]" (substring branch 2))
|
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue