summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-01 12:56:35 -0500
committerCraig Jennings <c@cjennings.net>2025-11-01 12:56:35 -0500
commit62bde1e491e15db2b74f692d9a0ea7230f4f7e73 (patch)
tree82b11185fa3fcbcef7a4f02fd3a07d94981dbcf6 /modules
parent0a87ce119751a64fcd113b5f1fbcd7946d192145 (diff)
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.
Diffstat (limited to 'modules')
-rw-r--r--modules/eshell-vterm-config.el14
1 files changed, 11 insertions, 3 deletions
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'."