Skip to content

Commit

Permalink
tweak(ts-movement): better detection of treesit enabled modes
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Feb 14, 2024
1 parent 8af4ad8 commit 09b365d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/me-prog.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@
:when (+emacs-features-p 'tree-sitter)
:hook ((prog-mode conf-mode) . +ts-movement-maybe)
:init
(defun +ts-movement-maybe (&optional arg)
(defun +ts-movement-maybe ()
"Enable `ts-movement-mode' when if `major-mode' is a trees-sitter mode."
(interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 'toggle)))
(when (string-suffix-p "-ts-mode" (symbol-name major-mode))
(ts-movement-mode arg)))
(run-with-timer 1.0 nil (lambda () (when (treesit-parser-list) (ts-movement-mode 1)))))
:config
(+map-local! :keymaps 'ts-movement-map "v" #'+ts-movement-transient)
(transient-define-prefix +ts-movement-transient ()
Expand Down

0 comments on commit 09b365d

Please sign in to comment.