From: Amin Bandali Date: Mon, 23 Sep 2019 00:47:35 +0000 (-0400) Subject: emacs: update eshell prompt to match new bash prompt X-Git-Url: https://git.shemshak.org/~bandali/configs/commitdiff_plain/92bbb7aab082f4a6c2aacfcb3995c21466a95835?ds=inline;hp=fc3402997ba7c66fd8aa09fcf0c0b4225c6b7432 emacs: update eshell prompt to match new bash prompt --- diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 1f31d3b..422930e 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1750,16 +1750,17 @@ This function is intended for use with `ivy-ignore-buffers'." :defer 0.5 :after eshell :config - (defvar user-@-host (concat (user-login-name) "@" (system-name) " ")) + (defvar user-@-host (concat (user-login-name) "@" (system-name) ":")) (defun +eshell/prompt () - (let ((base/dir (shrink-path-prompt default-directory))) - (concat (propertize user-@-host 'face 'default) - (propertize (car base/dir) - 'face 'font-lock-comment-face) - (propertize (cdr base/dir) - 'face 'font-lock-constant-face) - (propertize "> " 'face 'default)))) - (setq eshell-prompt-regexp (concat user-@-host ".*> ") + (concat (propertize user-@-host '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))) + (setq eshell-prompt-regexp "\\(.*\n\\)*[$#] " eshell-prompt-function #'+eshell/prompt)) (use-package eshell-up