Skip to content

Commit 153c1e6

Browse files
committed
feat(comint): add +comint-clear-buffer, bind it to C-l
1 parent c892be9 commit 153c1e6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/me-builtin.el

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,20 @@ or file path may exist now."
638638

639639
(use-package comint
640640
:hook (comint-mode . minemacs-reduced-font-size)
641+
:commands (+comint-clear-buffer)
642+
:bind (:map comint-mode-map ("C-l" . +comint-clear-buffer))
641643
:custom
642644
(comint-scroll-to-bottom-on-input 'this) ; Move to bottom on input in the current window
643645
(comint-scroll-to-bottom-on-output 'this) ; Move to bottom on output in the current window
644646
(comint-buffer-maximum-size (* 64 1024)) ; Increase the maximum buffer size (def. 1024)
645-
(comint-input-ring-size 5000)) ; Increase the size of the input history ring (def. 500)
647+
(comint-input-ring-size 5000) ; Increase the size of the input history ring (def. 500)
648+
:config
649+
(defun +comint-clear-buffer ()
650+
"Clears the current comint buffer, removing all its content."
651+
(interactive)
652+
(when (derived-mode-p 'comint-mode)
653+
(let ((comint-buffer-maximum-size 0))
654+
(comint-truncate-buffer)))))
646655

647656
(use-package compile
648657
:hook (compilation-filter . ansi-color-compilation-filter) ; Enable ANSI colors in compilation buffer

0 commit comments

Comments
 (0)