From 46d6e13705912697af373db1259fc7c773742ec2 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 24 Feb 2024 13:03:04 -0500 Subject: Adapt eshell prompt to match my bash prompt --- .emacs.d/lisp/bandali-eshell.el | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to '.emacs.d/lisp') diff --git a/.emacs.d/lisp/bandali-eshell.el b/.emacs.d/lisp/bandali-eshell.el index 66e7808..7bf3b4f 100644 --- a/.emacs.d/lisp/bandali-eshell.el +++ b/.emacs.d/lisp/bandali-eshell.el @@ -31,19 +31,30 @@ eshell-directory-name (b/var "eshell/") eshell-hist-ignoredups t eshell-input-filter #'eshell-input-filter-initial-space - eshell-prompt-regexp "\\(.*\n\\)*[$#] " + ;; eshell-prompt-regexp "\\(.*\n\\)*[$#] " + ;; eshell-prompt-function + ;; (lambda () + ;; (concat + ;; (propertize (format "%s@%s:" (user-login-name) (system-name)) + ;; 'face 'default) + ;; (propertize (abbreviate-file-name default-directory) + ;; 'face 'font-lock-comment-face) + ;; (propertize "\n" 'face 'default) + ;; (if (= (user-uid) 0) + ;; (propertize "#" 'face 'red) + ;; (propertize "$" 'face 'default)) + ;; (propertize " " 'face 'default))) + eshell-prompt-regexp "^[^#$\n]* [#$] ; " eshell-prompt-function (lambda () - (concat - (propertize (format "%s@%s:" (user-login-name) (system-name)) - 'face 'default) - (propertize (abbreviate-file-name default-directory) - 'face 'font-lock-comment-face) - (propertize "\n" 'face 'default) - (if (= (user-uid) 0) - (propertize "#" 'face 'red) - (propertize "$" 'face 'default)) - (propertize " " 'face 'default)))) + (concat ": " + (system-name) + ":" + (abbreviate-file-name (eshell/pwd)) + (unless (eshell-exit-success-p) + (format " [%d]" eshell-last-command-status)) + (if (= (file-user-uid) 0) " # " " $ ") + "; "))) (eval-when-compile (defvar eshell-prompt-regexp) (declare-function eshell-life-is-too-much "esh-mode") -- cgit v1.2.3-60-g2f50