Add Shift-Enter support for Ghostty via `/terminal-setup` (with workaround)
Resolved 💬 25 comments Opened May 24, 2025 by adamavenir Closed Apr 27, 2026
💡 Likely answer: A maintainer (km-anthropic, contributor)
responded on this thread — see the highlighted reply below.
Some terminals get easy modifier-Enter shortcuts just by running /terminal-setup. Ghostty's not one of those. It would be nice if it was at some point.
But it's okay! You can fix this by going to Ghostty > Settings and adding to your config:
keybind = shift+enter=text:\n
25 Comments
~FWIW, I had to use
keybind = shift+enter=text:\\\r\nto get shift+enter to send\<CR>to claude code to get a newline due to running a terminal in Neovim. Not sure if there's a standard way that would work across raw shells, neovim terminal, or other multiplexers. 🤔~Err, seems like this is some oddity of https://github.com/greggh/claude-code.nvim terminals. Disregard;
text:\nworks fine in normal nvim:terminalwindows (as well as non-nvim ghostty windows).TIL about claude-code.nvim! thanks @garrett-hopper
strangely, after running
/terminal-setupmy ghostty config did have that keybind, but it wasn't working even after restarting ghostty and manually reloading the config. I had to add double quotes around the \n to get it working:keybind = shift+enter=text:"\n"My ghostty with
keybind = shift+enter=text:"\n"and withkeybind = shift+enter=text:\nseems to want to enter doublequote pairs when i hit shift+enterYes I'm also getting the extra double quotes, shift enter is not really usable in ghostty due to this 😔
FWIW, this worked for me (esc + cr):
For anyone using ghostty+tmux this worked for me.
In
~/.config/ghostty/configadd:Thanks this works great for me! No more extra double quotes 🎉
Ghostty sending the escape sequence
[27;2;13~is actually pretty nice (and arguably richer than sending just\nbecause it conveys more information).It breaks down as:
[27;2;13~= modifier(2=Shift) + key(13=Enter)Ideally Claude Code should recognize this standard escape sequence as well as a regular
\ninput. If Claude Code would recognize this, no hacks/workarounds in Ghostty configs would be needed for anyone.It'll be fixed in an upcoming release, thanks for raising!
Just to +1 that this is what worked for me in Ghostty +
tmux+nvim+coder/claudecodenvim plugin.Please do not let CC silently add this automatically; it breaks other programs. https://github.com/sst/opencode/issues/1505
Linux Claude just added that keybind but I get (#9549)
[27;2;13~too. claude 2.0.15 doesn't recognise thatI agree. Not recognizing
[27;2;13~is a bug in Claude Code that Anthropic should fix from their end. Users shouldn't put stuff likekeybind = shift+enter=text:\nin their Ghostty config as that could break other programs.@km-anthropic It's November now. I hope the fix will be released soon!
/terminal-setupnow appears to work in Ghostty.Like noted above writing to the config file silently is a insane choice, at least notify users what hacky workaround claude code is going to do because you wont support fixterm repr or kitty keyboard protocol like I mentioned here https://github.com/anthropics/claude-code/issues/6190
It just leads to people thinking there is a bug in ghostty https://github.com/ghostty-org/ghostty/discussions/9844
For me, this works:
Environment: M1 MacBook Air, macOS Tahoe 26.1, Ghostty 1.2.3.
I’m using Claude Code inside Ghostty, and I just ran
/terminal-setupin Claude Code.FYI, this did not work for me:
In this case,
text:\x1b\rbehaves like a proper “submit/accept” (Enter) in this context, whiletext:\nonly inserts a literal newline (or gets ignored by the app), so it doesn’t trigger the action I’m trying to bind Shift+Enter to.For me, with macOS Tahoe 26.2, all of solutions from you guys does not work... What can I do?
Still doesnt work for me
Shift+Enter newline functionality got enabled in 2.1.0 by default for several terminal types including Ghostty https://github.com/anthropics/claude-code/blob/5aac2b1b6aa23b65cd146b7eac8af30bc858d6eb/CHANGELOG.md?plain=1#L9
However, it may get reverted, since some people on MacOS got used to Option+Enter https://github.com/anthropics/claude-code/issues/16764
pasting my solution in case someone else stumbles and uses ghostty + tmux
I can reproduce this issue only after switching to the editor (nvim) via Ctrl+G and return. In-session workaround: Close Claude and restart via
claude --continueGhostty 1.2.3
Claude Code 2.1.45
NVIM 0.11.5
I'm on a mac, ghostly 1.3.1 and the only thing that works for me so that I get a new line in opencode, claude, grok-cli is
keybind = shift+enter=text:\nedit: I am inside of tmux
This issue was fixed as of version 2.1.0.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.