This commit is contained in:
raf 2026-01-06 12:17:15 +00:00 committed by GitHub
commit 75e9e77d3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 22 additions and 19 deletions

View file

@ -30,7 +30,7 @@
mkGrammarOption = pkgs: grammar: mkGrammarOption = pkgs: grammar:
mkPackageOption pkgs ["${grammar} treesitter"] { mkPackageOption pkgs ["${grammar} treesitter"] {
default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar]; default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
}; };
in { in {
inherit diagnostics diagnosticSubmodule mkGrammarOption; inherit diagnostics diagnosticSubmodule mkGrammarOption;

View file

@ -228,7 +228,7 @@ in {
package = mkOption { package = mkOption {
description = "Python treesitter grammar to use"; description = "Python treesitter grammar to use";
type = package; type = package;
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.python; default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python;
}; };
}; };

View file

@ -66,7 +66,7 @@ in {
package = mkOption { package = mkOption {
type = package; type = package;
default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.sql; default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql;
description = "SQL treesitter grammar to use"; description = "SQL treesitter grammar to use";
}; };
}; };

View file

@ -39,7 +39,8 @@ in {
]; ];
}; };
# For some reason treesitter highlighting does not work on start if this is set before syntax on # For some reason treesitter highlighting does not work on start if this
# is set before 'syntax on' or similar.
pluginRC.treesitter-fold = mkIf cfg.fold (entryBefore ["basic"] '' pluginRC.treesitter-fold = mkIf cfg.fold (entryBefore ["basic"] ''
-- This is required by treesitter-context to handle folds -- This is required by treesitter-context to handle folds
vim.o.foldmethod = "expr" vim.o.foldmethod = "expr"
@ -54,8 +55,8 @@ in {
pluginRC.treesitter = entryAfter ["basic"] '' pluginRC.treesitter = entryAfter ["basic"] ''
require('nvim-treesitter.config').setup { require('nvim-treesitter.config').setup {
-- Disable imperative treesitter options that would attempt to fetch -- Disable imperative treesitter options that would attempt to fetch
-- grammars into the read-only Nix store. To add additional grammars here -- grammars into the read-only Nix store. To add additional grammars
-- you must use the `config.vim.treesitter.grammars` option. -- here, you must use the `config.vim.treesitter.grammars` option.
auto_install = false, auto_install = false,
sync_install = false, sync_install = false,
ensure_installed = {}, ensure_installed = {},
@ -74,9 +75,8 @@ in {
}, },
-- Indentation module for Treesitter -- Indentation module for Treesitter
-- Keymaps are set to false here as they are -- Keymaps are set to false here as they are handled by `vim.maps`
-- handled by `vim.maps` entries calling lua -- entries calling Lua functions achieving the same functionality.
-- functions achieving the same functionality.
incremental_selection = { incremental_selection = {
enable = ${toLuaObject cfg.incrementalSelection.enable}, enable = ${toLuaObject cfg.incrementalSelection.enable},
disable = ${toLuaObject cfg.incrementalSelection.disable}, disable = ${toLuaObject cfg.incrementalSelection.disable},
@ -85,7 +85,6 @@ in {
node_incremental = false, node_incremental = false,
scope_incremental = false, scope_incremental = false,
node_decremental = false, node_decremental = false,
}, },
}, },
} }

View file

@ -25,14 +25,14 @@ in {
type = listOf package; type = listOf package;
default = []; default = [];
example = literalExpression '' example = literalExpression ''
with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [ with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
regex regex
kdl kdl
]; ];
''; '';
description = '' description = ''
List of treesitter grammars to install. For grammars to be installed properly, List of treesitter grammars to install. For grammars to be installed properly,
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`. you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars. You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
For languages already supported by nvf, you may use For languages already supported by nvf, you may use
@ -56,7 +56,7 @@ in {
internal = true; internal = true;
readOnly = true; readOnly = true;
type = listOf package; type = listOf package;
default = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [c lua vim vimdoc query]; default = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [c lua vim vimdoc query];
description = '' description = ''
A list of treesitter grammars that will be installed by default A list of treesitter grammars that will be installed by default
if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars` if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars`

View file

@ -12,7 +12,7 @@
cfg = config.vim.ui.noice; cfg = config.vim.ui.noice;
tscfg = config.vim.treesitter; tscfg = config.vim.treesitter;
defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [vim regex lua bash markdown]; defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [vim regex lua bash markdown];
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {

View file

@ -35,7 +35,11 @@
); );
# Build a given Treesitter grammar. # Build a given Treesitter grammar.
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); buildTreesitterPlug = grammars:
vimPlugins.nvim-treesitter.withPlugins (_: grammars)
// {
installQueries = true;
};
pluginBuilders = { pluginBuilders = {
nvim-treesitter = buildTreesitterPlug config.vim.treesitter.grammars; nvim-treesitter = buildTreesitterPlug config.vim.treesitter.grammars;

View file

@ -2062,11 +2062,11 @@
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"repo": "nvim-treesitter-textobjects" "repo": "nvim-treesitter-textobjects"
}, },
"branch": "master", "branch": "main",
"submodules": false, "submodules": false,
"revision": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c", "revision": "28a3494c075ef0f353314f627546537e43c09592",
"url": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects/archive/71385f191ec06ffc60e80e6b0c9a9d5daed4824c.tar.gz", "url": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects/archive/28a3494c075ef0f353314f627546537e43c09592.tar.gz",
"hash": "0pp8s0wljwhc93jp47ad4pigqm8q7v173374c1vpydhx09qwl4ga" "hash": "1ky29nw4ayzpvbh4y0jp7apdfwj6pd8wvnx5gsw2z6rxdl0qhmz5"
}, },
"nvim-ts-autotag": { "nvim-ts-autotag": {
"type": "Git", "type": "Git",