summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/init.el b/init.el
index 87c4f8b..6eb52a6 100644
--- a/init.el
+++ b/init.el
@@ -1458,7 +1458,13 @@
(format "%s%s" (match-string 1 desc) (jao-eshell--git-dirty))))))
(defun jao-eshell--git-current-branch (suffix)
- (let ((desc (or (jao-eshell--git-info) "")))
+ (let* ((descs (string-split (or (jao-eshell--git-info) "") "/"))
+ (desc (if (cdr descs)
+ (concat (mapconcat (lambda (s) (substring s 0 1))
+ (butlast descs)
+ "/")
+ "/" (car (last descs)))
+ (car descs))))
(cond ((and (string-empty-p desc) suffix) (format " (%s)" suffix))
((string-empty-p (or suffix "")) (format " (%s)" desc))
(t (format " (%s %s)" desc suffix)))))