summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-28 10:59:55 +0200
committerAlan Pearce2024-04-28 10:59:55 +0200
commit0cbdeb522332029ee7670312f34297fff781c079 (patch)
tree6b9579f77240a713fb8e55dec1d6c0c6c0aab97c
parent2f9f01c6d1ef0b690b3121d4a85b263634f988a4 (diff)
downloadnixfiles-0cbdeb522332029ee7670312f34297fff781c079.tar.lz
nixfiles-0cbdeb522332029ee7670312f34297fff781c079.tar.zst
nixfiles-0cbdeb522332029ee7670312f34297fff781c079.zip
emacs: replace custom treesitter mode settings with treesit-auto
-rw-r--r--user/emacs/init.el47
-rw-r--r--user/settings/development/javascript.nix1
-rw-r--r--user/settings/emacs.nix5
3 files changed, 15 insertions, 38 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 9f8d18e4..10f9c98d 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -435,9 +435,9 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :after evil
   :defer 2
   :config (progn
-            (add-hook 'js-ts-mode-hook (lambda ()
-                                         (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/")
-                                         (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist)))
+            (add-hook 'js-mode-hook (lambda ()
+                                      (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/")
+                                      (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist)))
             (add-hook 'emacs-lisp-mode-hook (lambda ()
                                               (push '(?` . ("`" . "'")) evil-surround-pairs-alist)))
             (global-evil-surround-mode +1)))
@@ -447,7 +447,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :after evil-surround
   :ghook ('LaTex-mode-hook #'embrace-LaTeX-mode-hook)
   :ghook ('org-mode-hook #'embrace-org-mode-hook)
-  :ghook ('ruby-ts-mode-hook #'embrace-ruby-mode-hook)
+  :ghook ('ruby-mode-hook #'embrace-ruby-mode-hook)
   :ghook ('emacs-lisp-mode-hook #'embrace-emacs-lisp-mode-hook)
   :config (progn
             (setq evil-embrace-show-help-p nil)
@@ -737,22 +737,12 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 
 ;;; Major modes
 
-(setq major-mode-remap-alist '((c-mode . c-ts-mode)
-                               (c++-mode . c++-ts-mode)
-                               (c-or-c++-mode . c-or-c++-ts-mode)
-                               (cmake-mode . cmake-ts-mode)
-                               (csharp-mode . csharp-ts-mode)
-                               (dockerfile-mode . dockerfile-ts-mode)
-                               (go-mode . go-ts-mode)
-                               (java-mode . java-ts-mode)
-                               (python-mode . python-ts-mode)
-                               (ruby-mode . ruby-ts-mode)
-                               (toml-mode . toml-ts-mode)
-                               (yaml-mode . yaml-ts-mode)))
+;;;; tree-sitter
+(use-package treesit-auto
+  :config (global-treesit-auto-mode))
 
 ;;;; golang
-(with-eval-after-load 'go-ts-mode
-  (setq go-ts-mode-indent-offset tab-width))
+(setq go-mode-indent-offset tab-width)
 (with-eval-after-load 'project
   (add-to-list 'project-vc-extra-root-markers "go.mod"))
 
@@ -766,16 +756,8 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 ;;;; js
 (setq js-indent-level 2
       js-enabled-frameworks '(javascript))
-(add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
-(add-to-list 'major-mode-remap-alist '(json-mode . json-ts-mode))
 
 ;;;; typescript
-(use-package typescript-mode
-  :mode (("\\.tsx\\'" . tsx-ts-mode))
-  :config (progn
-            (setq typescript-indent-level 2
-                  typescript-ts-mode-indent-offset 2)))
-(add-to-list 'major-mode-remap-alist '(typescript-mode . typescript-ts-mode))
 
 (use-package astro-ts-mode
   :mode (("\\.astro\\'" . astro-ts-mode)))
@@ -873,7 +855,6 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :defer t
   :config (progn
             (setq css-indent-offset 2)))
-(add-to-list 'major-mode-remap-alist '(css-mode . css-ts-mode))
 
 (use-package web-mode
   :mode (("\\.html?.erb\\'" . web-mode))
@@ -1050,12 +1031,12 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
                     "gd" #'xref-find-definitions
                     "gr" #'xref-find-references
                     "C-t" #'xref-pop-marker-stack)
-  :ghook ('(typescript-ts-mode-hook
-            dockerfile-ts-mode-hook
-            yaml-ts-mode-hook
-            js-ts-mode-hook
-            css-ts-mode-hook
-            go-ts-mode-hook
+  :ghook ('(typescript-mode-hook
+            dockerfile-mode-hook
+            yaml-mode-hook
+            js-mode-hook
+            css-mode-hook
+            go-mode-hook
             lua-mode-hook
             nim-mode-hook
             html-mode-hook
diff --git a/user/settings/development/javascript.nix b/user/settings/development/javascript.nix
index 428d7b64..f6c97bca 100644
--- a/user/settings/development/javascript.nix
+++ b/user/settings/development/javascript.nix
@@ -35,7 +35,6 @@
 
   programs.emacs.extraPackages = epkgs: (with epkgs; [
     add-node-modules-path
-    typescript-mode
   ]);
 
   home.shellAliases = {
diff --git a/user/settings/emacs.nix b/user/settings/emacs.nix
index fc48d3be..de0d73cc 100644
--- a/user/settings/emacs.nix
+++ b/user/settings/emacs.nix
@@ -83,7 +83,6 @@ in
         crux
         dired-git-info
         docker-compose-mode
-        dockerfile-mode
         dtrt-indent
         envrc
         editorconfig
@@ -126,7 +125,6 @@ in
         jinx
         just-mode
         justl
-        json-mode
         kind-icon
         lua-mode
         lispy
@@ -149,15 +147,14 @@ in
         tempel
         tempel-collection
         eglot-tempel
-        toml-mode
         treesit-grammars.with-all-grammars
+        treesit-auto
         vc-msg
         vertico
         vertico-prescient
         wgrep-ag
         ws-butler
         which-key
-        yaml-mode
       ]);
     extraConfig = ''
       (with-eval-after-load 'editorconfig