From 62bde1e491e15db2b74f692d9a0ea7230f4f7e73 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 1 Nov 2025 12:56:35 -0500 Subject: feat:eshell: Add custom 'clear' function and set PAGER to 'cat' Set the environment variable PAGER to 'cat' to disable pagination in eshell. Remove existing alias for 'clear' and introduce a new custom 'eshell/clear' function that clears the eshell buffer. --- modules/eshell-vterm-config.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/eshell-vterm-config.el b/modules/eshell-vterm-config.el index a8a0cb6b..5799c7c3 100644 --- a/modules/eshell-vterm-config.el +++ b/modules/eshell-vterm-config.el @@ -47,6 +47,9 @@ (setq eshell-prefer-lisp-functions nil) (setq eshell-destroy-buffer-when-process-dies t) + ;; no pagers required + (setenv "PAGER" "cat") + (setq eshell-prompt-function (lambda () (concat @@ -54,7 +57,7 @@ " " (propertize (user-login-name) 'face '(:foreground "gray")) " " - (propertize (system-name) 'face '(:foreground "gray")) + (propertize (system-name) 'face '(:foreground "gray")) ":" (propertize (abbreviate-file-name (eshell/pwd)) 'face '(:foreground "gray")) "\n" @@ -81,7 +84,6 @@ (add-to-list 'eshell-visual-options '("git" "--help" "--paginate")) ;; aliases - (eshell/alias "clear" "clear 1") ;; leaves prompt at the top of the window (eshell/alias "e" "find-file $1") (eshell/alias "em" "find-file $1") (eshell/alias "emacs" "find-file $1") @@ -111,7 +113,13 @@ (find-file (car files)) ;; Multiple files (dolist (file files) - (find-file file)))) + (find-file file)))) + +(defun eshell/clear () + "Clear the eshell buffer." + (let ((inhibit-read-only t)) + (erase-buffer) + (eshell-send-input))) (defun eshell/find-using-dired (file-pattern) "Find a file FILE-PATTERN' using 'find-name-dired'." -- cgit v1.2.3