2024-04-23 15:08:55 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2024-03-15 12:19:11 +01:00
|
|
|
inherit (lib.options) mkOption mkEnableOption;
|
|
|
|
inherit (lib.nvim.binds) mkMappingOption;
|
|
|
|
inherit (lib.types) listOf package;
|
2024-04-23 15:08:55 +02:00
|
|
|
|
|
|
|
inherit (pkgs.vimPlugins.nvim-treesitter) builtGrammars;
|
2023-11-07 01:50:27 +01:00
|
|
|
in {
|
2023-02-01 20:11:37 +01:00
|
|
|
options.vim.treesitter = {
|
2023-04-17 22:27:27 +02:00
|
|
|
enable = mkEnableOption "treesitter, also enabled automatically through language options";
|
2024-04-23 15:08:55 +02:00
|
|
|
|
|
|
|
mappings.incrementalSelection = {
|
|
|
|
init = mkMappingOption "Init selection [treesitter]" "gnn";
|
|
|
|
incrementByNode = mkMappingOption "Increment selection by node [treesitter]" "grn";
|
|
|
|
incrementByScope = mkMappingOption "Increment selection by scope [treesitter]" "grc";
|
|
|
|
decrementByNode = mkMappingOption "Decrement selection by node [treesitter]" "grm";
|
|
|
|
};
|
|
|
|
|
2023-04-17 22:27:27 +02:00
|
|
|
fold = mkEnableOption "fold with treesitter";
|
|
|
|
autotagHtml = mkEnableOption "autoclose and rename html tag";
|
2023-02-01 20:11:37 +01:00
|
|
|
grammars = mkOption {
|
2024-03-15 12:19:11 +01:00
|
|
|
type = listOf package;
|
2023-04-17 22:27:27 +02:00
|
|
|
default = [];
|
2023-11-04 12:30:04 +01:00
|
|
|
description = ''
|
2024-04-23 15:08:55 +02:00
|
|
|
List of treesitter grammars to install.
|
|
|
|
|
|
|
|
For languages already supported by neovim-flake, you may
|
|
|
|
use the {option}`vim.language.<lang>.treesitter` options, which
|
|
|
|
will automatically add the required grammars to this.
|
2023-02-01 20:11:37 +01:00
|
|
|
'';
|
|
|
|
};
|
2024-03-15 12:19:11 +01:00
|
|
|
|
2024-04-23 15:08:55 +02:00
|
|
|
defaultGrammars = mkOption {
|
|
|
|
internal = true;
|
|
|
|
readOnly = true;
|
|
|
|
type = listOf package;
|
|
|
|
default = with builtGrammars; [c lua vim vimdoc query];
|
|
|
|
description = ''
|
|
|
|
A list of treesitter grammars that will be installed by default
|
|
|
|
if treesitter has been enabled.
|
|
|
|
|
|
|
|
::: {.warning}
|
|
|
|
Regardless of which language module options you enable, Neovim
|
|
|
|
depends on those grammars to be enabled while treesitter is enabled.
|
|
|
|
This list cannot be modified, but its contents will only be appended
|
|
|
|
if the list of grammars does not contain the required grammars.
|
|
|
|
:::
|
|
|
|
'';
|
2024-03-15 12:19:11 +01:00
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
}
|