2024-03-16 01:23:02 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
helpers,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib;
|
|
|
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
|
|
|
name = "twilight";
|
|
|
|
originalName = "twilight.nvim";
|
|
|
|
defaultPackage = pkgs.vimPlugins.twilight-nvim;
|
|
|
|
|
|
|
|
maintainers = [ maintainers.GaetanLepage ];
|
|
|
|
|
|
|
|
settingsOptions = {
|
|
|
|
dimming = {
|
2024-06-11 16:54:41 +01:00
|
|
|
alpha = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) 0.25 ''
|
2024-03-16 01:23:02 +01:00
|
|
|
Amount of dimming.
|
|
|
|
'';
|
|
|
|
|
2024-06-11 16:54:41 +01:00
|
|
|
color =
|
|
|
|
helpers.defaultNullOpts.mkListOf types.str
|
|
|
|
[
|
|
|
|
"Normal"
|
|
|
|
"#ffffff"
|
|
|
|
]
|
|
|
|
''
|
|
|
|
Highlight groups / colors to use.
|
|
|
|
'';
|
2024-03-16 01:23:02 +01:00
|
|
|
|
|
|
|
term_bg = helpers.defaultNullOpts.mkStr "#000000" ''
|
|
|
|
If `guibg=NONE`, this will be used to calculate text color.
|
|
|
|
'';
|
|
|
|
|
|
|
|
inactive = helpers.defaultNullOpts.mkBool false ''
|
|
|
|
When true, other windows will be fully dimmed (unless they contain the same buffer).
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
context = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
|
|
|
Amount of lines we will try to show around the current line.
|
|
|
|
'';
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-03-16 01:23:02 +01:00
|
|
|
treesitter = helpers.defaultNullOpts.mkBool true ''
|
|
|
|
Use `treesitter` when available for the filetype.
|
|
|
|
`treesitter` is used to automatically expand the visible text, but you can further control
|
|
|
|
the types of nodes that should always be fully expanded.
|
|
|
|
'';
|
|
|
|
|
2024-06-11 16:54:41 +01:00
|
|
|
expand = helpers.defaultNullOpts.mkListOf types.str [
|
|
|
|
"function"
|
|
|
|
"method"
|
|
|
|
"table"
|
|
|
|
"if_statement"
|
|
|
|
] "For treesitter, we will always try to expand to the top-most ancestor with these types.";
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-06-11 16:54:41 +01:00
|
|
|
exclude = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
2024-03-16 01:23:02 +01:00
|
|
|
Exclude these filetypes.
|
2024-05-05 19:39:35 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-03-16 01:23:02 +01:00
|
|
|
settingsExample = {
|
|
|
|
dimming.alpha = 0.4;
|
|
|
|
context = 20;
|
|
|
|
treesitter = true;
|
2024-05-05 19:39:35 +02:00
|
|
|
expand = [
|
2024-03-16 01:23:02 +01:00
|
|
|
"function"
|
2024-05-05 19:39:35 +02:00
|
|
|
"method"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-03-16 01:23:02 +01:00
|
|
|
extraConfig = cfg: {
|
|
|
|
warnings =
|
|
|
|
optional
|
|
|
|
((isBool cfg.settings.treesitter) && cfg.settings.treesitter && (!config.plugins.treesitter.enable))
|
|
|
|
''
|
|
|
|
Nixvim (plugins.twilight): You have set `plugins.twilight.treesitter` to `true` but `plugins.treesitter.enable` is false.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|