mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	colorizer: fix nonsense options
This commit is contained in:
		
					parent
					
						
							
								5b982fafa0
							
						
					
				
			
			
				commit
				
					
						2c37513012
					
				
			
		
					 2 changed files with 35 additions and 85 deletions
				
			
		|  | @ -4,100 +4,50 @@ | |||
|   ... | ||||
| }: let | ||||
|   inherit (lib.options) mkOption mkEnableOption; | ||||
|   inherit (lib.types) attrsOf attrs bool enum; | ||||
|   inherit (lib.types) attrsOf enum nullOr submodule; | ||||
|   inherit (lib.modules) mkRenamedOptionModule; | ||||
|   inherit (lib.nvim.types) mkPluginSetupOption; | ||||
|   inherit (lib.nvim.config) mkBool; | ||||
| 
 | ||||
|   settingSubmodule = submodule { | ||||
|     options = { | ||||
|       RGB = mkBool true "Colorize #RGB hex codes"; | ||||
|       RRGGBB = mkBool true "Colorize #RRGGBB hex codes"; | ||||
|       names = mkBool true ''Colorize "Name" codes like Blue''; | ||||
|       RRGGBBAA = mkBool false "Colorize #RRGGBBAA hex codes"; | ||||
|       rgb_fn = mkBool false "Colorize CSS rgb() and rgba() functions"; | ||||
|       hsl_fn = mkBool false "Colorize CSS hsl() and hsla() functions"; | ||||
|       css = mkBool false "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; | ||||
|       css_fn = mkBool false "Enable all CSS *functions*: rgb_fn, hsl_fn"; | ||||
|       mode = mkOption { | ||||
|         description = "Set the display mode"; | ||||
|         type = nullOr (enum ["foreground" "background"]); | ||||
|         default = null; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| in { | ||||
|   imports = [ | ||||
|     (mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "user_default_options"]) | ||||
|     (mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "defaultOptions"]) | ||||
|     (mkRenamedOptionModule ["vim" "ui" "colorizer" "filetypes"] ["vim" "ui" "colorizer" "setupOpts" "filetypes"]) | ||||
|   ]; | ||||
| 
 | ||||
|   options.vim.ui.colorizer = { | ||||
|     enable = mkEnableOption "color highlighting [nvim-colorizer.lua]"; | ||||
| 
 | ||||
|     setupOpts = mkPluginSetupOption "nvim-colorizer" { | ||||
|       filetypes = mkOption { | ||||
|         type = attrsOf attrs; | ||||
|         default = { | ||||
|           css = {}; | ||||
|           scss = {}; | ||||
|         }; | ||||
|         description = "Filetypes to highlight on"; | ||||
|     defaultOptions = mkOption { | ||||
|       description = '' | ||||
|         Default options that apply to all filetypes. Filetype specific settings from | ||||
|         [filetypeSettings](#opt-vim.ui.colorizer.filetypeSettings) take precedence. | ||||
|       ''; | ||||
|       default = {}; | ||||
|       type = settingSubmodule; | ||||
|     }; | ||||
| 
 | ||||
|       user_default_options = { | ||||
|         rgb = mkOption { | ||||
|           type = bool; | ||||
|           default = true; | ||||
|           description = "#RGB hex codes"; | ||||
|         }; | ||||
| 
 | ||||
|         rrggbb = mkOption { | ||||
|           type = bool; | ||||
|           default = true; | ||||
|           description = "#RRGGBB hex codes"; | ||||
|         }; | ||||
| 
 | ||||
|         names = mkOption { | ||||
|           type = bool; | ||||
|           default = true; | ||||
|           description = ''"Name" codes such as "Blue"''; | ||||
|         }; | ||||
| 
 | ||||
|         rgb_fn = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "CSS rgb() and rgba() functions"; | ||||
|         }; | ||||
| 
 | ||||
|         rrggbbaa = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "#RRGGBBAA hex codes"; | ||||
|         }; | ||||
| 
 | ||||
|         hsl_fn = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "CSS hsl() and hsla() functions"; | ||||
|         }; | ||||
| 
 | ||||
|         css = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; | ||||
|         }; | ||||
| 
 | ||||
|         css_fn = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "Enable all CSS *functions*: rgb_fn, hsl_fn"; | ||||
|         }; | ||||
| 
 | ||||
|         mode = mkOption { | ||||
|           type = enum ["foreground" "background"]; | ||||
|           default = "background"; | ||||
|           description = "Set the display mode"; | ||||
|         }; | ||||
| 
 | ||||
|         tailwind = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "Enable tailwind colors"; | ||||
|         }; | ||||
| 
 | ||||
|         sass = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "Enable sass colors"; | ||||
|         }; | ||||
| 
 | ||||
|         alwaysUpdate = mkOption { | ||||
|           type = bool; | ||||
|           default = false; | ||||
|           description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs"; | ||||
|         }; | ||||
|     filetypeOptions = mkOption { | ||||
|       description = "Filetype specific settings"; | ||||
|       default = {}; | ||||
|       type = submodule { | ||||
|         freeformType = attrsOf settingSubmodule; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ in { | |||
|     ]; | ||||
| 
 | ||||
|     vim.luaConfigRC.colorizer = entryAnywhere '' | ||||
|       require('colorizer').setup(${toLuaObject cfg.setupOpts}) | ||||
|       require('colorizer').setup(${toLuaObject cfg.filetypeOptions}, ${toLuaObject cfg.defaultOptions}) | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pei Yang Ching
				Pei Yang Ching