Eshell: Don't follow symlink in prompt
parent
79a917bc84
commit
5c1f06192f
|
@ -125,12 +125,19 @@
|
|||
(propertize (user-login-name) 'face '(:foreground "cyan"))
|
||||
(propertize (system-name) 'face '(:foreground "cyan")))
|
||||
(if (and (require 'magit nil t) (or (magit-get-current-branch) (magit-get-current-tag)))
|
||||
(let* ((prefix (abbreviate-file-name (magit-rev-parse "--show-prefix")))
|
||||
(before-prefix (substring-no-properties path nil (when (/= 0 (length prefix)) (- (length prefix))))))
|
||||
;; We need "--show-prefix and not "--top-level" when we don't follow symlinks.
|
||||
(let* ((git-file-path (abbreviate-file-name (magit-rev-parse "--show-prefix")))
|
||||
prefix)
|
||||
(let ((common-folder (car (split-string git-file-path "/"))))
|
||||
(setq prefix (mapconcat 'identity (seq-take-while
|
||||
(lambda (s) (not (string= s common-folder)))
|
||||
(split-string path "/"))
|
||||
"/")))
|
||||
(format
|
||||
(propertize "[%s/%s@%s]" 'face '(:weight bold))
|
||||
(propertize before-prefix 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))
|
||||
(propertize prefix 'face `(:foreground ,(if (= (user-uid) 0) "orange" "gold")))
|
||||
(propertize prefix 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))
|
||||
(propertize (substring-no-properties path (min (length path) (1+ (length prefix))))
|
||||
'face `(:foreground ,(if (= (user-uid) 0) "orange" "gold")))
|
||||
(or (magit-get-current-branch) (magit-get-current-tag))))
|
||||
(format
|
||||
(propertize "[%s]" 'face '(:weight bold))
|
||||
|
|
Loading…
Reference in New Issue