Eshell: Fix prompt fontification of symlinks inside Git repositories
parent
3e45f23179
commit
479ae9adab
|
@ -115,30 +115,31 @@
|
||||||
eshell-hist-ignoredups t
|
eshell-hist-ignoredups t
|
||||||
eshell-destroy-buffer-when-process-dies t)
|
eshell-destroy-buffer-when-process-dies t)
|
||||||
|
|
||||||
;;; Leave `eshell-highlight-prompt' to t as it sets the read-only property.
|
(defun ambrevar/eshell-prompt ()
|
||||||
(setq eshell-prompt-function
|
(let ((path (abbreviate-file-name (eshell/pwd))))
|
||||||
(lambda nil
|
(concat
|
||||||
(let ((path (abbreviate-file-name (eshell/pwd))))
|
(when ambrevar/eshell-status-p
|
||||||
(concat
|
(propertize (or (ambrevar/eshell-status-display) "") 'face font-lock-comment-face))
|
||||||
(when ambrevar/eshell-status-p
|
(format
|
||||||
(propertize (or (ambrevar/eshell-status-display) "") 'face font-lock-comment-face))
|
(propertize "(%s@%s)" 'face '(:weight bold))
|
||||||
|
(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))))))
|
||||||
(format
|
(format
|
||||||
(propertize "(%s@%s)" 'face '(:weight bold))
|
(propertize "[%s/%s@%s]" 'face '(:weight bold))
|
||||||
(propertize (user-login-name) 'face '(:foreground "cyan"))
|
(propertize before-prefix 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))
|
||||||
(propertize (system-name) 'face '(:foreground "cyan")))
|
(propertize prefix 'face `(:foreground ,(if (= (user-uid) 0) "orange" "gold")))
|
||||||
(if (and (require 'magit nil t) (or (magit-get-current-branch) (magit-get-current-tag)))
|
(or (magit-get-current-branch) (magit-get-current-tag))))
|
||||||
(let* ((root (abbreviate-file-name (magit-rev-parse "--show-toplevel")))
|
(format
|
||||||
(after-root (substring-no-properties path (min (length path) (1+ (length root))))))
|
(propertize "[%s]" 'face '(:weight bold))
|
||||||
(format
|
(propertize path 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))))
|
||||||
(propertize "[%s/%s@%s]" 'face '(:weight bold))
|
(propertize "\n>" 'face '(:weight bold))
|
||||||
(propertize root 'face `(:foreground ,(if (= (user-uid) 0) "orange" "gold")))
|
" ")))
|
||||||
(propertize after-root 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))
|
|
||||||
(or (magit-get-current-branch) (magit-get-current-tag))))
|
;;; Leave `eshell-highlight-prompt' to t as it sets the read-only property.
|
||||||
(format
|
(setq eshell-prompt-function #'ambrevar/eshell-prompt)
|
||||||
(propertize "[%s]" 'face '(:weight bold))
|
|
||||||
(propertize path 'face `(:foreground ,(if (= (user-uid) 0) "red" "green") :weight bold))))
|
|
||||||
(propertize "\n>" 'face '(:weight bold))
|
|
||||||
" "))))
|
|
||||||
;;; If the prompt spans over multiple lines, the regexp should match
|
;;; If the prompt spans over multiple lines, the regexp should match
|
||||||
;;; last line only.
|
;;; last line only.
|
||||||
(setq-default eshell-prompt-regexp "^> ")
|
(setq-default eshell-prompt-regexp "^> ")
|
||||||
|
|
Loading…
Reference in New Issue