mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-28 11:30:06 +02:00
plugins/indent-blankline: swith to mkNeovimPlugin
This commit is contained in:
parent
83ca67566d
commit
2799e830b2
2 changed files with 157 additions and 136 deletions
|
@ -5,19 +5,49 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.indent-blankline =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "indent-blankline.nvim";
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "indent-blankline";
|
||||
originalName = "indent-blankline.nvim";
|
||||
luaName = "ibl";
|
||||
defaultPackage = pkgs.vimPlugins.indent-blankline-nvim;
|
||||
|
||||
package = helpers.mkPackageOption "indent-blankline" pkgs.vimPlugins.indent-blankline-nvim;
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
|
||||
# TODO introduced 2024-03-10: remove 2024-05-10
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"debounce"
|
||||
["viewportBuffer" "min"]
|
||||
["viewportBuffer" "max"]
|
||||
["indent" "char"]
|
||||
["indent" "tabChar"]
|
||||
["indent" "highlight"]
|
||||
["indent" "smartIndentCap"]
|
||||
["indent" "priority"]
|
||||
["whitespace" "highlight"]
|
||||
["whitespace" "removeBlanklineTrail"]
|
||||
["scope" "enabled"]
|
||||
["scope" "char"]
|
||||
["scope" "showStart"]
|
||||
["scope" "showEnd"]
|
||||
["scope" "showExactScope"]
|
||||
["scope" "injectedLanguages"]
|
||||
["scope" "highlight"]
|
||||
["scope" "priority"]
|
||||
["scope" "include" "nodeType"]
|
||||
["scope" "exclude" "language"]
|
||||
["scope" "exclude" "nodeType"]
|
||||
["exclude" "filetypes"]
|
||||
["exclude" "buftypes"]
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
debounce = helpers.defaultNullOpts.mkUnsignedInt 200 ''
|
||||
Sets the amount indent-blankline debounces refreshes in milliseconds.
|
||||
'';
|
||||
|
||||
viewportBuffer = {
|
||||
viewport_buffer = {
|
||||
min = helpers.defaultNullOpts.mkUnsignedInt 30 ''
|
||||
Minimum number of lines above and below of what is currently visible in the window for
|
||||
which indentation guides will be generated.
|
||||
|
@ -35,7 +65,7 @@ with lib; {
|
|||
Each character has to have a display width of 0 or 1.
|
||||
'';
|
||||
|
||||
tabChar = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
tab_char = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Character, or list of characters, that get used to display the indentation guide for tabs.
|
||||
Each character has to have a display width of 0 or 1.
|
||||
|
||||
|
@ -49,7 +79,7 @@ with lib; {
|
|||
Default: `|hl-IblIndent|`
|
||||
'';
|
||||
|
||||
smartIndentCap = helpers.defaultNullOpts.mkBool true ''
|
||||
smart_indent_cap = helpers.defaultNullOpts.mkBool true ''
|
||||
Caps the number of indentation levels by looking at the surrounding code.
|
||||
'';
|
||||
|
||||
|
@ -65,7 +95,7 @@ with lib; {
|
|||
Default: `|hl-IblWhitespace|`
|
||||
'';
|
||||
|
||||
removeBlanklineTrail = helpers.defaultNullOpts.mkBool true ''
|
||||
remove_blankline_trail = helpers.defaultNullOpts.mkBool true ''
|
||||
Removes trailing whitespace on blanklines.
|
||||
|
||||
Turn this off if you want to add background color to the whitespace highlight group.
|
||||
|
@ -83,21 +113,21 @@ with lib; {
|
|||
Default: `indent.char`
|
||||
'';
|
||||
|
||||
showStart = helpers.defaultNullOpts.mkBool true ''
|
||||
show_start = helpers.defaultNullOpts.mkBool true ''
|
||||
Shows an underline on the first line of the scope.
|
||||
'';
|
||||
|
||||
showEnd = helpers.defaultNullOpts.mkBool true ''
|
||||
show_end = helpers.defaultNullOpts.mkBool true ''
|
||||
Shows an underline on the last line of the scope.
|
||||
'';
|
||||
|
||||
showExactScope = helpers.defaultNullOpts.mkBool false ''
|
||||
show_exact_scope = helpers.defaultNullOpts.mkBool false ''
|
||||
Shows an underline on the first line of the scope starting at the exact start of the scope
|
||||
(even if this is to the right of the indent guide) and an underline on the last line of
|
||||
the scope ending at the exact end of the scope.
|
||||
'';
|
||||
|
||||
injectedLanguages = helpers.defaultNullOpts.mkBool true ''
|
||||
injected_languages = helpers.defaultNullOpts.mkBool true ''
|
||||
Checks for the current scope in injected treesitter languages.
|
||||
This also influences if the scope gets excluded or not.
|
||||
'';
|
||||
|
@ -113,7 +143,7 @@ with lib; {
|
|||
'';
|
||||
|
||||
include = {
|
||||
nodeType = helpers.defaultNullOpts.mkNullable (with types; attrsOf (listOf str)) "{}" ''
|
||||
node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) "{}" ''
|
||||
Map of language to a list of node types which can be used as scope.
|
||||
|
||||
- Use `*` as the language to act as a wildcard for all languages.
|
||||
|
@ -122,13 +152,12 @@ with lib; {
|
|||
};
|
||||
|
||||
exclude = {
|
||||
language = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
language = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||
List of treesitter languages for which scope is disabled.
|
||||
'';
|
||||
|
||||
nodeType =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; attrsOf (listOf str))
|
||||
node_type =
|
||||
helpers.defaultNullOpts.mkAttrsOf (with types; (listOf str))
|
||||
''
|
||||
{
|
||||
"*" = ["source_file" "program"];
|
||||
|
@ -146,8 +175,7 @@ with lib; {
|
|||
|
||||
exclude = {
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; listOf str)
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''
|
||||
[
|
||||
"lspinfo"
|
||||
|
@ -164,8 +192,7 @@ with lib; {
|
|||
"List of filetypes for which indent-blankline is disabled.";
|
||||
|
||||
buftypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; listOf str)
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''
|
||||
[
|
||||
"terminal"
|
||||
|
@ -178,65 +205,27 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.plugins.indent-blankline;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
enabled = true;
|
||||
inherit debounce;
|
||||
viewport_buffer = with viewportBuffer; {
|
||||
inherit
|
||||
min
|
||||
max
|
||||
;
|
||||
settingsExample = {
|
||||
indent = {
|
||||
char = "│";
|
||||
};
|
||||
indent = with indent; {
|
||||
inherit char;
|
||||
tab_char = tabChar;
|
||||
inherit highlight;
|
||||
smart_indent_cap = smartIndentCap;
|
||||
inherit priority;
|
||||
scope = {
|
||||
show_start = false;
|
||||
show_end = false;
|
||||
show_exact_scope = true;
|
||||
};
|
||||
whitespace = with whitespace; {
|
||||
inherit highlight;
|
||||
remove_blankline_trail = removeBlanklineTrail;
|
||||
exclude = {
|
||||
filetypes = [
|
||||
""
|
||||
"checkhealth"
|
||||
"help"
|
||||
"lspinfo"
|
||||
"packer"
|
||||
"TelescopePrompt"
|
||||
"TelescopeResults"
|
||||
"yaml"
|
||||
];
|
||||
buftypes = ["terminal" "quickfix"];
|
||||
};
|
||||
scope = with scope; {
|
||||
inherit
|
||||
enabled
|
||||
char
|
||||
;
|
||||
show_start = showStart;
|
||||
show_end = showEnd;
|
||||
show_exact_scope = showExactScope;
|
||||
injected_languages = injectedLanguages;
|
||||
inherit
|
||||
highlight
|
||||
priority
|
||||
;
|
||||
include = with include; {
|
||||
node_type = nodeType;
|
||||
};
|
||||
exclude = with exclude; {
|
||||
inherit language;
|
||||
node_type = nodeType;
|
||||
};
|
||||
};
|
||||
exclude = with exclude; {
|
||||
inherit
|
||||
filetypes
|
||||
buftypes
|
||||
;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require("ibl").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,41 +3,72 @@
|
|||
plugins.indent-blankline.enable = true;
|
||||
};
|
||||
|
||||
example = {
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
indent = {
|
||||
char = "│";
|
||||
};
|
||||
scope = {
|
||||
show_start = false;
|
||||
show_end = false;
|
||||
show_exact_scope = true;
|
||||
};
|
||||
exclude = {
|
||||
filetypes = [
|
||||
""
|
||||
"checkhealth"
|
||||
"help"
|
||||
"lspinfo"
|
||||
"packer"
|
||||
"TelescopePrompt"
|
||||
"TelescopeResults"
|
||||
"yaml"
|
||||
];
|
||||
buftypes = ["terminal" "quickfix"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
debounce = 200;
|
||||
viewportBuffer = {
|
||||
viewport_buffer = {
|
||||
min = 30;
|
||||
max = 500;
|
||||
};
|
||||
indent = {
|
||||
char = "▎";
|
||||
tabChar = null;
|
||||
tab_char = null;
|
||||
highlight = null;
|
||||
smartIndentCap = true;
|
||||
smart_indent_cap = true;
|
||||
priority = 1;
|
||||
};
|
||||
whitespace = {
|
||||
highlight = null;
|
||||
removeBlanklineTrail = true;
|
||||
remove_blankline_trail = true;
|
||||
};
|
||||
scope = {
|
||||
enabled = true;
|
||||
char = null;
|
||||
showStart = true;
|
||||
showEnd = true;
|
||||
showExactScope = false;
|
||||
injectedLanguages = true;
|
||||
show_start = true;
|
||||
show_end = true;
|
||||
show_exact_scope = false;
|
||||
injected_languages = true;
|
||||
highlight = null;
|
||||
priority = 1024;
|
||||
include = {
|
||||
nodeType = {};
|
||||
node_type = {};
|
||||
};
|
||||
exclude = {
|
||||
language = [];
|
||||
nodeType = {
|
||||
node_type = {
|
||||
"*" = ["source_file" "program"];
|
||||
lua = ["chunk"];
|
||||
python = ["module"];
|
||||
|
@ -65,4 +96,5 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue