mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	formatter/conform-nvim: init
This commit is contained in:
		
					parent
					
						
							
								021f2531cc
							
						
					
				
			
			
				commit
				
					
						5554c867ee
					
				
			
		
					 4 changed files with 85 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								modules/plugins/formatter/conform-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								modules/plugins/formatter/conform-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.lua) toLuaObject; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.formatter.conform-nvim; | ||||||
|  | in { | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     vim = { | ||||||
|  |       startPlugins = ["conform-nvim"]; | ||||||
|  |       pluginRC.conform-nvim = entryAnywhere '' | ||||||
|  |         require("conform").setup(${toLuaObject cfg.setupOpts}) | ||||||
|  |       ''; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										56
									
								
								modules/plugins/formatter/conform-nvim/conform-nvim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								modules/plugins/formatter/conform-nvim/conform-nvim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | ||||||
|  | { | ||||||
|  |   pkgs, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.options) mkOption mkEnableOption literalExpression; | ||||||
|  |   inherit (lib.types) attrs enum; | ||||||
|  |   inherit (lib.nvim.types) mkPluginSetupOption; | ||||||
|  |   inherit (lib.nvim.lua) mkLuaInline; | ||||||
|  | in { | ||||||
|  |   options.vim.formatter.conform-nvim = { | ||||||
|  |     enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]"; | ||||||
|  |     setupOpts = mkPluginSetupOption "conform.nvim" { | ||||||
|  |       formatters_by_ft = mkOption { | ||||||
|  |         type = attrs; | ||||||
|  |         default = {}; | ||||||
|  |         example = {lua = ["stylua"];}; | ||||||
|  |         description = '' | ||||||
|  |           Map of filetype to formatters. This option takes a set of | ||||||
|  |           `key = value` format where the `value will` be converted | ||||||
|  |           to its Lua equivalent. You are responsible for passing the | ||||||
|  |           correct Nix data types to generate a correct Lua value that | ||||||
|  |           conform is able to accept. | ||||||
|  |         ''; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       default_format_opts = mkOption { | ||||||
|  |         type = attrs; | ||||||
|  |         default = {lsp_format = "fallback";}; | ||||||
|  |         description = "Default values when calling `conform.format()`"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       format_on_save = mkOption { | ||||||
|  |         type = attrs; | ||||||
|  |         default = { | ||||||
|  |           lsp_format = "fallback"; | ||||||
|  |           timeout_ms = 500; | ||||||
|  |         }; | ||||||
|  |         description = '' | ||||||
|  |           Table that will be passed to `conform.format()`. If this | ||||||
|  |           is set, Conform will run the formatter on save. | ||||||
|  |         ''; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       format_after_save = mkOption { | ||||||
|  |         type = attrs; | ||||||
|  |         default = {lsp_format = "fallback";}; | ||||||
|  |         description = '' | ||||||
|  |           Table that will be passed to `conform.format()`. If this | ||||||
|  |           is set, Conform will run the formatter asynchronously after | ||||||
|  |           save. | ||||||
|  |         ''; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								modules/plugins/formatter/conform-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/formatter/conform-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     ./conform-nvim.nix | ||||||
|  |     ./config.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								modules/plugins/formatter/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								modules/plugins/formatter/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | { | ||||||
|  |   imports = [./conform-nvim]; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gerg-L
					Gerg-L