From 910628a0125e85deb377e547f5455ced724426c4 Mon Sep 17 00:00:00 2001 From: eriedaberrie Date: Fri, 6 Jan 2023 09:47:59 -0800 Subject: [PATCH] Actually use treesit modes --- init.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index 48820b3..b88d467 100644 --- a/init.el +++ b/init.el @@ -188,6 +188,17 @@ (use-package treesit :ensure nil + :init + (add-to-list 'major-mode-remap-alist '(sh-mode . bash-ts-mode)) + (add-to-list 'major-mode-remap-alist '(css-mode . css-ts-mode)) + (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode)) + (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode)) + (add-to-list 'major-mode-remap-alist '(csharp-mode . csharp-ts-mode)) + (add-to-list 'major-mode-remap-alist '(java-mode . java-ts-mode)) + (add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) + (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode)) + (add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode)) + (add-to-list 'major-mode-remap-alist '(js-json-mode . json-ts-mode)) :custom (treesit-extra-load-path `(,(expand-file-name "tree-sitter-module/dist/" user-emacs-directory)))) @@ -199,6 +210,7 @@ (use-package aggressive-indent :hook (lispyville-mode + nix-mode org-mode)) (use-package rainbow-delimiters @@ -275,7 +287,7 @@ (dirvish-override-dired-mode)) (use-package pdf-tools - :mode (("\\.pdf\\'" . pdf-view-mode)) + :mode ("\\.pdf\\'" . pdf-view-mode) :config (pdf-tools-install)) @@ -286,7 +298,7 @@ (buffer-face-mode)) (use-package org - :mode (("\\.org$" . org-mode)) + :mode ("\\.org$" . org-mode) :hook ((org-mode . org-indent-mode) (org-mode . flyspell-mode) (org-mode . auto-fill-mode) @@ -317,11 +329,11 @@ :config (editorconfig-mode)) -(use-package json-mode - :mode "\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'") - (use-package nix-mode - :mode "\\.nix'") + :mode "\\.nix'" + :hook (nix-mode . (lambda () + (with-eval-after-load 'evil + (setq-local evil-shift-width 2))))) (use-package markdown-mode :mode ("README\\.md\\'" . gfm-mode) @@ -495,6 +507,7 @@ (add-to-list 'after-make-frame-functions #'frame-make-detect-term) (add-to-list 'auto-mode-alist '("\\.yuck\\'" . lisp-mode)) +(add-to-list 'auto-mode-alist '("flake\\.lock\\'" . js-json-mode)) (with-current-buffer "*scratch*" (cd "~/"))