Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lua/sidekick/cli/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ local function nav(dir)
return function(terminal)
local at_edge = vim.fn.winnr() == vim.fn.winnr(dir)
if at_edge or terminal:is_float() then
-- When running under a mux backend (e.g., tmux via psmux on Windows),
-- returning the key as an expr string passes through Neovim's terminal
-- emulation, which can mangle control characters (e.g., C-j becomes CR).
-- Send the key directly to the mux pane instead.
if terminal.parent and terminal.parent.send_key then
vim.schedule(function()
terminal.parent:send_key(("C-%s"):format(dir))
end)
return
end
return ("<c-%s>"):format(dir)
end
vim.schedule(function()
Expand Down
8 changes: 8 additions & 0 deletions lua/sidekick/cli/session/tmux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ function M:submit()
Util.exec({ "tmux", "send-keys", "-t", self.tmux_pane_id, "Enter" })
end

---Send a raw key to a tmux pane
---@param key string tmux key name (e.g., "C-j", "Enter", "Escape")
function M:send_key(key)
if self.mux_session then
Util.exec({ "tmux", "send-keys", "-t", self.mux_session, key })
end
end

function M:dump()
local pane_id = self:pane_id()
if not pane_id then
Expand Down