mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 19:12:38 +00:00 
			
		
		
		
	plugins/visuals(indent-blankline): move to setupOpts (#329)
* plugins/visuals(indent-blankline): move to setupOpts * configuration: match indentblankline part with changes
This commit is contained in:
		
					parent
					
						
							
								901363d1ac
							
						
					
				
			
			
				commit
				
					
						32d231395f
					
				
			
		
					 6 changed files with 188 additions and 103 deletions
				
			
		|  | @ -82,14 +82,7 @@ isMaximal: { | |||
|       fidget-nvim.enable = true; | ||||
|       highlight-undo.enable = true; | ||||
| 
 | ||||
|       indentBlankline = { | ||||
|         enable = true; | ||||
|         fillChar = null; | ||||
|         eolChar = null; | ||||
|         scope = { | ||||
|           enabled = true; | ||||
|         }; | ||||
|       }; | ||||
|       indentBlankline.enable = true; | ||||
| 
 | ||||
|       cursorline = { | ||||
|         enable = true; | ||||
|  |  | |||
|  | @ -52,6 +52,11 @@ Release notes for release 0.7 | |||
| 
 | ||||
| - Expose `lib.nvim.types.pluginType`, which for example allows the user to create abstractions for adding plugins | ||||
| 
 | ||||
| - Migrate indent-blankline to setupOpts for more customizability. While the plugin's options can now be found under `indentBlankline.setupOpts`, the previous iteration of the module also included out of place/broken options, which have been removed for the time being. These are: | ||||
|   - `listChar` - this was already unused | ||||
|   - `fillChar` - this had nothing to do with the plugin, please configure it yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your lua configuration | ||||
|   - `eolChar`  - this also had nothing to do with the plugin, please configure it yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your lua configuration | ||||
| 
 | ||||
| [NotAShelf](https://github.com/notashelf): | ||||
| 
 | ||||
| - Add `deno fmt` as the default Markdown formatter. This will be enabled | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| {lib}: let | ||||
|   inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption; | ||||
|   inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType; | ||||
|   inherit (lib.types) anything attrsOf; | ||||
|   inherit (lib.nvim.types) anythingConcatLists; | ||||
|   inherit (builtins) typeOf isAttrs any head concatLists; | ||||
|   inherit (builtins) typeOf isAttrs any head concatLists stringLength; | ||||
| in { | ||||
|   # HACK: Does this break anything in our case? | ||||
|   # A modified version of the nixpkgs anything type that concatenates lists | ||||
|  | @ -50,4 +50,12 @@ in { | |||
|         # otherwise only allow equal values | ||||
|         (mergeFunctions.${commonType} or mergeEqualOption) loc defs; | ||||
|     }; | ||||
| 
 | ||||
|   char = mkOptionType { | ||||
|     name = "char"; | ||||
|     description = "character"; | ||||
|     descriptionClass = "noun"; | ||||
|     check = value: stringLength value < 2; | ||||
|     merge = mergeEqualOption; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -11,5 +11,5 @@ in { | |||
|   inherit (typesDag) dagOf; | ||||
|   inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType; | ||||
|   inherit (typesLanguage) diagnostics mkGrammarOption; | ||||
|   inherit (typesCustom) anythingConcatLists; | ||||
|   inherit (typesCustom) anythingConcatLists char; | ||||
| } | ||||
|  |  | |||
|  | @ -4,10 +4,10 @@ | |||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf mkMerge; | ||||
|   inherit (lib.strings) optionalString; | ||||
|   inherit (lib.trivial) boolToString; | ||||
|   inherit (lib.nvim.binds) mkBinding; | ||||
|   inherit (lib.nvim.dag) entryAnywhere; | ||||
|   inherit (lib.nvim.lua) toLuaObject; | ||||
| 
 | ||||
|   cfg = config.vim.visuals; | ||||
| in { | ||||
|  | @ -15,32 +15,7 @@ in { | |||
|     (mkIf cfg.indentBlankline.enable { | ||||
|       vim.startPlugins = ["indent-blankline"]; | ||||
|       vim.luaConfigRC.indent-blankline = entryAnywhere '' | ||||
|         -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 | ||||
|         -- vim.wo.colorcolumn = "99999" | ||||
|         vim.opt.list = true | ||||
| 
 | ||||
|         ${optionalString (cfg.indentBlankline.eolChar != null) '' | ||||
|           vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" }) | ||||
|         ''} | ||||
|         ${optionalString (cfg.indentBlankline.fillChar != null) '' | ||||
|           vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}" }) | ||||
|         ''} | ||||
| 
 | ||||
|         require("ibl").setup { | ||||
|           enabled = true, | ||||
|           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} | ||||
|           }, | ||||
|         } | ||||
|         require("ibl").setup(${toLuaObject cfg.indentBlankline.setupOpts}) | ||||
|       ''; | ||||
|     }) | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,19 +3,12 @@ | |||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule; | ||||
|   inherit (lib.options) mkEnableOption mkOption literalExpression; | ||||
|   inherit (lib.types) int bool str nullOr; | ||||
|   inherit (lib.types) int bool str nullOr either listOf attrsOf; | ||||
|   inherit (lib.nvim.binds) mkMappingOption; | ||||
| 
 | ||||
|   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."; | ||||
| 
 | ||||
|  | @ -51,70 +44,181 @@ in { | |||
| 
 | ||||
|     indentBlankline = { | ||||
|       enable = mkEnableOption "indentation guides [indent-blankline]"; | ||||
|       debounce = mkOption { | ||||
|         type = int; | ||||
|         description = "Debounce time in milliseconds"; | ||||
|         default = 200; | ||||
|       }; | ||||
| 
 | ||||
|       viewportBuffer = { | ||||
|         min = mkOption { | ||||
|       setupOpts = { | ||||
|         debounce = mkOption { | ||||
|           type = int; | ||||
|           description = "Number of lines above and below of what is currently | ||||
|           description = "Debounce time in milliseconds"; | ||||
|           default = 200; | ||||
|         }; | ||||
| 
 | ||||
|         viewport_buffer = { | ||||
|           min = mkOption { | ||||
|             type = int; | ||||
|             description = "Number of lines above and below of what is currently | ||||
|             visible in the window"; | ||||
|           default = 30; | ||||
|         }; | ||||
|             default = 30; | ||||
|           }; | ||||
| 
 | ||||
|         max = mkOption { | ||||
|           type = int; | ||||
|           description = "Number of lines above and below of what is currently | ||||
|           max = mkOption { | ||||
|             type = int; | ||||
|             description = "Number of lines above and below of what is currently | ||||
|             visible in the window"; | ||||
|           default = 500; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       indent = { | ||||
|         char = mkOption { | ||||
|           type = str; | ||||
|           description = "Character for indentation line"; | ||||
|           default = "│"; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       listChar = mkOption { | ||||
|         type = str; | ||||
|         description = "Character for indentation line"; | ||||
|         default = "│"; | ||||
|       }; | ||||
| 
 | ||||
|       fillChar = mkOption { | ||||
|         description = "Character to fill indents"; | ||||
|         type = nullOr str; | ||||
|         default = "⋅"; | ||||
|       }; | ||||
| 
 | ||||
|       eolChar = mkOption { | ||||
|         description = "Character at end of line"; | ||||
|         type = nullOr str; | ||||
|         default = "↴"; | ||||
|       }; | ||||
| 
 | ||||
|       scope = { | ||||
|         enabled = mkOption { | ||||
|           description = "Highlight current scope from treesitter"; | ||||
|           type = bool; | ||||
|           default = config.vim.treesitter.enable; | ||||
|           defaultText = literalExpression "config.vim.treesitter.enable"; | ||||
|             default = 500; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|         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 = bool; | ||||
|           default = cfg.indentBlankline.eolChar != null; | ||||
|           defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null"; | ||||
|         indent = { | ||||
|           char = mkOption { | ||||
|             type = either str (listOf str); | ||||
|             description = "Character(s) for indentation guide"; | ||||
|             default = "│"; | ||||
|           }; | ||||
| 
 | ||||
|           tab_char = mkOption { | ||||
|             type = nullOr (either str (listOf str)); | ||||
|             description = '' | ||||
|               Character(s) for tab indentation guide. | ||||
| 
 | ||||
|               See `:help ibl.config.indent.tab_char`. | ||||
|             ''; | ||||
|             default = null; | ||||
|           }; | ||||
| 
 | ||||
|           highlight = mkOption { | ||||
|             type = nullOr (either str (listOf str)); | ||||
|             description = '' | ||||
|               The highlight group(s) applied to the indentation guide. | ||||
| 
 | ||||
|               See `:help ibl.config.indent.highlight`. | ||||
|             ''; | ||||
|             default = null; | ||||
|           }; | ||||
| 
 | ||||
|           smart_indent_cap = mkOption { | ||||
|             type = bool; | ||||
|             description = "Caps the number of indentation levels based on surrounding code"; | ||||
|             default = true; | ||||
|           }; | ||||
| 
 | ||||
|           priority = mkOption { | ||||
|             type = int; | ||||
|             description = "Virtual text priority for the indentation guide"; | ||||
|             default = 1; | ||||
|           }; | ||||
| 
 | ||||
|           repeat_linebreak = mkOption { | ||||
|             type = bool; | ||||
|             description = "Repeat indentation guides on wrapped lines"; | ||||
|             default = true; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|         whitespace = { | ||||
|           highlight = mkOption { | ||||
|             type = nullOr (either str (listOf str)); | ||||
|             description = '' | ||||
|               The highlight group(s) applied to whitespace. | ||||
| 
 | ||||
|               See `:help ibl.config.whitespace.highlight`. | ||||
|             ''; | ||||
|             default = null; | ||||
|           }; | ||||
| 
 | ||||
|           remove_blankline_trail = mkOption { | ||||
|             type = bool; | ||||
|             description = "Remove trailing whitespace on blanklines"; | ||||
|             default = true; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|         scope = { | ||||
|           enabled = mkOption { | ||||
|             description = "Highlight current scope from treesitter"; | ||||
|             type = bool; | ||||
|             default = config.vim.treesitter.enable; | ||||
|             defaultText = literalExpression "config.vim.treesitter.enable"; | ||||
|           }; | ||||
| 
 | ||||
|           char = mkOption { | ||||
|             type = either str (listOf str); | ||||
|             description = "The character(s) for the scope indentation guide"; | ||||
|             default = cfg.indentBlankline.setupOpts.indent.char; | ||||
|             defaultText = literalExpression "config.vim.visuals.indentBlankline.setuopOpts.indent.char"; | ||||
|           }; | ||||
| 
 | ||||
|           show_start = mkOption { | ||||
|             type = bool; | ||||
|             description = "Show an underline on the first line of the scope"; | ||||
|             default = false; | ||||
|           }; | ||||
| 
 | ||||
|           show_end = mkOption { | ||||
|             type = bool; | ||||
|             description = "Show an underline on the last line of the scope"; | ||||
|             default = false; | ||||
|           }; | ||||
| 
 | ||||
|           show_exact_scope = mkOption { | ||||
|             type = bool; | ||||
|             description = "Show the scope underline at the exact start of the scope, even if that's to the right of the indentation guide"; | ||||
|             default = false; | ||||
|           }; | ||||
| 
 | ||||
|           injected_languages = mkOption { | ||||
|             type = bool; | ||||
|             description = "Check for injected languages (treesitter)"; | ||||
|             default = config.vim.treesitter.enable; | ||||
|             defaultText = literalExpression "config.vim.treesitter.enable"; | ||||
|           }; | ||||
| 
 | ||||
|           highlight = mkOption { | ||||
|             type = nullOr (either str (listOf str)); | ||||
|             description = '' | ||||
|               The highlight group(s) applied to the scope. | ||||
| 
 | ||||
|               See `:help `ibl.config.scope.highlight`. | ||||
|             ''; | ||||
|             default = null; | ||||
|           }; | ||||
| 
 | ||||
|           priority = mkOption { | ||||
|             type = int; | ||||
|             description = "Virtual text priority for the scope"; | ||||
|             default = 1024; | ||||
|           }; | ||||
| 
 | ||||
|           include.node_type = mkOption { | ||||
|             type = attrsOf (listOf str); | ||||
|             description = "Additional nodes to be used for scope checking, per language"; | ||||
|             default = {}; | ||||
|           }; | ||||
| 
 | ||||
|           exclude = { | ||||
|             language = mkOption { | ||||
|               type = listOf str; | ||||
|               description = '' | ||||
|                 The list of treesitter languages to disable scope for. | ||||
| 
 | ||||
|                 `*` can be used as a wildcard for every language/node type. | ||||
|               ''; | ||||
|               default = []; | ||||
|             }; | ||||
| 
 | ||||
|             node_type = mkOption { | ||||
|               type = attrsOf (listOf str); | ||||
|               description = '' | ||||
|                 Nodes to ignore in scope checking, per language. | ||||
| 
 | ||||
|                 `*` can be used as a wildcard for every language. | ||||
|               ''; | ||||
|               default = { | ||||
|                 "*" = ["source_file" "program"]; | ||||
|                 lua = ["chunk"]; | ||||
|                 python = ["module"]; | ||||
|               }; | ||||
|             }; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 diniamo
				diniamo