Skip to content
Draft
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
8 changes: 8 additions & 0 deletions lua/claudecode/terminal/native.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ local function open_terminal(cmd_string, env_table, effective_config, focus)
vim.bo[bufnr].bufhidden = "hide"
-- buftype=terminal is set by termopen

-- Shift+Enter inserts a line continuation (backslash + newline) in the terminal
vim.keymap.set("t", "<S-CR>", function()
vim.api.nvim_feedkeys("\\", "t", true)
vim.defer_fn(function()
vim.api.nvim_feedkeys("\r", "t", true)
end, 10)
end, { buffer = bufnr, desc = "New line" })

if focus then
-- Focus the terminal: switch to terminal window and enter insert mode
vim.api.nvim_set_current_win(winid)
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/native_terminal_toggle_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ describe("claudecode.terminal.native toggle behavior", function()
return jobid
end,
},
keymap = {
set = function() end,
},
schedule = function(callback)
callback() -- Execute immediately in tests
end,
Expand Down