lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Support Ctrl+Enter to confirm commit

Open KnapSac opened this issue 7 months ago • 4 comments

Is your feature request related to a problem? Please describe. When inside the commit description part of the commit dialog, the default keybind to commit is Alt+Enter. This is unfortunate, because it's also bound to toggle fullscreen in Windows Terminal. I tried to change the keybind by setting keybind.universal.confirmInEditor to <c-enter>, but that is not a supported option.

Describe the solution you'd like I'd prefer <c-enter> as the default keybind, this is a common UI pattern on the web. I'd also be fine to have it be configurable. I don't know whether the keybind.universal.confirmInEditor setting is used for this, but if so it should probably support <c-enter>.

#1700 might be related, but I believe that it's outdated as Alt+Enter is no longer used to enter newlines in the commit message, which you can now do using Enter itself.

I'd be happy to look into implementing this.

KnapSac avatar May 03 '25 09:05 KnapSac

Duplicate of #4397 (and #4502).

I'd be happy to look into implementing this.

This is very non-trivial. You'd first have to implement https://github.com/gdamore/tcell/issues/671, and then add support for this in gocui.

Given the number of users having problems with this (see also https://github.com/jesseduffield/lazygit/issues/4375#issuecomment-2726353546) I'm wondering if we should change the default keybinding to something like <c-s> for the time being, to at least make it work everywhere. @jesseduffield Any opinion on that?

stefanhaller avatar May 03 '25 12:05 stefanhaller

Wow, I really suck at searching today, my bad!

c-s does seem like a better default in my opinion.

KnapSac avatar May 03 '25 13:05 KnapSac

It sounds like we should leave <c-enter> as-is but add an additional keybinding of <c-s>

jesseduffield avatar May 03 '25 14:05 jesseduffield

It sounds like we should leave <c-enter> as-is but add an additional keybinding of <c-s>

Ok, added in #4532.

stefanhaller avatar May 03 '25 15:05 stefanhaller