From 0067d446951229ff1206d51ca5a7a4cd39a6a8be Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 14 Oct 2023 14:04:48 +0300 Subject: [PATCH 1/4] modules/visuals: update indent-blankline to v3 --- configuration.nix | 4 +- flake.lock | 6 +-- modules/visuals/config.nix | 20 +++++++--- modules/visuals/visuals.nix | 74 ++++++++++++++++++++++++++----------- 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/configuration.nix b/configuration.nix index 0864fed..6c2cb26 100644 --- a/configuration.nix +++ b/configuration.nix @@ -89,7 +89,9 @@ inputs: let enable = true; fillChar = null; eolChar = null; - showCurrContext = true; + scope = { + showCurrContext = true; + }; }; cursorline = { diff --git a/flake.lock b/flake.lock index da9a8ff..ec3057f 100644 --- a/flake.lock +++ b/flake.lock @@ -584,11 +584,11 @@ "indent-blankline": { "flake": false, "locked": { - "lastModified": 1688727830, - "narHash": "sha256-efMRkxjbr6o7kSKAEn0Kaw8lsDubRmc1N0Kd1BZ3A7k=", + "lastModified": 1697081010, + "narHash": "sha256-e8gn4pJYALaQ6sGA66SFf8p6VLJBPxT/BimQhOd5eBs=", "owner": "lukas-reineke", "repo": "indent-blankline.nvim", - "rev": "4541d690816cb99a7fc248f1486aa87f3abce91c", + "rev": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572", "type": "github" }, "original": { diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 5cdd4f4..17ed23e 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -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) '' @@ -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.showCurrContext}, + show_end = ${boolToString cfg.indentBlankline.scope.showEndOfLine} + }, } ''; }) diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 97ace23..fe1e0f8 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -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" "showCurrContext"]) + (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."; @@ -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; @@ -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"; - }; + scope = { + 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"; - }; - - useTreesitter = mkOption { - description = "Use treesitter to calculate indentation when possible."; - type = types.bool; - default = config.vim.treesitter.enable; - defaultText = literalExpression "config.vim.treesitter.enable"; + showCurrContext = mkOption { + description = "Highlight current context from treesitter"; + type = types.bool; + default = config.vim.treesitter.enable; + defaultText = literalExpression "config.vim.treesitter.enable"; + }; }; }; From 39e9e603865777c99fbfdef97e9b2be96fdfb159 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 16 Nov 2023 12:21:43 +0300 Subject: [PATCH 2/4] docs: update changelog --- docs/release-notes/rl-0.5.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index bc0dde9..e3d52aa 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -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]: From 4453d5c9dd3e759120804f5ae0a5aa3cfb756f8d Mon Sep 17 00:00:00 2001 From: Frothy <76622149+FrothyMarrow@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:05:19 +0300 Subject: [PATCH 3/4] visuals/indent-blankline: rename scope.showCurrContext to scope.enabled --- configuration.nix | 2 +- modules/visuals/config.nix | 2 +- modules/visuals/visuals.nix | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configuration.nix b/configuration.nix index 6c2cb26..f45cb0a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -90,7 +90,7 @@ inputs: let fillChar = null; eolChar = null; scope = { - showCurrContext = true; + enabled = true; }; }; diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 17ed23e..7e4a83b 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -33,7 +33,7 @@ in { }, scope = { - enabled = ${boolToString cfg.indentBlankline.scope.showCurrContext}, + enabled = ${boolToString cfg.indentBlankline.scope.enabled}, show_end = ${boolToString cfg.indentBlankline.scope.showEndOfLine} }, } diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index fe1e0f8..08dc1c3 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -8,7 +8,7 @@ cfg = config.vim.visuals; in { imports = [ - (mkRenamedOptionModule ["vim" "visuals" "indentBlankline" "showCurrContext"] ["vim" "visuals" "indentBlankline" "scope" "showCurrContext"]) + (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.") ]; @@ -115,6 +115,13 @@ in { }; scope = { + enabled = mkOption { + description = "Highlight current scope from treesitter"; + 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 @@ -124,13 +131,6 @@ in { 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"; - }; }; }; From 663a6123b63e885cc4940363524ca067d4e6b680 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 24 Nov 2023 12:07:19 +0300 Subject: [PATCH 4/4] flake: update catppuccin required to comply with highlighter changes in ibl v3 --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index ec3057f..939a9b5 100644 --- a/flake.lock +++ b/flake.lock @@ -35,11 +35,11 @@ "catppuccin": { "flake": false, "locked": { - "lastModified": 1690630440, - "narHash": "sha256-MSZcIrV3vvgb5mlMpO5uRlAYoENm2pZyuZbV5Q9Vg58=", + "lastModified": 1700667946, + "narHash": "sha256-TBOaD7A8/c/sg78C1hUpPDuIrrQkSUQR1KgHiDb6jxs=", "owner": "catppuccin", "repo": "nvim", - "rev": "057c34f849cf21059487d849e2f3b3efcd4ee0eb", + "rev": "a2107df4379d66e72a36a89792603151cebec1bf", "type": "github" }, "original": {