add smart splits
This commit is contained in:
		
							parent
							
								
									1e9e412a02
								
							
						
					
					
						commit
						e8ff6ac5f3
					
				
					 3 changed files with 111 additions and 36 deletions
				
			
		| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
    ./plugins/editor/buffers.nix
 | 
					    ./plugins/editor/buffers.nix
 | 
				
			||||||
    ./plugins/editor/comment.nix
 | 
					    ./plugins/editor/comment.nix
 | 
				
			||||||
    ./plugins/editor/sessions.nix
 | 
					    ./plugins/editor/sessions.nix
 | 
				
			||||||
 | 
					    ./plugins/editor/smart-splits.nix
 | 
				
			||||||
    ./plugins/editor/treesitter.nix
 | 
					    ./plugins/editor/treesitter.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # UI plugins
 | 
					    # UI plugins
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,41 +19,5 @@
 | 
				
			||||||
        desc = "+find"; 
 | 
					        desc = "+find"; 
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    { # focus window left
 | 
					 | 
				
			||||||
      mode = ["n"];
 | 
					 | 
				
			||||||
      key = "<C-Left>";
 | 
					 | 
				
			||||||
      action = "<C-w>h";
 | 
					 | 
				
			||||||
      options = {
 | 
					 | 
				
			||||||
        silent = true;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    { # focus window down
 | 
					 | 
				
			||||||
      mode = ["n"];
 | 
					 | 
				
			||||||
      key = "<C-Down>";
 | 
					 | 
				
			||||||
      action = "<C-w>j";
 | 
					 | 
				
			||||||
      options = {
 | 
					 | 
				
			||||||
        silent = true;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    { # focus window up
 | 
					 | 
				
			||||||
      mode = ["n"];
 | 
					 | 
				
			||||||
      key = "<C-Up>";
 | 
					 | 
				
			||||||
      action = "<C-w>k";
 | 
					 | 
				
			||||||
      options = {
 | 
					 | 
				
			||||||
        silent = true;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    { # focus window right
 | 
					 | 
				
			||||||
      mode = ["n"];
 | 
					 | 
				
			||||||
      key = "<C-Right>";
 | 
					 | 
				
			||||||
      action = "<C-w>l";
 | 
					 | 
				
			||||||
      options = {
 | 
					 | 
				
			||||||
        silent = true;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										110
									
								
								config/plugins/editor/smart-splits.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								config/plugins/editor/smart-splits.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,110 @@
 | 
				
			||||||
 | 
					{...}: {
 | 
				
			||||||
 | 
					  plugins.smart-splits = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    settings = {
 | 
				
			||||||
 | 
					      multiplexer_integration = "WezTerm";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  keymaps = [
 | 
				
			||||||
 | 
					    # moving between splits
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-Left>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').move_cursor_left";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-Down>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').move_cursor_down";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-Up>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').move_cursor_up";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-Right>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').move_cursor_right";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # swapping buffers between windows
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-S-Left>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').swap_buf_left";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-S-Down>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').swap_buf_down";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-S-Up>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').swap_buf_up";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-S-Right>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').swap_buf_right";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # resizing splits
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-A-Left>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').resize_left";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-A-Down>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').resize_down";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-A-Up>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').resize_up";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mode = ["n"];
 | 
				
			||||||
 | 
					      key = "<C-A-Right>";
 | 
				
			||||||
 | 
					      action = {
 | 
				
			||||||
 | 
					        __raw = "require('smart-splits').resize_right";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue