From ad95175224d95f937a796afa1435b64751bea698 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:17:36 +0300 Subject: [PATCH] feat(visuals): Update and configurations --- extra.nix | 4 ++-- modules/visuals/config.nix | 10 +++++---- modules/visuals/visuals.nix | 45 +++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/extra.nix b/extra.nix index 3828409..e73face 100644 --- a/extra.nix +++ b/extra.nix @@ -68,8 +68,8 @@ inputs: let fidget-nvim.enable = true; indentBlankline = { enable = true; - fillChar = ""; - eolChar = ""; + fillChar = null; + eolChar = null; showCurrContext = true; }; cursorWordline = { diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index d1dd0ec..7137d70 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -14,17 +14,19 @@ in { vim.wo.colorcolumn = "99999" vim.opt.list = true - ${optionalString (cfg.indentBlankline.eolChar != "") '' + ${optionalString (cfg.indentBlankline.eolChar != null) '' vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" }) ''} - ${optionalString (cfg.indentBlankline.fillChar != "") '' - vim.opt.listchars:append({ eol = "${cfg.indentBlankline.fillChar}" }) + ${optionalString (cfg.indentBlankline.fillChar != null) '' + vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}" }) ''} require("indent_blankline").setup { + enabled = true, char = "${cfg.indentBlankline.listChar}", show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, - show_end_of_line = true, + show_end_of_line = ${boolToString cfg.indentBlankline.showEndOfLine}, + use_treesitter = ${boolToString cfg.indentBlankline.useTreesitter}, } ''; }) diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 695e3b6..b1794c1 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -6,17 +6,9 @@ with lib; with builtins; { options.vim.visuals = { - enable = mkOption { - type = types.bool; - description = "Enable visual enhancements"; - default = false; - }; + enable = mkEnableOption "Visual enhancements."; - nvimWebDevicons.enable = mkOption { - type = types.bool; - description = "Enable dev icons. required for certain plugins [nvim-web-devicons]"; - default = false; - }; + nvimWebDevicons.enable = mkEnableOption "dev icons. Required for certain plugins [nvim-web-devicons]."; scrollBar.enable = mkOption { type = types.bool; @@ -58,15 +50,12 @@ with builtins; { }; cursorWordline = { - enable = mkOption { - type = types.bool; - description = "Enable word and delayed line highlight [nvim-cursorline]"; - default = false; - }; + enable = mkEnableOption "word and delayed line highlight [nvim-cursorline]."; lineTimeout = mkOption { type = types.int; description = "Time in milliseconds for cursorline to appear"; + default = 500; }; }; @@ -84,21 +73,39 @@ with builtins; { }; fillChar = mkOption { - type = types.str; description = "Character to fill indents"; + type = with types; nullOr types.str; default = "⋅"; }; eolChar = mkOption { - type = types.str; description = "Character at end of line"; + type = with types; nullOr types.str; default = "↴"; }; - showCurrContext = mkOption { + showEndOfLine = mkOption { + description = nvim.nmd.asciiDoc '' + Displays the end of line character set by <> 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"; - default = true; + 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"; }; }; };