diff --git a/lazy-lock.json b/lazy-lock.json index af3c71a..7ed288f 100755 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -62,6 +62,7 @@ "render-markdown.nvim": { "branch": "main", "commit": "4663eb3ecd538bd5062628fb6d95bbe6bdca78f6" }, "rustaceanvim": { "branch": "main", "commit": "8fa1a98f514041132ab40088be53c130eb8d14c9" }, "sidekick.nvim": { "branch": "main", "commit": "208e1c5b8170c01fd1d07df0139322a76479b235" }, + "smart-splits.nvim": { "branch": "master", "commit": "0ab2e4928dc867dfea3ff1da186e69f289d8a532" }, "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, "text-case.nvim": { "branch": "main", "commit": "e898cfd46fa6cde0e83abb624a16e67d2ffc6457" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, diff --git a/lua/plugins/smart-splits.lua b/lua/plugins/smart-splits.lua new file mode 100644 index 0000000..f98eca1 --- /dev/null +++ b/lua/plugins/smart-splits.lua @@ -0,0 +1,41 @@ +-- Seamless split navigation between Neovim windows and herdr panes. +-- Not lazy-loaded on purpose: the herdr integration needs the plugin present +-- so `` forwarded by herdr land in the plugin, not in default vim keys. +-- +-- herdr side: `herdr plugin link ~/.local/share/nvim/lazy/smart-splits.nvim` +-- plus the `[[keys.command]]` plugin_action bindings in ~/.config/herdr/config.toml. +return { + "mrjones2014/smart-splits.nvim", + lazy = false, + -- herdr integration is only on master so far (not in a tagged release) + version = false, + opts = { + ignored_filetypes = { "NvimTree", "neo-tree", "snacks_picker_list", "edgy" }, + ignored_buftypes = { "nofile", "quickfix", "prompt" }, + default_amount = 3, + -- at the edge of the last Neovim split, cross over into the neighbouring + -- herdr pane (handled by the mux backend); if there is none, stop. + at_edge = "stop", + float_win_behavior = "previous", + disable_multiplexer_nav_when_zoomed = true, + multiplexer_integration = vim.env.HERDR_ENV and "herdr" or nil, + }, + keys = { + -- move between splits (and herdr panes) + { "", function() require("smart-splits").move_cursor_left() end, desc = "Go to left window/pane" }, + { "", function() require("smart-splits").move_cursor_down() end, desc = "Go to lower window/pane" }, + { "", function() require("smart-splits").move_cursor_up() end, desc = "Go to upper window/pane" }, + { "", function() require("smart-splits").move_cursor_right() end, desc = "Go to right window/pane" }, + { "", function() require("smart-splits").move_cursor_previous() end, desc = "Go to previous window" }, + -- resize (matches LazyVim's default resize keys) + { "", function() require("smart-splits").resize_left() end, desc = "Resize window left" }, + { "", function() require("smart-splits").resize_down() end, desc = "Resize window down" }, + { "", function() require("smart-splits").resize_up() end, desc = "Resize window up" }, + { "", function() require("smart-splits").resize_right() end, desc = "Resize window right" }, + -- swap buffers between windows + { "wh", function() require("smart-splits").swap_buf_left() end, desc = "Swap buffer left" }, + { "wj", function() require("smart-splits").swap_buf_down() end, desc = "Swap buffer down" }, + { "wk", function() require("smart-splits").swap_buf_up() end, desc = "Swap buffer up" }, + { "wl", function() require("smart-splits").swap_buf_right() end, desc = "Swap buffer right" }, + }, +}