eshell-prompt.org 2.2 KB

Example configuration

(defun set-eshell-prompt-function () (setq eshell-prompt-function (function (lambda () (concat (propertize (format-time-string "%H:%M:%S" (current-time)) 'face `(:foreground "#A0A0A0")) "::" (propertize (user-login-name) 'face `(:foreground "#FF9080")) "@" (propertize (let ((sys-name (system-name))) (let ((sys-name-len (length sys-name))) (if (> sys-name-len 8) (concat (substring sys-name 0 8) "...") sys-name))) 'face `(:foreground "#FF9080")) "::" (propertize (shorten-filename (eshell/pwd) 36) 'face `(:foreground "#FF9080")) "::" (propertize (concat "(" (if-let ((status eshell-last-command-status)) (if (= status 0) "0" (format "%s" status))) ")") 'face `(:foreground "#FF9080")) (if (= (user-uid) 0) "# " "$ "))))) (setq eshell-highlight-prompt t) ;; The prompt is: ;; + anything except '#', '$', and '\n' an arbitrary number of times followed by ;; + '#' or '$' followed by ;; + ' '. (setq eshell-prompt-regexp "^[^#$\n]*[#$] "))

;; Actually make use of the defined procedure. (set-eshell-prompt-function)