summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/eshell.el
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2023-02-04 14:33:12 -0500
committerKjetil Orbekk <kj@orbekk.com>2023-02-04 14:33:12 -0500
commit9eef6a43320aaca4fb6640ef20b1206614312a94 (patch)
tree0a67aa16fb8d53a5cf50637053906b288c93e6e1 /emacs/.config/emacs-kj/eshell.el
parent708b47b62ddcb6b205b69b388974c620b5dd730b (diff)
update
Diffstat (limited to 'emacs/.config/emacs-kj/eshell.el')
-rw-r--r--emacs/.config/emacs-kj/eshell.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/emacs/.config/emacs-kj/eshell.el b/emacs/.config/emacs-kj/eshell.el
new file mode 100644
index 0000000..b475915
--- /dev/null
+++ b/emacs/.config/emacs-kj/eshell.el
@@ -0,0 +1,23 @@
+;;; -*- lexical-binding: t; -*-
+(use-package eshell
+ :config
+ (add-hook 'eshell-mode-hook
+ (lambda ()
+ (setenv "PAGER" "cat"))
+ (setenv "EDITOR" "emacsclient"))
+ (setq eshell-prefer-lisp-functions t)
+ (setq tramp-remote-path '(tramp-own-remote-path))
+
+ (add-to-list 'eshell-load-hook #'kj/on-eshell-load))
+
+(defun kj/on-eshell-load (&args rest)
+ (add-to-list 'eshell-complex-commands "ssh"))
+
+(defun eshell/ssh (&rest args)
+ (if (= 1 (length args))
+ (throw 'eshell-replace-command
+ (eshell/cd
+ (format "/ssh:%s:" (car args))))
+ (throw 'eshell-replace-command
+ (eshell-parse-command "*ssh"
+ (eshell-stringify-list (flatten-tree args))))))