diff options
author | Alan Pearce | 2023-06-11 08:43:40 +0200 |
---|---|---|
committer | Alan Pearce | 2023-06-11 08:43:40 +0200 |
commit | 15529c6ca8c3480a0d891148efc4dbbe60729503 (patch) | |
tree | 6b1feb2ca331674810c737a8110ce177aa1e9f5b /user/emacs | |
parent | 3a52fcd76fe2313e041a6d3b45913dc2a6159779 (diff) | |
download | nixfiles-15529c6ca8c3480a0d891148efc4dbbe60729503.tar.lz nixfiles-15529c6ca8c3480a0d891148efc4dbbe60729503.tar.zst nixfiles-15529c6ca8c3480a0d891148efc4dbbe60729503.zip |
Emacs: fix tree-sitter-based evil commands
Diffstat (limited to 'user/emacs')
-rw-r--r-- | user/emacs/init.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el index 259d48ae..7e9e8b8a 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -455,27 +455,29 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :ghook ('org-mode-hook #'evil-org-mode) :gfhook #'evil-org-set-key-theme) -(defun etts/start-of-next-function () - (interactive) - (evil-textobj-tree-sitter-goto-textobj "function.outer" nil nil)) -(defun etts/start-of-prev-function () - (interactive) - (evil-textobj-tree-sitter-goto-textobj "function.outer" t nil)) -(defun etts/end-of-next-function () - (interactive) - (evil-textobj-tree-sitter-goto-textobj "function.outer" nil t)) -(defun etts/end-of-prev-function () - (interactive) - (evil-textobj-tree-sitter-goto-textobj "function.outer" t t)) (use-package evil-textobj-tree-sitter :after evil + :defer 5 + :config (progn + (defun etts/start-of-next-function () + (interactive) + (evil-textobj-tree-sitter-goto-textobj "function.outer" nil nil)) + (defun etts/start-of-prev-function () + (interactive) + (evil-textobj-tree-sitter-goto-textobj "function.outer" t nil)) + (defun etts/end-of-next-function () + (interactive) + (evil-textobj-tree-sitter-goto-textobj "function.outer" nil t)) + (defun etts/end-of-prev-function () + (interactive) + (evil-textobj-tree-sitter-goto-textobj "function.outer" t t)) + (general-define-key :keymaps 'evil-outer-text-objects-map + "f" (evil-textobj-tree-sitter-get-textobj "function.outer") + "a" (evil-textobj-tree-sitter-get-textobj ("conditional.outer" "loop.outer"))) + (general-define-key :keymaps 'evil-inner-text-objects-map + "f" (evil-textobj-tree-sitter-get-textobj "function.inner") + "a" (evil-textobj-tree-sitter-get-textobj ("conditional.inner" "loop.inner")))) :general - (:keymaps 'evil-outer-text-objects-map - "f" (evil-textobj-tree-sitter-get-textobj "function.outer") - "a" (evil-textobj-tree-sitter-get-textobj ("conditional.outer" "loop.outer"))) - (:keymaps 'evil-inner-text-objects-map - "f" (evil-textobj-tree-sitter-get-textobj "function.inner") - "a" (evil-textobj-tree-sitter-get-textobj ("conditional.inner" "loop.inner"))) (:states 'normal "]f" #'etts/start-of-next-function "[f" #'etts/start-of-prev-function |