mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 09:14:31 +02:00
plugins/twilight: init
This commit is contained in:
parent
5004178c0c
commit
57d1062c04
3 changed files with 114 additions and 0 deletions
|
@ -111,6 +111,7 @@
|
|||
./ui/image.nix
|
||||
./ui/noice.nix
|
||||
./ui/transparent.nix
|
||||
./ui/twilight.nix
|
||||
./ui/virt-column.nix
|
||||
|
||||
./utils/alpha.nix
|
||||
|
|
81
plugins/ui/twilight.nix
Normal file
81
plugins/ui/twilight.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
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 = {
|
||||
alpha = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.25" ''
|
||||
Amount of dimming.
|
||||
'';
|
||||
|
||||
color = helpers.defaultNullOpts.mkListOf types.str ''["Normal" "#ffffff"]'' ''
|
||||
Highlight groups / colors to use.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
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.";
|
||||
|
||||
exclude = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||
Exclude these filetypes.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
dimming.alpha = 0.4;
|
||||
context = 20;
|
||||
treesitter = true;
|
||||
expand = ["function" "method"];
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
}
|
32
tests/test-sources/plugins/ui/twilight.nix
Normal file
32
tests/test-sources/plugins/ui/twilight.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
empty = {
|
||||
plugins.twilight.enable = true;
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins = {
|
||||
treesitter.enable = true;
|
||||
twilight = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
dimming = {
|
||||
alpha = 0.25;
|
||||
color = ["Normal" "#ffffff"];
|
||||
term_bg = "#000000";
|
||||
inactive = false;
|
||||
};
|
||||
context = 10;
|
||||
treesitter = true;
|
||||
expand = [
|
||||
"function"
|
||||
"method"
|
||||
"table"
|
||||
"if_statement"
|
||||
];
|
||||
exclude = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue