mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	feat: move html into languages
This commit is contained in:
		
					parent
					
						
							
								1829e321b5
							
						
					
				
			
			
				commit
				
					
						7355debede
					
				
			
		
					 6 changed files with 51 additions and 9 deletions
				
			
		|  | @ -19,6 +19,7 @@ in { | |||
|     ./sql.nix | ||||
|     ./ts.nix | ||||
|     ./zig.nix | ||||
|     ./html.nix | ||||
|   ]; | ||||
| 
 | ||||
|   options.vim.languages = { | ||||
|  |  | |||
							
								
								
									
										42
									
								
								modules/languages/html.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								modules/languages/html.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| { | ||||
|   pkgs, | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: | ||||
| with lib; | ||||
| with builtins; let | ||||
|   cfg = config.vim.languages.html; | ||||
| in { | ||||
|   options.vim.languages.html = { | ||||
|     enable = mkEnableOption "HTML language support"; | ||||
| 
 | ||||
|     treesitter = { | ||||
|       enable = mkOption { | ||||
|         description = "Enable HTML treesitter"; | ||||
|         type = types.bool; | ||||
|         default = config.vim.languages.enableTreesitter; | ||||
|       }; | ||||
|       package = nvim.types.mkGrammarOption pkgs "html"; | ||||
| 
 | ||||
|       autotagHtml = mkOption { | ||||
|         description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)"; | ||||
|         type = types.bool; | ||||
|         default = true; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable (mkMerge [ | ||||
|     (mkIf cfg.treesitter.enable { | ||||
|       vim.treesitter.enable = true; | ||||
|       vim.treesitter.grammars = [cfg.treesitter.package]; | ||||
| 
 | ||||
|       vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag"; | ||||
| 
 | ||||
|       vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere '' | ||||
|         require('nvim-ts-autotag').setup() | ||||
|       ''); | ||||
|     }) | ||||
|   ]); | ||||
| } | ||||
|  | @ -1,4 +1,4 @@ | |||
| {...}: { | ||||
| _: { | ||||
|   imports = [ | ||||
|     # nvim lsp support | ||||
|     ./config.nix | ||||
|  |  | |||
|  | @ -12,7 +12,6 @@ in { | |||
|   config = mkIf cfg.enable { | ||||
|     vim.startPlugins = | ||||
|       ["nvim-treesitter"] | ||||
|       ++ optional cfg.autotagHtml "nvim-ts-autotag" | ||||
|       ++ optional usingNvimCmp "cmp-treesitter"; | ||||
| 
 | ||||
|     vim.autocomplete.sources = ["treesitter"]; | ||||
|  | @ -43,12 +42,6 @@ in { | |||
|             node_decremental = "grm", | ||||
|           }, | ||||
|         }, | ||||
| 
 | ||||
|       ${optionalString cfg.autotagHtml '' | ||||
|         autotag = { | ||||
|           enable = true, | ||||
|         }, | ||||
|       ''} | ||||
|       } | ||||
|     ''; | ||||
|   }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 NotAShelf
				NotAShelf