diff --git a/modules/home/emacs/default.nix b/modules/home/emacs/default.nix index 3dea69e..7f7f561 100644 --- a/modules/home/emacs/default.nix +++ b/modules/home/emacs/default.nix @@ -10,7 +10,10 @@ emacs-pgtk = pkgs.emacs-pgtk.pkgs.withPackages(epkgs: with epkgs; [ helix jjdescription + nix-ts-mode treemacs + treesit-auto + treesit-grammars.with-all-grammars vc-jj ]); in { diff --git a/modules/home/emacs/init.el b/modules/home/emacs/init.el index 08b9fe4..7a98b82 100644 --- a/modules/home/emacs/init.el +++ b/modules/home/emacs/init.el @@ -3,6 +3,7 @@ (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) (require 'init-helix) +(require 'init-treesit) (with-eval-after-load 'treemacs (add-hook 'treemacs-mode-hook (lambda () (helix-normal-mode -1))) diff --git a/modules/home/emacs/lisp/init-treesit.el b/modules/home/emacs/lisp/init-treesit.el new file mode 100644 index 0000000..b35e78e --- /dev/null +++ b/modules/home/emacs/lisp/init-treesit.el @@ -0,0 +1,15 @@ +;;; init-treesit.el --- Tree-sitter-based syntax highlighting -*- lexical-binding: t; -*- + +;; Grammars are provided by Nix via `treesit-grammars.with-all-grammars'; +;; don't let treesit-auto try to fetch and compile them at runtime. +(setq treesit-auto-install nil) + +(require 'treesit-auto) +(global-treesit-auto-mode) + +;; Nix isn't a built-in tree-sitter mode, so `treesit-auto' doesn't know +;; about it. Wire it up explicitly. +(add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-ts-mode)) + +(provide 'init-treesit) +;;; init-treesit.el ends here