feat(pane-nav): smart-splits under tmux, pane_nav for herdr/kitty
This commit is contained in:
1 parent
3a0e1cb13e
commit
7d448348b2
4 files changed
+50
-13
No files matched your search
@@ -65,7 +65,7 @@ scripts/ mermaid-validator.mjs (node process used by config/mermai
|
|||||||
|
|
||||||
**Search**: `fff.nvim` handles files and grep (frecency, respects `.gitignore` and `.ignore`). snacks.picker handles everything else. `config/ignore_patterns.lua` holds the shared ignore list used by neo-tree and the snacks pickers.
|
**Search**: `fff.nvim` handles files and grep (frecency, respects `.gitignore` and `.ignore`). snacks.picker handles everything else. `config/ignore_patterns.lua` holds the shared ignore list used by neo-tree and the snacks pickers.
|
||||||
|
|
||||||
**Pane navigation** (`config/pane_nav.lua`): `<C-h/j/k/l>` moves between Neovim splits first. At the outermost split, the move goes to herdr, tmux, or kitty, whichever is the nearest ancestor process. Resize is plain `:resize` on `<C-Up/Down/Left/Right>`; smart-splits is disabled.
|
**Pane navigation** (`config/pane_nav.lua`): `<C-h/j/k/l>` moves between Neovim splits first. At the outermost split, the move goes to herdr, tmux, or kitty, whichever is the nearest ancestor process. Under tmux the move goes through smart-splits.nvim, loaded at startup, which flags the pane `@pane-is-vim` for `tmux.conf`. There, `<C-Up/Down/Left/Right>` and `<M-h/j/k/l>` are smart-splits resize and cross into tmux panes at the edge. Elsewhere smart-splits stays unloaded and resize is plain `:resize` on `<C-Up/Down/Left/Right>`.
|
||||||
|
|
||||||
**Mermaid** (`config/mermaid.lua`): tree-sitter highlights ```` ```mermaid ```` fences in markdown/MDX and `.mmd` files. Diagnostics come from mermaid's own parser running in a node process, which exits after 5 idle minutes. Run `:MermaidCheck` to re-validate.
|
**Mermaid** (`config/mermaid.lua`): tree-sitter highlights ```` ```mermaid ```` fences in markdown/MDX and `.mmd` files. Diagnostics come from mermaid's own parser running in a node process, which exits after 5 idle minutes. Run `:MermaidCheck` to re-validate.
|
||||||
|
|
||||||
@@ -82,7 +82,6 @@ Core or community plugins turned off in `plugins/user.lua` because something els
|
|||||||
| Plugin | Replaced by |
|
| Plugin | Replaced by |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `none-ls.nvim`, `mason-null-ls.nvim` | conform (`mason-null-ls` would auto-register every Mason tool as a second formatter/linter client) |
|
| `none-ls.nvim`, `mason-null-ls.nvim` | conform (`mason-null-ls` would auto-register every Mason tool as a second formatter/linter client) |
|
||||||
| `smart-splits.nvim` | `config/pane_nav.lua` + native `:resize` |
|
|
||||||
| `toggleterm.nvim` | kitty / snacks terminals |
|
| `toggleterm.nvim` | kitty / snacks terminals |
|
||||||
| `lsp_signature.nvim` (not imported) | astrolsp's built-in signature help (`features.signature_help = true`) |
|
| `lsp_signature.nvim` (not imported) | astrolsp's built-in signature help (`features.signature_help = true`) |
|
||||||
| `refactoring.nvim`, `dev-tools.nvim` (not imported) | LSP code actions (`<C-a>a`) |
|
| `refactoring.nvim`, `dev-tools.nvim` (not imported) | LSP code actions (`<C-a>a`) |
|
||||||
|
|||||||
@@ -141,6 +141,11 @@ end
|
|||||||
--- @param dir "left"|"down"|"up"|"right"
|
--- @param dir "left"|"down"|"up"|"right"
|
||||||
function M.navigate(dir)
|
function M.navigate(dir)
|
||||||
local from = vim.api.nvim_get_current_win()
|
local from = vim.api.nvim_get_current_win()
|
||||||
|
-- Under tmux smart-splits owns the edge handoff (plugins/user.lua).
|
||||||
|
if M.env() == "tmux" and vim.api.nvim_win_get_config(from).relative == "" then
|
||||||
|
require("smart-splits")["move_cursor_" .. dir]()
|
||||||
|
return
|
||||||
|
end
|
||||||
vim.cmd.wincmd(directions[dir].wincmd)
|
vim.cmd.wincmd(directions[dir].wincmd)
|
||||||
if vim.api.nvim_get_current_win() ~= from then return end
|
if vim.api.nvim_get_current_win() ~= from then return end
|
||||||
if vim.api.nvim_win_get_config(0).relative ~= "" then return end
|
if vim.api.nvim_win_get_config(0).relative ~= "" then return end
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
--- <C-h/j/k/l> pane navigation that follows whatever multiplexer Neovim is
|
--- <C-h/j/k/l> pane navigation that follows whatever multiplexer Neovim is
|
||||||
--- running under (herdr, tmux, or bare kitty) — see config.pane_nav.
|
--- running under (herdr, tmux, or bare kitty) — see config.pane_nav.
|
||||||
---
|
---
|
||||||
--- This replaces AstroNvim's smart-splits mappings (which only know
|
--- These entries overwrite AstroNvim's smart-splits mappings, which only know
|
||||||
--- tmux/wezterm/kitty and would move the wrong layer inside herdr). The plugin
|
--- tmux/wezterm/kitty and would move the wrong layer inside herdr. Under tmux
|
||||||
--- is disabled in plugins/user.lua; its <C-Up/Down/Left/Right> resize binds
|
--- they hand back to smart-splits: navigation through config.pane_nav, resize
|
||||||
--- are plain :resize here.
|
--- directly, plus <M-h/j/k/l> resize, the keys tmux.conf forwards to an
|
||||||
|
--- @pane-is-vim pane. Elsewhere <C-Up/Down/Left/Right> are plain :resize.
|
||||||
|
|
||||||
local nav = require "config.pane_nav"
|
local nav = require "config.pane_nav"
|
||||||
|
|
||||||
@@ -18,11 +19,20 @@ local moves = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
--- AstroNvim's key spelling again, overriding the smart-splits resize entries.
|
--- AstroNvim's key spelling again, overriding the smart-splits resize entries.
|
||||||
|
--- dir is the smart-splits direction under tmux; cmd the plain fallback.
|
||||||
local resizes = {
|
local resizes = {
|
||||||
["<C-Up>"] = { "resize +2", "Resize split taller" },
|
["<C-Up>"] = { dir = "up", cmd = "resize +2", desc = "Resize split taller" },
|
||||||
["<C-Down>"] = { "resize -2", "Resize split shorter" },
|
["<C-Down>"] = { dir = "down", cmd = "resize -2", desc = "Resize split shorter" },
|
||||||
["<C-Left>"] = { "vertical resize -2", "Resize split narrower" },
|
["<C-Left>"] = { dir = "left", cmd = "vertical resize -2", desc = "Resize split narrower" },
|
||||||
["<C-Right>"] = { "vertical resize +2", "Resize split wider" },
|
["<C-Right>"] = { dir = "right", cmd = "vertical resize +2", desc = "Resize split wider" },
|
||||||
|
}
|
||||||
|
|
||||||
|
--- tmux.conf's vim-aware resize keys; only mapped under tmux.
|
||||||
|
local tmux_resizes = {
|
||||||
|
["<M-h>"] = "left",
|
||||||
|
["<M-j>"] = "down",
|
||||||
|
["<M-k>"] = "up",
|
||||||
|
["<M-l>"] = "right",
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -36,8 +46,18 @@ return {
|
|||||||
maps.x[key] = maps.n[key]
|
maps.x[key] = maps.n[key]
|
||||||
maps.t[key] = { nav.terminal(dir), desc = desc }
|
maps.t[key] = { nav.terminal(dir), desc = desc }
|
||||||
end
|
end
|
||||||
|
local tmux = nav.env() == "tmux"
|
||||||
for key, spec in pairs(resizes) do
|
for key, spec in pairs(resizes) do
|
||||||
maps.n[key] = { "<Cmd>" .. spec[1] .. "<CR>", desc = spec[2] }
|
if tmux then
|
||||||
|
maps.n[key] = { function() require("smart-splits")["resize_" .. spec.dir]() end, desc = "Resize split " .. spec.dir }
|
||||||
|
else
|
||||||
|
maps.n[key] = { "<Cmd>" .. spec.cmd .. "<CR>", desc = spec.desc }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if tmux then
|
||||||
|
for key, dir in pairs(tmux_resizes) do
|
||||||
|
maps.n[key] = { function() require("smart-splits")["resize_" .. dir]() end, desc = "Resize split " .. dir .. " (tmux aware)" }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
+15
-2
@@ -53,8 +53,21 @@ return {
|
|||||||
{ "nvimtools/none-ls.nvim", enabled = false },
|
{ "nvimtools/none-ls.nvim", enabled = false },
|
||||||
{ "jay-babu/mason-null-ls.nvim", enabled = false },
|
{ "jay-babu/mason-null-ls.nvim", enabled = false },
|
||||||
|
|
||||||
-- <C-h/j/k/l> is config.pane_nav; resize binds are native (plugins/pane-nav.lua)
|
-- Under tmux, smart-splits drives <C-h/j/k/l> and resizing (config.pane_nav
|
||||||
{ "mrjones2014/smart-splits.nvim", enabled = false },
|
-- and plugins/pane-nav.lua delegate to it) and flags the pane @pane-is-vim
|
||||||
|
-- for tmux.conf. herdr and kitty stay on config.pane_nav, so its env() picks
|
||||||
|
-- the integration instead of smart-splits' own env-var guess. Loaded at
|
||||||
|
-- startup under tmux so the flag is set before the first keypress
|
||||||
|
-- (AstroNvim's early load keys off TERM_PROGRAM, which tmux.conf passes
|
||||||
|
-- through from the outer terminal).
|
||||||
|
{
|
||||||
|
"mrjones2014/smart-splits.nvim",
|
||||||
|
lazy = require("config.pane_nav").env() ~= "tmux",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.at_edge = "wrap"
|
||||||
|
opts.multiplexer_integration = require("config.pane_nav").env() == "tmux" and "tmux" or false
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- lsp_signature.nvim is gone; astrolsp's own signature help replaces it
|
-- lsp_signature.nvim is gone; astrolsp's own signature help replaces it
|
||||||
{ "AstroNvim/astrolsp", opts = { features = { signature_help = true } } },
|
{ "AstroNvim/astrolsp", opts = { features = { signature_help = true } } },
|
||||||
|
|||||||
Reference in new issue
Block a user