read-only mode bindings
This commit is contained in:
parent
6f0ac579aa
commit
04110f090f
|
@ -392,6 +392,17 @@ This is particularly useful for read-only modes."
|
|||
[remap evil-shift-right] #'ignore
|
||||
[remap evil-invert-char] #'ignore))
|
||||
|
||||
(defun evil-collection-set-readonly-bindings (map-sym)
|
||||
"Unmap insertion keys from normal state. Additionally q can `quit-window'.
|
||||
This is particularly useful for read-only modes. Make sure it's
|
||||
called before setting up other evil bindings so that it can be
|
||||
overriden."
|
||||
(evil-collection-inhibit-insert-state map-sym)
|
||||
(evil-collection-define-key 'normal map-sym
|
||||
"q" #'quit-window
|
||||
"ZZ" #'quit-window
|
||||
"ZQ" #'evil-quit))
|
||||
|
||||
(defun evil-collection--binding-lessp (a b)
|
||||
"Comparison function used to sort bindings of the form (state key def)."
|
||||
(let ((a-state (symbol-name (nth 0 a)))
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
;;;###autoload
|
||||
(defun evil-collection-simple-setup ()
|
||||
"Set up `evil' bindings for `simple'."
|
||||
|
||||
(evil-collection-set-readonly-bindings 'special-mode-map)
|
||||
(evil-collection-define-key nil 'special-mode-map
|
||||
"g" nil
|
||||
"gr" 'revert-buffer
|
||||
|
|
|
@ -257,10 +257,11 @@ more.
|
|||
|
||||
A good rule of thumb would be:
|
||||
|
||||
- Always bind ~ZZ~ and ~ZQ~ to the quitting function(s), ~evil-quit~ if nothing
|
||||
else makes sense.
|
||||
- Always bind ~q~, ~ZZ~ and ~ZQ~ to the mode specific quitting functions. If there is none,
|
||||
|
||||
- Bind ~q~ to ~evil-quit~ if macros don't make sense in current mode.
|
||||
- Bind ~q~ and ~ZZ~ to ~quit-window~
|
||||
|
||||
- Bind ~ZQ~ to ~evil-quit~
|
||||
|
||||
- If macros don't make sense in current mode, then ~@~ is available.
|
||||
|
||||
|
|
Loading…
Reference in New Issue