mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	feat: mouse gestures & nvim-session-manager
This commit is contained in:
		
					parent
					
						
							
								306d63f9d6
							
						
					
				
			
			
				commit
				
					
						1c8d224775
					
				
			
		
					 8 changed files with 146 additions and 0 deletions
				
			
		
							
								
								
									
										5
									
								
								modules/gestures/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								modules/gestures/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| _: { | ||||
|   imports = [ | ||||
|     ./gesture-nvim.nix | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										55
									
								
								modules/gestures/gesture-nvim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								modules/gestures/gesture-nvim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| { | ||||
|   pkgs, | ||||
|   config, | ||||
|   lib, | ||||
|   ... | ||||
| }: | ||||
| with lib; | ||||
| with builtins; let | ||||
|   cfg = config.vim.gestures.gesture-nvim; | ||||
| in { | ||||
|   options.vim.gestures.gesture-nvim = { | ||||
|     enable = mkEnableOption "Enable GitHub Copilot"; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     vim.startPlugins = ["gesture-nvim"]; | ||||
| 
 | ||||
|     vim.luaConfigRC.gesture-nvim = nvim.dag.entryAnywhere '' | ||||
|       vim.opt.mouse = "a" | ||||
| 
 | ||||
|       vim.keymap.set("n", "<LeftDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true }) | ||||
|       vim.keymap.set("n", "<LeftRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true }) | ||||
| 
 | ||||
|       -- or if you would like to use right click | ||||
|       -- vim.keymap.set("n", "<RightMouse>", [[<Nop>]]) | ||||
|       -- vim.keymap.set("n", "<RightDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true }) | ||||
|       -- vim.keymap.set("n", "<RightRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true }) | ||||
| 
 | ||||
|       local gesture = require("gesture") | ||||
|       gesture.register({ | ||||
|         name = "scroll to bottom", | ||||
|         inputs = { gesture.up(), gesture.down() }, | ||||
|         action = "normal! G", | ||||
|       }) | ||||
|       gesture.register({ | ||||
|         name = "next tab", | ||||
|         inputs = { gesture.right() }, | ||||
|         action = "tabnext", | ||||
|       }) | ||||
|       gesture.register({ | ||||
|         name = "previous tab", | ||||
|         inputs = { gesture.left() }, | ||||
|         action = function(ctx) -- also can use callable | ||||
|           vim.cmd.tabprevious() | ||||
|         end, | ||||
|       }) | ||||
|       gesture.register({ | ||||
|         name = "go back", | ||||
|         inputs = { gesture.right(), gesture.left() }, | ||||
|         -- map to `<C-o>` keycode | ||||
|         action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]], | ||||
|       }) | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 NotAShelf
				NotAShelf