fix(tree-sitter): feature gate +tree-sitter-keys-mode
As this has a dependency on evil it makes sense to only load it when evil is used, the entire mode is only needed for evil textobj tree-sitter anyway
This commit is contained in:
parent
955e2d461b
commit
9c00df72d6
1 changed files with 16 additions and 15 deletions
|
@ -14,22 +14,23 @@
|
||||||
(defvar +tree-sitter-goto-previous-map (make-sparse-keymap))
|
(defvar +tree-sitter-goto-previous-map (make-sparse-keymap))
|
||||||
(defvar +tree-sitter-goto-next-map (make-sparse-keymap))
|
(defvar +tree-sitter-goto-next-map (make-sparse-keymap))
|
||||||
|
|
||||||
(defvar +tree-sitter-keys-mode-map
|
(when (featurep! :editor evil +everywhere)
|
||||||
(let ((keymap (make-sparse-keymap)))
|
(defvar +tree-sitter-keys-mode-map
|
||||||
;; ts text objects
|
(let ((keymap (make-sparse-keymap)))
|
||||||
(evil-define-key '(visual operator) '+tree-sitter-keys-mode
|
;; ts text objects
|
||||||
"i" +tree-sitter-inner-text-objects-map
|
(evil-define-key '(visual operator) '+tree-sitter-keys-mode
|
||||||
"a" +tree-sitter-outer-text-objects-map)
|
"i" +tree-sitter-inner-text-objects-map
|
||||||
;; ts goto nodes
|
"a" +tree-sitter-outer-text-objects-map)
|
||||||
(evil-define-key 'normal '+tree-sitter-keys-mode
|
;; ts goto nodes
|
||||||
"[g" +tree-sitter-goto-previous-map
|
(evil-define-key 'normal '+tree-sitter-keys-mode
|
||||||
"]g" +tree-sitter-goto-next-map)
|
"[g" +tree-sitter-goto-previous-map
|
||||||
keymap)
|
"]g" +tree-sitter-goto-next-map)
|
||||||
"Basic keymap for tree sitter text objects")
|
keymap)
|
||||||
|
"Basic keymap for tree sitter text objects")
|
||||||
|
|
||||||
(define-minor-mode +tree-sitter-keys-mode
|
(define-minor-mode +tree-sitter-keys-mode
|
||||||
"A minor mode with tree sitter keybinds."
|
"A minor mode with tree sitter keybinds."
|
||||||
:keymap +tree-sitter-keys-mode-map)
|
:keymap +tree-sitter-keys-mode-map))
|
||||||
|
|
||||||
(use-package! evil-textobj-tree-sitter
|
(use-package! evil-textobj-tree-sitter
|
||||||
:when (featurep! :editor evil +everywhere)
|
:when (featurep! :editor evil +everywhere)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue