add smart splits

This commit is contained in:
♥ Minnie ♥ 2025-05-19 09:37:24 +08:00
parent 1e9e412a02
commit e8ff6ac5f3
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
3 changed files with 111 additions and 36 deletions

View file

@ -20,6 +20,7 @@
./plugins/editor/buffers.nix
./plugins/editor/comment.nix
./plugins/editor/sessions.nix
./plugins/editor/smart-splits.nix
./plugins/editor/treesitter.nix
# UI plugins

View file

@ -19,41 +19,5 @@
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;
};
}
];
}

View 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";
};
}
];
}