Skip to content

Commit 7a2e17d

Browse files
committed
feat: support shift+enter in native terminal
1 parent aa9a5ce commit 7a2e17d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lua/claudecode/terminal/native.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ local function open_terminal(cmd_string, env_table, effective_config, focus)
134134
vim.bo[bufnr].bufhidden = "hide"
135135
-- buftype=terminal is set by termopen
136136

137+
-- Shift+Enter inserts a line continuation (backslash + newline) in the terminal
138+
vim.keymap.set("t", "<S-CR>", function()
139+
vim.api.nvim_feedkeys("\\", "t", true)
140+
vim.defer_fn(function()
141+
vim.api.nvim_feedkeys("\r", "t", true)
142+
end, 10)
143+
end, { buffer = bufnr, desc = "New line" })
144+
137145
if focus then
138146
-- Focus the terminal: switch to terminal window and enter insert mode
139147
vim.api.nvim_set_current_win(winid)

0 commit comments

Comments
 (0)