Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f6e7c5b

Browse files
ThomasK33alex35mil
andcommitted
feat: add Shift+Enter keybinding for new line in terminal
Change-Id: I9a5eee55b87db158dbf93266ef809ca10216b070 Signed-off-by: Thomas Kosiewski <tk@coder.com> Co-authored-by: alex35mil <4244251+alex35mil@users.noreply.github.com>
1 parent efeff6f commit f6e7c5b

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

‎lua/claudecode/terminal/snacks.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ end
4545
---@param config ClaudeCodeTerminalConfig Terminal configuration
4646
---@param env_table table Environment variables to set for the terminal process
4747
---@param focus boolean|nil Whether to focus the terminal when opened (defaults to true)
48-
---@return table options Snacks terminal options with start_insert/auto_insert controlled by focus parameter
48+
---@return snacks.terminal.Opts opts Snacks terminal options with start_insert/auto_insert controlled by focus parameter
4949
local function build_opts(config, env_table, focus)
5050
focus = utils.normalize_focus(focus)
5151
return {
@@ -58,8 +58,21 @@ local function build_opts(config, env_table, focus)
5858
width = config.split_width_percentage,
5959
height = 0,
6060
relative = "editor",
61-
}, config.snacks_win_opts or {}),
62-
}
61+
keys = {
62+
claude_new_line = {
63+
"<S-CR>",
64+
function()
65+
vim.api.nvim_feedkeys("\\", "t", true)
66+
vim.defer_fn(function()
67+
vim.api.nvim_feedkeys("\r", "t", true)
68+
end, 10)
69+
end,
70+
mode = "t",
71+
desc = "New line",
72+
},
73+
},
74+
} --[[@as snacks.win.Config]], config.snacks_win_opts or {}),
75+
} --[[@as snacks.terminal.Opts]]
6376
end
6477

6578
function M.setup()

‎lua/claudecode/types.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
---@field provider_opts ClaudeCodeTerminalProviderOptions?
7676
---@field auto_close boolean
7777
---@field env table<string, string>
78-
---@field snacks_win_opts table
78+
---@field snacks_win_opts snacks.win.Config
7979

8080
-- Port range configuration
8181
---@class ClaudeCodePortRange

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /