about summary refs log tree commit diff stats
path: root/modules/by-name/nv/nvim/plgs/treesitter
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/nv/nvim/plgs/treesitter/default.nix65
1 files changed, 27 insertions, 38 deletions
diff --git a/modules/by-name/nv/nvim/plgs/treesitter/default.nix b/modules/by-name/nv/nvim/plgs/treesitter/default.nix
index 02088d0a..1377cb8a 100644
--- a/modules/by-name/nv/nvim/plgs/treesitter/default.nix
+++ b/modules/by-name/nv/nvim/plgs/treesitter/default.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 {
   config,
   pkgs,
@@ -6,54 +15,34 @@
 }: let
   cfg = config.soispha.programs.nvim;
 in {
-  home-manager.users.soispha.  programs.nixvim = lib.mkIf cfg.enable {
+  home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable {
+    # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13>
+    dependencies = {
+      tree-sitter.enable = false;
+      nodejs.enable = false;
+      gcc.enable = false;
+    };
+
     plugins.treesitter = {
       enable = true;
 
-      # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13>
-      gccPackage = null;
-      nodejsPackage = null;
-      treesitterPackage = null;
+      highlight.enable = true;
+      indent.enable = true;
+      folding.enable = false;
 
       # inject nixvim specific highlighting (eg in extraConfigLua).
       nixvimInjections = true;
 
-      nixGrammars = true;
-      grammarPackages =
-        # Append the `tree-sitter-yts` grammar to all the other grammars.
-        # TODO: Find a better way to do this. <2024-11-08>
-        config.home-manager.users.soispha.programs.nixvim.plugins.treesitter.package.passthru.allGrammars
-        ++ [pkgs.tree-sitter-yts];
-
-      settings = {
-        auto_install = false;
-        ensureInstalled = "all";
-        indent.enable = true;
-        disabledLanguages = [];
+      grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars ++ [pkgs.tree-sitter-yts];
 
-        highlight = {
-          enable = true;
-          disable = [];
+      # Register the parser to filetype
+      languageRegister.yts = "yts";
+    };
 
-          #  Setting this to true will run `:h syntax` and tree-sitter at the same time.
-          #  Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-          #  Using this option may slow down your editor; and you may see some duplicate highlights.
-          #  Instead of true it can also be a list of languages
-          additionalVimRegexHighlighting = ["latex"];
-        };
+    # TODO: Is that necessary? <2026-01-18>
+    # extraPlugins = [pkgs.tree-sitter-yts];
 
-        incrementalSelection = {
-          enable = true;
-          keymaps = {
-            # TODO: include these in the which-key description
-            initSelection = "gnn"; #  set to `false` to disable one of the mappings
-            nodeIncremental = "grn";
-            scopeIncremental = "grc";
-            nodeDecremental = "grm";
-          };
-        };
-      };
-    };
+    # TODO: Remove this by moving the queries in the package to `queries/<lang>/...`' <2026-01-18>
     extraFiles = {
       "queries/yts/highlights.scm".text = ''
         ${lib.strings.fileContents "${pkgs.tree-sitter-yts}/queries/highlights.scm"}