diff options
author | Kenny Ballou <kb@devnulllabs.io> | 2021-04-03 22:26:38 -0600 |
---|---|---|
committer | Kenny Ballou <kb@devnulllabs.io> | 2021-04-03 22:26:38 -0600 |
commit | a6aba925b70c6e2e21b5bed9e2475de1dcaf30b1 (patch) | |
tree | b429e17cbf85f2ef05d2758e3cdb9f454207d69e /config/emacs/emacs.d | |
parent | ffeb9f2417a6612b3197e7ee5ec92ff884ac0571 (diff) | |
download | dotfiles-a6aba925b70c6e2e21b5bed9e2475de1dcaf30b1.tar.gz dotfiles-a6aba925b70c6e2e21b5bed9e2475de1dcaf30b1.tar.xz |
emacs: eshell: print remote hostname in eshell
When running remote eshell sessions, use `hostname` to properly display
the remote hostname in the prompt.
Signed-off-by: Kenny Ballou <kb@devnulllabs.io>
Diffstat (limited to 'config/emacs/emacs.d')
-rw-r--r-- | config/emacs/emacs.d/lisp/init-eshell.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/config/emacs/emacs.d/lisp/init-eshell.el b/config/emacs/emacs.d/lisp/init-eshell.el index 38d7709a..5c5873e1 100644 --- a/config/emacs/emacs.d/lisp/init-eshell.el +++ b/config/emacs/emacs.d/lisp/init-eshell.el @@ -57,6 +57,14 @@ "Add face properties to STR using PROPERTIES list." `(propertize ,str 'face (list ,@properties))) +(defun kb/system-name () + "Return the current system name. + +Includes remote system names" + (replace-regexp-in-string "\n$" + "" + (shell-command-to-string "hostname"))) + (defun shortened-path (path max-len) "Return a modified version of PATH up to MAX-LEN. Replace some components with single characters starting from the @@ -95,7 +103,7 @@ left to try and get the PATH down to, at most, MAX-LEN." branch))) (concat "(@" - (system-name) + (kb/system-name) ")(" (shortened-path (eshell/pwd) 20) ")" |