summaryrefslogtreecommitdiff
path: root/eshell-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2026-10-13 13:58:16 +0800
committerJSDurand <mmemmew@gmail.com>2026-10-13 13:58:16 +0800
commitb17b83b5dd3b52fb827342f6e9e49d4489c78add (patch)
tree785be59f588cc0bd2d4e8fda9d86687b0144b6b7 /eshell-conf.el
parent5ce77bff2f05fff62aa5b117f82b76864d36af08 (diff)
eshell: add command that binds view mode with copy mode
* eshell-conf.el (copy-and-view-mode): This command toggles view mode along with the copy mode from ghostel. (ghostel-mode-map): Replace the binding of `ghostel-copy-mode`.
Diffstat (limited to 'eshell-conf.el')
-rw-r--r--eshell-conf.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/eshell-conf.el b/eshell-conf.el
index 3e95e8d..7b226e1 100644
--- a/eshell-conf.el
+++ b/eshell-conf.el
@@ -1195,5 +1195,22 @@ command."
(add-hook 'eshell-mode-hook #'ghostel-eshell-visual-command-mode)
+;;;; Copy-mode also enters view-mode
+
+(defun copy-and-view-mode (&optional arg)
+ "Also enter `view-mode' in copy-mode.
+If ARG is non-nil, behave just like `ghostel-copy-mode'."
+ (interactive "P")
+ (cond
+ ((eq ghostel--input-mode 'copy)
+ (cond ((null arg) (view-mode -1)))
+ (ghostel-readonly-exit))
+ (t
+ (ghostel-copy-mode)
+ (cond ((null arg) (view-mode 1))))))
+
+;; C-c C-t
+(define-key ghostel-mode-map (vector 3 20) #'copy-and-view-mode)
+
(provide 'eshell-conf)
;;; eshell-conf.el ends here