From 2d847cbf28898a49143e3d40f358bb158e1532d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Sun, 27 Oct 2024 00:34:22 +0200 Subject: [PATCH] Home Gen381 @ 2024-10-27-00:34 --- modules/home/doom/static/config.el | 48 ++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/modules/home/doom/static/config.el b/modules/home/doom/static/config.el index 3696100..9e34430 100644 --- a/modules/home/doom/static/config.el +++ b/modules/home/doom/static/config.el @@ -150,6 +150,27 @@ (set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode)) ;;Use TS-modes +(after! treesit + (setq treesit-font-lock-level 4)) + +(defconst mode-ts-mode-mapping + '((python-mode . python-ts-mode) + (css-mode . css-ts-mode) + (typescript-mode . typescript-ts-mode) + (js-mode . typescript-ts-mode) + (js2-mode . typescript-ts-mode) + (c-mode . c-ts-mode) + (c++-mode . c++-ts-mode) + (c-or-c++-mode . c-or-c++-ts-mode) + (bash-mode . bash-ts-mode) + (css-mode . css-ts-mode) + (json-mode . json-ts-mode) + (js-json-mode . json-ts-mode) + (sh-mode . bash-ts-mode) + (c-or-c++-mode . c-or-c++-ts-mode) + (sh-base-mode . bash-ts-mode)) + "A map from original mode to the ts-mode") + (use-package! treesit :defer t :mode (("\\.tsx\\'" . tsx-ts-mode) @@ -168,24 +189,19 @@ ("\\.sh\\'" . bash-ts-mode) ) :preface - (dolist (mapping - '((python-mode . python-ts-mode) - (css-mode . css-ts-mode) - (typescript-mode . typescript-ts-mode) - (js-mode . typescript-ts-mode) - (js2-mode . typescript-ts-mode) - (c-mode . c-ts-mode) - (c++-mode . c++-ts-mode) - (c-or-c++-mode . c-or-c++-ts-mode) - (bash-mode . bash-ts-mode) - (css-mode . css-ts-mode) - (json-mode . json-ts-mode) - (js-json-mode . json-ts-mode) - (sh-mode . bash-ts-mode) - (c-or-c++-mode . c-or-c++-ts-mode) - (sh-base-mode . bash-ts-mode))) + (dolist (mapping 'mode-ts-mode-mapping) (add-to-list 'major-mode-remap-alist mapping))) +(after! tree-sitter + (dolist (mapping 'tree-sitter-major-mode-language-alist) + (let* ((pre-mode (car mapping)) + (post-mode (cdr mapping)) + (ts-lang (cdr (rassoc pre-mode 'mode-ts-mode-mapping)))) + (when ts-pre-mode-lang + (add-to-list 'tree-sitter-major-mode-language-alist (post-mode . ts-lang)))))) + + + (use-package lsp-mode :defer t :hook ((lsp-mode . lsp-diagnostics-mode)