mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 19:12:38 +00:00 
			
		
		
		
	utility/smart-splits: init
This commit is contained in:
		
					parent
					
						
							
								77a32f0961
							
						
					
				
			
			
				commit
				
					
						d6d569c53e
					
				
			
		
					 6 changed files with 101 additions and 0 deletions
				
			
		
							
								
								
									
										51
									
								
								modules/plugins/utility/smart-splits/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								modules/plugins/utility/smart-splits/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| { | ||||
|   pkgs, | ||||
|   config, | ||||
|   options, | ||||
|   lib, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf; | ||||
| 
 | ||||
|   cfg = config.vim.utility.smart-splits; | ||||
|   inherit (options.vim.utility.smart-splits) keymaps; | ||||
|   mkSmartSplitKey = act: let | ||||
|     key = cfg.keymaps.${act}; | ||||
|   in | ||||
|     lib.optional (key != null) { | ||||
|       inherit key; | ||||
|       desc = keymaps.${act}.description; | ||||
|       action = ''function() require('smart-splits').${act}() end''; | ||||
|       mode = "n"; | ||||
|       lua = true; | ||||
|     }; | ||||
| in { | ||||
|   config = mkIf cfg.enable { | ||||
|     vim.lazy.plugins = { | ||||
|       ${pkgs.vimPlugins.smart-splits-nvim.pname} = { | ||||
|         package = pkgs.vimPlugins.smart-splits-nvim; | ||||
|         setupModule = "smart-splits"; | ||||
|         inherit (cfg) setupOpts; | ||||
| 
 | ||||
|         # plugin needs to be loaded right after startup so that the multiplexer detects vim running in the pane | ||||
|         event = ["DeferredUIEnter"]; | ||||
| 
 | ||||
|         keys = lib.flatten [ | ||||
|           (mkSmartSplitKey "resize_left") | ||||
|           (mkSmartSplitKey "resize_down") | ||||
|           (mkSmartSplitKey "resize_up") | ||||
|           (mkSmartSplitKey "resize_right") | ||||
|           (mkSmartSplitKey "move_cursor_left") | ||||
|           (mkSmartSplitKey "move_cursor_down") | ||||
|           (mkSmartSplitKey "move_cursor_up") | ||||
|           (mkSmartSplitKey "move_cursor_right") | ||||
|           (mkSmartSplitKey "move_cursor_previous") | ||||
|           (mkSmartSplitKey "swap_buf_left") | ||||
|           (mkSmartSplitKey "swap_buf_down") | ||||
|           (mkSmartSplitKey "swap_buf_up") | ||||
|           (mkSmartSplitKey "swap_buf_right") | ||||
|         ]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Laszlo Bacsi
				Laszlo Bacsi