diff options
| author | JSDurand <mmemmew@gmail.com> | 2026-10-13 13:58:16 +0800 |
|---|---|---|
| committer | JSDurand <mmemmew@gmail.com> | 2026-10-13 13:58:16 +0800 |
| commit | b17b83b5dd3b52fb827342f6e9e49d4489c78add (patch) | |
| tree | 785be59f588cc0bd2d4e8fda9d86687b0144b6b7 | |
| parent | 5ce77bff2f05fff62aa5b117f82b76864d36af08 (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`.
| -rw-r--r-- | eshell-conf.el | 17 |
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 |
