smart-splits.nvim allows for easier resizing of neovim splits, also handled tmux integration

This commit is contained in:
2024-04-18 03:52:03 +02:00
parent 1125c6543a
commit ad8a5caa99
3 changed files with 44 additions and 23 deletions

View File

@@ -0,0 +1,34 @@
-- https://github.com/mrjones2014/smart-splits.nvim
return {
"mrjones2014/smart-splits.nvim",
dependencies = {
"kwkarlwang/bufresize.nvim",
},
config = function()
vim.keymap.set("n", "<M-h>", require("smart-splits").move_cursor_left)
vim.keymap.set("n", "<M-j>", require("smart-splits").move_cursor_down)
vim.keymap.set("n", "<M-k>", require("smart-splits").move_cursor_up)
vim.keymap.set("n", "<M-l>", require("smart-splits").move_cursor_right)
vim.keymap.set("n", "<C-w>r", require("smart-splits").start_resize_mode, { desc = "Enter resize mode" })
vim.keymap.set("n", "<C-w>h", require("smart-splits").swap_buf_left, { desc = "Swap buffer to the left" })
vim.keymap.set("n", "<C-w>j", require("smart-splits").swap_buf_down, { desc = "Swap buffer to the bottom" })
vim.keymap.set("n", "<C-w>k", require("smart-splits").swap_buf_up, { desc = "Swap buffer to the top" })
vim.keymap.set("n", "<C-w>l", require("smart-splits").swap_buf_right, { desc = "Swap buffer to the right" })
require("smart-splits").setup({
at_edge = "stop",
cursor_follows_swapped_bufs = true,
resize_mode = {
silent = true,
hooks = {
on_enter = function()
vim.notify("Entering resize mode...")
end,
on_leave = require("bufresize").register,
},
},
})
end,
}

View File

@@ -1,18 +0,0 @@
-- https://github.com/alexghergh/nvim-tmux-navigation
return {
'alexghergh/nvim-tmux-navigation',
event = "VeryLazy",
config = function()
local nvim_tmux_nav = require('nvim-tmux-navigation')
nvim_tmux_nav.setup {
disable_when_zoomed = true,
keybindings = {
left = '<M-h>',
down = '<M-j>',
up = '<M-k>',
right = '<M-l>',
},
}
end
}