summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Nicolai <dalanicolai@gmail.com>2022-04-16 16:40:59 +0200
committerDaniel Nicolai <dalanicolai@gmail.com>2022-04-17 11:37:18 +0200
commit4fbe6bf9ca5d93f455584ee3936f12a9458c1a45 (patch)
tree068dcb80a053d49cfcd923382c93a65facbdcde5
parent2bc8aa6425f1311e985cf51ea6b5233c1ee6ce1c (diff)
Limit global activation to text-, prog- and comint-mode
Activating evil-surround in special-mode (i.e. read-only) buffers does not make sense. Furthermore, the bindings can overwrite bindings in modes like magit-diff-mode (see https://github.com/syl20bnr/spacemacs/issues/15448#issuecomment-1090810486). This commit limits the 'globally activated modes' to (modes derived from) text-, prog- and comint-mode via the `define-globalized-minor-mode` its [:predicate](https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Minor-Modes.html#index-define_002dglobalized_002dminor_002dmode] keyword. As this should be the default behavior, it is not essential to change/update the documentation.
-rw-r--r--evil-surround.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/evil-surround.el b/evil-surround.el
index e20e0cd..0182207 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -493,7 +493,7 @@ Becomes this:
;;;###autoload
(define-globalized-minor-mode global-evil-surround-mode
evil-surround-mode turn-on-evil-surround-mode
- "Global minor mode to emulate surround.vim.")
+ :predicate '(text-mode prog-mode comint-mode))
(evil-define-key 'operator evil-surround-mode-map "s" 'evil-surround-edit)
(evil-define-key 'operator evil-surround-mode-map "S" 'evil-Surround-edit)