mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	language/markdown: moved glow and markdown-preview to utlity/preview
This commit is contained in:
		
					parent
					
						
							
								7352558623
							
						
					
				
			
			
				commit
				
					
						319aaca06d
					
				
			
		
					 11 changed files with 145 additions and 104 deletions
				
			
		
							
								
								
									
										26
									
								
								modules/utility/preview/markdown-preview/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								modules/utility/preview/markdown-preview/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| { | ||||
|   pkgs, | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib) nvim mkIf mkMerge concatMapStringsSep; | ||||
|   inherit (nvim.vim) mkVimBool; | ||||
| 
 | ||||
|   cfg = config.vim.utility.preview.markdownPreview; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim.startPlugins = [pkgs.vimPlugins.markdown-preview-nvim]; | ||||
| 
 | ||||
|     vim.configRC.markdown-preview = nvim.dag.entryAnywhere '' | ||||
|       let g:mkdp_auto_start = ${mkVimBool cfg.autoStart} | ||||
|       let g:mkdp_auto_close = ${mkVimBool cfg.autoClose} | ||||
|       let g:mkdp_refresh_slow = ${mkVimBool cfg.lazyRefresh} | ||||
|       let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes}] | ||||
|       let g:mkdp_command_for_global = ${mkVimBool cfg.alwaysAllowPreview} | ||||
|       let g:mkdp_open_to_the_world = ${mkVimBool cfg.broadcastServer} | ||||
|       let g:mkdp_open_ip = '${cfg.customIP}' | ||||
|       let g:mkdp_port = '${cfg.customPort}' | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										6
									
								
								modules/utility/preview/markdown-preview/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/utility/preview/markdown-preview/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| _: { | ||||
|   imports = [ | ||||
|     ./markdown-preview.nix | ||||
|     ./config.nix | ||||
|   ]; | ||||
| } | ||||
|  | @ -0,0 +1,57 @@ | |||
| {lib, ...}: let | ||||
|   inherit (lib) types mkEnableOption mkOption; | ||||
| in { | ||||
|   options.vim.utility.preview = { | ||||
|     markdownPreview = { | ||||
|       enable = mkEnableOption "enable Markdown preview in neovim with markdown-preview.nvim"; | ||||
| 
 | ||||
|       autoStart = mkOption { | ||||
|         type = types.bool; | ||||
|         default = false; | ||||
|         description = "Automatically open the preview window after entering a Markdown buffer"; | ||||
|       }; | ||||
| 
 | ||||
|       autoClose = mkOption { | ||||
|         type = types.bool; | ||||
|         default = true; | ||||
|         description = "Automatically close the preview window after leaving a Markdown buffer"; | ||||
|       }; | ||||
| 
 | ||||
|       lazyRefresh = mkOption { | ||||
|         type = types.bool; | ||||
|         default = false; | ||||
|         description = "Only update preview when saving or leaving insert mode"; | ||||
|       }; | ||||
| 
 | ||||
|       filetypes = mkOption { | ||||
|         type = with types; listOf str; | ||||
|         default = ["markdown"]; | ||||
|         description = "Allowed filetypes"; | ||||
|       }; | ||||
| 
 | ||||
|       alwaysAllowPreview = mkOption { | ||||
|         type = types.bool; | ||||
|         default = false; | ||||
|         description = "Allow preview on all filetypes"; | ||||
|       }; | ||||
| 
 | ||||
|       broadcastServer = mkOption { | ||||
|         type = types.bool; | ||||
|         default = false; | ||||
|         description = "Allow for outside and network wide connections"; | ||||
|       }; | ||||
| 
 | ||||
|       customIP = mkOption { | ||||
|         type = types.str; | ||||
|         default = ""; | ||||
|         description = "IP-address to use"; | ||||
|       }; | ||||
| 
 | ||||
|       customPort = mkOption { | ||||
|         type = types.str; | ||||
|         default = ""; | ||||
|         description = "Port to use"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Donnerinoern
				Donnerinoern