Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/visuals: update indent-blankline to v3 #154

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ inputs: let
enable = true;
fillChar = null;
eolChar = null;
showCurrContext = true;
scope = {
enabled = true;
};
};

cursorline = {
Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/rl-0.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ https://github.com/notashelf[notashelf]:
To quote home-manager commit: "Output is mostly unchanged aside from some minor typographical and
formatting changes, along with better source links."

* Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`


https://github.com/jacekpoz[jacekpoz]:

Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions modules/visuals/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ in {
vim.startPlugins = ["indent-blankline"];
vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere ''
-- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
vim.wo.colorcolumn = "99999"
-- vim.wo.colorcolumn = "99999"
vim.opt.list = true

${optionalString (cfg.indentBlankline.eolChar != null) ''
Expand All @@ -22,12 +22,20 @@ in {
vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}" })
''}

require("indent_blankline").setup {
require("ibl").setup {
enabled = true,
char = "${cfg.indentBlankline.listChar}",
show_current_context = ${boolToString cfg.indentBlankline.showCurrContext},
show_end_of_line = ${boolToString cfg.indentBlankline.showEndOfLine},
use_treesitter = ${boolToString cfg.indentBlankline.useTreesitter},
debounce = ${toString cfg.indentBlankline.debounce},
indent = { char = "${cfg.indentBlankline.indent.char}" },

viewport_buffer = {
min = ${toString cfg.indentBlankline.viewportBuffer.min},
max = ${toString cfg.indentBlankline.viewportBuffer.max},
},

scope = {
enabled = ${boolToString cfg.indentBlankline.scope.enabled},
show_end = ${boolToString cfg.indentBlankline.scope.showEndOfLine}
},
}
'';
})
Expand Down
74 changes: 52 additions & 22 deletions modules/visuals/visuals.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
lib,
...
}: let
inherit (lib) mkEnableOption mkMappingOption mkOption types literalExpression;
inherit (lib) mkEnableOption mkMappingOption mkOption types literalExpression mkRenamedOptionModule mkRemovedOptionModule;

cfg = config.vim.visuals;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "indentBlankline" "showCurrContext"] ["vim" "visuals" "indentBlankline" "scope" "enabled"])
(mkRenamedOptionModule ["vim" "visuals" "indentBlankline" "showEndOfLine"] ["vim" "visuals" "indentBlankline" "scope" "showEndOfLine"])
(mkRemovedOptionModule ["vim" "visuals" "indentBlankline" "useTreesitter"] "`vim.visuals.indentBlankline.useTreesitter` has been removed upstream and can safely be removed from your configuration.")
];

options.vim.visuals = {
enable = mkEnableOption "Visual enhancements.";

Expand Down Expand Up @@ -60,6 +66,35 @@ in {

indentBlankline = {
enable = mkEnableOption "indentation guides [indent-blankline]";
debounce = mkOption {
type = types.int;
description = "Debounce time in milliseconds";
default = 200;
};

viewportBuffer = {
min = mkOption {
type = types.int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 30;
};

max = mkOption {
type = types.int;
description = "Number of lines above and below of what is currently
visible in the window";
default = 500;
};
};

indent = {
char = mkOption {
type = types.str;
description = "Character for indentation line";
default = "│";
};
};

listChar = mkOption {
type = types.str;
Expand All @@ -79,28 +114,23 @@ in {
default = "↴";
};

showEndOfLine = mkOption {
description = ''
Displays the end of line character set by [](#opt-vim.visuals.indentBlankline.eolChar) instead of the
indent guide on line returns.
'';
type = types.bool;
default = cfg.indentBlankline.eolChar != null;
defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null";
};

showCurrContext = mkOption {
description = "Highlight current context from treesitter";
type = types.bool;
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};
scope = {
enabled = mkOption {
description = "Highlight current scope from treesitter";
type = types.bool;
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
};

useTreesitter = mkOption {
description = "Use treesitter to calculate indentation when possible.";
type = types.bool;
default = config.vim.treesitter.enable;
defaultText = literalExpression "config.vim.treesitter.enable";
showEndOfLine = mkOption {
description = ''
Displays the end of line character set by [](#opt-vim.visuals.indentBlankline.eolChar) instead of the
indent guide on line returns.
'';
type = types.bool;
default = cfg.indentBlankline.eolChar != null;
defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null";
};
};
};

Expand Down
Loading