Add smart-splits

This commit is contained in:
2023-12-01 15:28:11 -05:00
parent 2e781ef1db
commit 06140480ad
4 changed files with 147 additions and 6 deletions

View File

@@ -0,0 +1,134 @@
return {
"mrjones2014/smart-splits.nvim",
keys = {
{
"<A-h>",
function()
require("smart-splits").resize_left()
end,
desc = "Resize left",
mode = { "n", "t" },
},
{
"<A-j>",
function()
require("smart-splits").resize_down()
end,
desc = "Resize down",
mode = { "n", "t" },
},
{
"<A-k>",
function()
require("smart-splits").resize_up()
end,
desc = "Resize up",
mode = { "n", "t" },
},
{
"<A-l>",
function()
require("smart-splits").resize_right()
end,
desc = "Resize right",
mode = { "n", "t" },
},
-- because ShareMouse isn't mapping Alt to Option correctly...
{
"˙",
function()
require("smart-splits").resize_left()
end,
desc = "Resize left",
mode = { "n", "t" },
},
{
"",
function()
require("smart-splits").resize_down()
end,
desc = "Resize down",
mode = { "n", "t" },
},
{
"˚",
function()
require("smart-splits").resize_up()
end,
desc = "Resize up",
mode = { "n", "t" },
},
{
"¬",
function()
require("smart-splits").resize_right()
end,
desc = "Resize right",
mode = { "n", "t" },
},
{
"<C-h>",
function()
require("smart-splits").move_cursor_left()
end,
desc = "Move cursor left",
mode = { "n", "t" },
},
{
"<C-j>",
function()
require("smart-splits").move_cursor_down()
end,
desc = "Move cursor down",
mode = { "n", "t" },
},
{
"<C-k>",
function()
require("smart-splits").move_cursor_up()
end,
desc = "Move cursor up",
mode = { "n", "t" },
},
{
"<C-l>",
function()
require("smart-splits").move_cursor_right()
end,
desc = "Move cursor right",
mode = { "n", "t" },
},
{
"<C-A-h>",
function()
require("smart-splits").swap_buf_left()
end,
desc = "Swap buffer left",
mode = { "n", "t" },
},
{
"<C-A-j>",
function()
require("smart-splits").swap_buf_down()
end,
desc = "Swap buffer down",
mode = { "n", "t" },
},
{
"<C-A-k>",
function()
require("smart-splits").swap_buf_up()
end,
desc = "Swap buffer up",
mode = { "n", "t" },
},
{
"<C-A-l>",
function()
require("smart-splits").swap_buf_right()
end,
desc = "Swap buffer right",
mode = { "n", "t" },
},
},
}

View File

@@ -29,10 +29,11 @@ return {
-- vim.keymap.set('n', [[<C-a>z]], [[<Cmd>ToggleTermToggleAll<CR>]])
-- vim.keymap.set('t', [[<C-a>z]], [[<Cmd>tab split<CR>]])
{ "<Esc>", [[<C-\><C-n>]], mode = "t", desc = "Escape terminal mode" },
{ "<C-j>", [[<Cmd>wincmd h<CR>]], mode = "t", desc = "Move focus down one window" },
{ "<C-h>", [[<Cmd>wincmd h<CR>]], mode = "t", desc = "Move focus left one window" },
{ "<C-k>", [[<Cmd>wincmd k<CR>]], mode = "t", desc = "Move focus up one window" },
{ "<C-l>", [[<Cmd>wincmd l<CR>]], mode = "t", desc = "Move focus right one window" },
-- These were replaced by smart-splits
-- { "<C-j>", [[<Cmd>wincmd h<CR>]], mode = "t", desc = "Move focus down one window" },
-- { "<C-h>", [[<Cmd>wincmd h<CR>]], mode = "t", desc = "Move focus left one window" },
-- { "<C-k>", [[<Cmd>wincmd k<CR>]], mode = "t", desc = "Move focus up one window" },
-- { "<C-l>", [[<Cmd>wincmd l<CR>]], mode = "t", desc = "Move focus right one window" },
{ [[<C-\>]], [[<Cmd>ToggleTerm<CR>]] },
{ "<F12>", [[<Cmd>ToggleTerm<CR>]] },
{ "<F12>", [[<Cmd>ToggleTerm<CR>]], mode = "t" },

View File

@@ -7,8 +7,13 @@ return {
{ "<leader>zf", [[<Cmd>:TZFocus<CR>]], desc = "[Z]oom [N]arrow current buffer in new tab" },
{ "<leader>zm", [[<Cmd>:TZMinimalist<CR>]], desc = "[Z] Toggle minimalist nvim UI mode" },
{ "<leader>za", [[<Cmd>:TZAtaraxis<CR>]], desc = "[Z]oom [A]taraxis current buffer minimalist mode" },
{
"<C-w>z",
[[<Cmd>:TZFocus<CR>]],
mode = { "n", "t" },
desc = "Toggle [Z]oom current buffer in new tab",
},
-- tmux memory for fullscreening nvim window
{ [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], desc = "Toggle [Z]oom current buffer in new tab" },
{ [[<C-a>z]], [[<Cmd>:TZFocus<CR>]], mode = "t", desc = "Toggle [Z]oom current terminal buffer in new tab" },
{ "<C-a>z", [[<Cmd>:TZFocus<CR>]], mode = { "n", "t" }, desc = "Toggle [Z]oom current buffer in new tab" },
},
}