[core] Fix evil keybindings when a link is selected in Custom-mode (#13963)

* [core] Fix evil keybindings when a link is selected in Custom-mode

This uses a separate keymap bound directly to the widget and circumvents the
existing evil keybindings.

This fixes the bug found by @duianto, which he posted
[here](https://github.com/syl20bnr/spacemacs/pull/13949#issuecomment-694685304).

* [core] Fix q and u to work everywhere in a Custom-mode buffer
This commit is contained in:
Keith Pinson 2020-09-18 13:36:40 -04:00 committed by GitHub
parent c0e31e4b8d
commit b83dd9c786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -99,11 +99,17 @@
;; - `u' as `Custom-goto-parent' conflicts with Evil undo. However it is
;; questionable whether this will work properly in a Custom buffer;
;; choosing to restore this binding.
(evil-define-key 'normal cus-edit-mode-map (kbd "q") 'Custom-buffer-done)
(evil-define-key 'normal cus-edit-mode-map (kbd "u") 'Custom-goto-parent)
(evil-define-key 'normal custom-mode-map (kbd "q") 'Custom-buffer-done)
(evil-define-key 'normal custom-mode-map (kbd "u") 'Custom-goto-parent)
;; `RET' does not work well in the search field. Fix:
(evil-define-key 'insert cus-edit-mode-map (kbd "RET") 'spacemacs/custom-newline)
(evil-define-key 'normal cus-edit-mode-map (kbd "RET") 'spacemacs/custom-newline))
(evil-define-key '(insert normal) custom-mode-map (kbd "RET") 'spacemacs/custom-newline)
;; There is a separate map for links, oddly enough. Separate it from the
;; `custom-mode-map' bindings, which is its parent by default.
(set-keymap-parent custom-mode-link-map nil)
;; Evil doesn't seem to be properly in control of what is going on in these
;; widget-induced keymaps, so just use base bindings to sort this out
(define-key custom-mode-link-map (kbd "q") 'Custom-buffer-done)
(define-key custom-mode-link-map (kbd "u") 'Custom-goto-parent))
(defun spacemacs-defaults/init-dired ()
(spacemacs/set-leader-keys