mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	feat: import and configure smartcolumn
This commit is contained in:
		
					parent
					
						
							
								d5a8587517
							
						
					
				
			
			
				commit
				
					
						a924958762
					
				
			
		
					 4 changed files with 80 additions and 0 deletions
				
			
		
							
								
								
									
										32
									
								
								modules/ui/smartcolumn/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/ui/smartcolumn/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| { | ||||
|   pkgs, | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: | ||||
| with lib; | ||||
| with builtins; let | ||||
|   cfg = config.vim.ui.smartcolumn; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim.startPlugins = [ | ||||
|       "smartcolumn" | ||||
|     ]; | ||||
| 
 | ||||
|     vim.luaConfigRC.smartcolumn = nvim.dag.entryAnywhere '' | ||||
|       require("smartcolumn").setup({ | ||||
|          colorcolumn = "${toString cfg.showColumnAt}", | ||||
|          disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} }, | ||||
|          -- { "help", "text", "markdown", "NvimTree", "alpha"}, | ||||
|          custom_colorcolumn = { | ||||
|            -- TODO: use cfg.languages.<language>.columnAt when it's fixed to dynamically define per-language length | ||||
|            ruby = "120", | ||||
|            java = "120", | ||||
|            nix = "120", | ||||
|            markdown = "80", | ||||
|          }, | ||||
|          scope = "file", | ||||
|       }) | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										6
									
								
								modules/ui/smartcolumn/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/ui/smartcolumn/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| _: { | ||||
|   imports = [ | ||||
|     ./smartcolumn.nix | ||||
|     ./config.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										41
									
								
								modules/ui/smartcolumn/smartcolumn.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								modules/ui/smartcolumn/smartcolumn.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: | ||||
| with lib; | ||||
| with builtins; let | ||||
|   languageOpts = { | ||||
|     columnAt = mkOption { | ||||
|       type = types.nullOr types.int; | ||||
|       default = 80; | ||||
|     }; | ||||
|   }; | ||||
| in { | ||||
|   options.vim.ui.smartcolumn = { | ||||
|     enable = mkEnableOption "Enable smartcolumn line length indicator"; | ||||
| 
 | ||||
|     showColumnAt = mkOption { | ||||
|       type = types.nullOr types.int; | ||||
|       default = 120; | ||||
|       description = "The position at which the column will be displayed. Set to null to disable"; | ||||
|     }; | ||||
| 
 | ||||
|     disabledFiletypes = mkOption { | ||||
|       type = types.listOf types.str; | ||||
|       default = ["help" "text" "markdown" "NvimTree" "alpha"]; | ||||
|       description = "The filetypes smartcolumn will be disabled for."; | ||||
|     }; | ||||
| 
 | ||||
|     /* | ||||
|     languages = mkOption { | ||||
|       default = {}; | ||||
|       description = "Language specific configuration."; | ||||
|       type = with types; | ||||
|         attrsOf (submodule { | ||||
|           options = attrsOf (submodule langOptions); | ||||
|         }); | ||||
|     }; | ||||
|     */ | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 NotAShelf
				NotAShelf