mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 02:52:37 +00:00 
			
		
		
		
	utility/yazi-nvim: init
This commit is contained in:
		
					parent
					
						
							
								b248b5af59
							
						
					
				
			
			
				commit
				
					
						8eebd8c8a6
					
				
			
		
					 4 changed files with 66 additions and 1 deletions
				
			
		|  | @ -7,6 +7,7 @@ | ||||||
|     ./gestures |     ./gestures | ||||||
|     ./icon-picker |     ./icon-picker | ||||||
|     ./images |     ./images | ||||||
|  |     ./leetcode-nvim | ||||||
|     ./motion |     ./motion | ||||||
|     ./multicursors |     ./multicursors | ||||||
|     ./new-file-template |     ./new-file-template | ||||||
|  | @ -16,6 +17,6 @@ | ||||||
|     ./telescope |     ./telescope | ||||||
|     ./wakatime |     ./wakatime | ||||||
|     ./yanky-nvim |     ./yanky-nvim | ||||||
|     ./leetcode-nvim |     ./yazi-nvim | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								modules/plugins/utility/yazi-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/plugins/utility/yazi-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | ||||||
|  | { | ||||||
|  |   options, | ||||||
|  |   config, | ||||||
|  |   pkgs, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.binds) mkKeymap; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.utility.yazi-nvim; | ||||||
|  |   keys = cfg.mappings; | ||||||
|  | 
 | ||||||
|  |   inherit (options.vim.utility.yazi-nvim) mappings; | ||||||
|  | in { | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     vim = { | ||||||
|  |       lazy.plugins."yazi.nvim" = { | ||||||
|  |         package = pkgs.vimPlugins.yazi-nvim; | ||||||
|  |         setupModule = "yazi"; | ||||||
|  |         inherit (cfg) setupOpts; | ||||||
|  |         event = ["BufAdd" "VimEnter"]; | ||||||
|  | 
 | ||||||
|  |         keys = [ | ||||||
|  |           (mkKeymap "n" keys.openYazi "<cmd>Yazi<CR>" {desc = mappings.openYazi.description;}) | ||||||
|  |           (mkKeymap "n" keys.openYaziDir "<cmd>Yazi cwd<CR>" {desc = mappings.openYaziDir.description;}) | ||||||
|  |           (mkKeymap "n" keys.yaziToggle "<cmd>Yazi toggle<CR>" {desc = mappings.yaziToggle.description;}) | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								modules/plugins/utility/yazi-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/utility/yazi-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     ./config.nix | ||||||
|  |     ./yazi-nvim.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
							
								
								
									
										26
									
								
								modules/plugins/utility/yazi-nvim/yazi-nvim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								modules/plugins/utility/yazi-nvim/yazi-nvim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | ||||||
|  | {lib, ...}: let | ||||||
|  |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|  |   inherit (lib.types) bool; | ||||||
|  |   inherit (lib.nvim.types) mkPluginSetupOption; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
|  | in { | ||||||
|  |   options.vim.utility.yazi-nvim = { | ||||||
|  |     enable = mkEnableOption '' | ||||||
|  |       companion plugin for the yazi terminal file manager [yazi-nvim] | ||||||
|  |     ''; | ||||||
|  | 
 | ||||||
|  |     mappings = { | ||||||
|  |       openYazi = mkMappingOption "Open yazi at the current file [yazi.nvim]" "<leader>-"; | ||||||
|  |       openYaziDir = mkMappingOption "Open the file manager in nvim's working directory [yazi.nvim]" "<leader>cw"; | ||||||
|  |       yaziToggle = mkMappingOption "Resume the last yazi session [yazi.nvim]" "<c-up>"; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     setupOpts = mkPluginSetupOption "yazi-nvim" { | ||||||
|  |       open_for_directories = mkOption { | ||||||
|  |         type = bool; | ||||||
|  |         default = false; | ||||||
|  |         description = "Whether to open Yazi instead of netrw"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue