mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
plugins/treesitter: add an internal defaultGrammars
options
This commit is contained in:
parent
495e7620d2
commit
7fd653b4d8
4 changed files with 51 additions and 106 deletions
|
@ -1,20 +1,16 @@
|
|||
{lib, ...}: let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.types) listOf package;
|
||||
|
||||
inherit (pkgs.vimPlugins.nvim-treesitter) builtGrammars;
|
||||
in {
|
||||
options.vim.treesitter = {
|
||||
enable = mkEnableOption "treesitter, also enabled automatically through language options";
|
||||
fold = mkEnableOption "fold with treesitter";
|
||||
autotagHtml = mkEnableOption "autoclose and rename html tag";
|
||||
grammars = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
description = ''
|
||||
List of treesitter grammars to install. For supported languages
|
||||
use the `vim.language.<lang>.treesitter` option
|
||||
'';
|
||||
};
|
||||
|
||||
mappings.incrementalSelection = {
|
||||
init = mkMappingOption "Init selection [treesitter]" "gnn";
|
||||
|
@ -22,5 +18,37 @@ in {
|
|||
incrementByScope = mkMappingOption "Increment selection by scope [treesitter]" "grc";
|
||||
decrementByNode = mkMappingOption "Decrement selection by node [treesitter]" "grm";
|
||||
};
|
||||
|
||||
fold = mkEnableOption "fold with treesitter";
|
||||
autotagHtml = mkEnableOption "autoclose and rename html tag";
|
||||
grammars = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
description = ''
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
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.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue