Fix #4548: global TAB overwritten by evil keybind

This commit is contained in:
Henrik Lissner 2021-02-06 06:54:18 -05:00
parent 45b68e46ee
commit 16a495c97d
3 changed files with 19 additions and 9 deletions

View file

@ -94,10 +94,10 @@ at the values with which this function was called."
(lambda (&rest pre-args) (lambda (&rest pre-args)
(apply fn (append pre-args args)))) (apply fn (append pre-args args))))
(defun doom-lookup-key (keys &optional keymap) (defun doom-lookup-key (keys &rest keymaps)
"Like `lookup-key', but search active keymaps if KEYMAP is omitted." "Like `lookup-key', but search active keymaps if KEYMAP is omitted."
(if keymap (if keymaps
(lookup-key keymap keys) (cl-some (doom-rpartial #'lookup-key keys) keymaps)
(cl-loop for keymap (cl-loop for keymap
in (append (cl-loop for alist in emulation-mode-map-alists in (append (cl-loop for alist in emulation-mode-map-alists
append (mapcar #'cdr append (mapcar #'cdr

View file

@ -42,13 +42,24 @@
(bound-and-true-p yas-minor-mode) (bound-and-true-p yas-minor-mode)
(yas-maybe-expand-abbrev-key-filter 'yas-expand)) (yas-maybe-expand-abbrev-key-filter 'yas-expand))
#'yas-expand #'yas-expand
(and (featurep! :completion company +tng) (featurep! :completion company +tng)
(+company-has-completion-p)) #'company-indent-or-complete-common)
#'company-complete-common) :m [tab] (cmds! (and (bound-and-true-p yas-minor-mode)
:v [tab] (cmds! (and (bound-and-true-p yas-minor-mode) (evil-visual-state-p)
(or (eq evil-visual-selection 'line) (or (eq evil-visual-selection 'line)
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\)))))) (not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
#'yas-insert-snippet) #'yas-insert-snippet
(and (featurep! :editor fold)
(save-excursion (end-of-line) (invisible-p (point))))
#'+fold/toggle
;; Fixes #4548: without this, this tab keybind overrides
;; mode-local ones for modes that don't have an evil
;; keybinding scheme or users who don't have :editor (evil
;; +everywhere) enabled.
(doom-lookup-key [tab] (list (current-local-map)))
it
(fboundp 'evil-jump-item)
#'evil-jump-item)
(:after help :map help-mode-map (:after help :map help-mode-map
:n "o" #'link-hint-open-link) :n "o" #'link-hint-open-link)

View file

@ -420,7 +420,6 @@ directives. By default, this only recognizes C directives.")
(map! :v "@" #'+evil:apply-macro (map! :v "@" #'+evil:apply-macro
:m [C-i] #'evil-jump-forward :m [C-i] #'evil-jump-forward
:m [tab] #'evil-jump-item
;; implement dictionary keybinds ;; implement dictionary keybinds
;; evil already defines 'z=' to `ispell-word' = correct word at point ;; evil already defines 'z=' to `ispell-word' = correct word at point