summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs/custom/fcuny-eshell.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/emacs/custom/fcuny-eshell.el b/emacs/custom/fcuny-eshell.el
index 38d67da..c5523ce 100644
--- a/emacs/custom/fcuny-eshell.el
+++ b/emacs/custom/fcuny-eshell.el
@@ -76,10 +76,14 @@ length of PATH (sans directory slashes) down to MAX-LEN."
     (concat str (cl-reduce (lambda (a b) (concat a "/" b)) components))))
 
 (defun fcuny/eshell-prompt ()
-  (setq eshell-prompt-regexp "; ")
+  "Sets the prompt for eshell. If the current path is on a remote
+host and starts with `ssh:', then we replace the prompt with
+`@<hostname>' to indicate we're on a remote host."
   (concat
-   (concat (system-name) ":")
-   (fcuny/shorten-path (eshell/pwd))
+   (let ((absolute-path (eshell/pwd)))
+     (if (string-match "/ssh:\\(.+\\):" absolute-path)
+         (replace-match (concat "@" (match-string 1 absolute-path) " ")  nil nil absolute-path)
+     (fcuny/shorten-path absolute-path)))
    "; "))
 
 (defun fcuny/eshell-here ()