summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2025-12-02 11:37:17 +0000
committerjao <jao@gnu.org>2025-12-07 13:51:45 +0000
commit4a8f924b4a8a87c593f307a9434e730a5c6c6432 (patch)
tree357dd3b6c0bfe7790b9f8af3ce8d6a60d5aef73d /init.el
parent8cc2a8d1b1ba8445c35ac3e02720a03fc04fd9b6 (diff)
downloadelibs-4a8f924b4a8a87c593f307a9434e730a5c6c6432.tar.gz
elibs-4a8f924b4a8a87c593f307a9434e730a5c6c6432.tar.bz2
eshell: abbreviated git branch names
Diffstat (limited to 'init.el')
-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)))))