From 1126f85c6cafd6dd2e503e54f1fd290776db1cdd Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Thu, 19 Jul 2018 13:49:26 +0200 Subject: [PATCH] [EShell] Trying to make the prompt look nicer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With inspiration from Howard Abrams’ Emacs configuration --- site-lisp/db-eshell.el | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/site-lisp/db-eshell.el b/site-lisp/db-eshell.el index 3d47e24..0f65982 100644 --- a/site-lisp/db-eshell.el +++ b/site-lisp/db-eshell.el @@ -45,15 +45,26 @@ (add-to-list 'eshell-command-completions-alist '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'")) -(setq eshell-prompt-function - (lambda () - (concat - "[" (user-login-name) - "@" (getenv "HOST") - ":" (abbreviate-file-name (eshell/pwd)) - "]\n→ ")) - eshell-prompt-regexp - "^→ ") +(defun eshell/default-prompt-function () + "A prompt for eshell of the form + + ┌[$USER@$HOST] [$PWD] + └── + +" + (let ((head-face '(:foreground "#859900"))) + (format (concat (propertize "┌" 'face head-face) + "[%s@%s] [%s]\n" + (propertize "└──" 'face head-face) + " ") + (user-login-name) + (system-name) + (propertize (abbreviate-file-name (eshell/pwd)) + 'face '(:foreground "#dc322f"))))) + +(setq eshell-prompt-function #'eshell/default-prompt-function + eshell-prompt-regexp "└── " + eshell-highlight-prompt nil) (add-hook 'eshell-mode-hook 'with-editor-export-editor)