nvim and pane focus
Move between nvim windows and flockr panes with ctrl+h/j/k/l.
You can move between nvim windows and flockr panes with the same keys, the way vim-tmux-navigator works with tmux. ctrl+h/j/k/l first moves between nvim windows. At the edge of nvim, the same key moves to the next flockr pane.
How it works
- You bind the pane focus keys without the prefix, for example
ctrl+h. ui.pane_focus_passthroughlists programs that get those keys first. When the foreground program in the focused pane is on the list, flockr sends it the key instead of moving focus.- nvim moves between its own windows. When it is already at the edge, it calls
flockr pane focusto hand off to flockr.
Names in pane_focus_passthrough match the process name of the pane's foreground job leader. The list is empty by default, so no program gets the keys until you add it.
flockr config
[keys]
focus_pane_left = ["prefix+h", "ctrl+h"]
focus_pane_down = ["prefix+j", "ctrl+j"]
focus_pane_up = ["prefix+k", "ctrl+k"]
focus_pane_right = ["prefix+l", "ctrl+l"]
[ui]
pane_focus_passthrough = ["nvim"]Keeping prefix+h/j/k/l in the list means the prefixed keys still work everywhere. Reload with prefix+shift+r after editing.
nvim config
Add this to your nvim config. It moves between windows and hands off to flockr at the edge:
if vim.env.FLOCKR_PANE_ID and not vim.env.TMUX then
for key, dir in pairs({ h = "left", j = "down", k = "up", l = "right" }) do
vim.keymap.set("n", "<c-" .. key .. ">", function()
local win = vim.api.nvim_get_current_win()
vim.cmd("wincmd " .. key)
if vim.api.nvim_get_current_win() == win then
vim.fn.jobstart({
vim.env.FLOCKR_BIN_PATH or "flockr", "pane", "focus",
"--pane", vim.env.FLOCKR_PANE_ID, "--direction", dir,
}, { detach = true })
end
end)
end
endWhat it does:
- It runs only inside a flockr pane (
FLOCKR_PANE_IDis set) and not inside tmux. - For each direction it tries
wincmd. If the window didn't change, nvim is at its edge, so it runsflockr pane focus --pane $FLOCKR_PANE_ID --direction <dir>. - It uses
FLOCKR_BIN_PATH, which flockr sets in every pane, and falls back toflockronPATH.
The mappings are for normal mode ("n"). Add other modes to vim.keymap.set if you want them there too.
With vim-tmux-navigator
If you use vim-tmux-navigator, set this so its own mappings don't replace these:
vim.g.tmux_navigator_no_mappings = 1Other programs
Any program can join in the same way: add its process name to pane_focus_passthrough, and have it call flockr pane focus --direction <dir> at its edge. --direction takes left, right, up, or down.
Last updated November 3, 2026