New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiline commit messages #28
Comments
I would suggest opening the user's editor for the commit message. This is how it's done in https://github.com/jonas/tig and also has the benefit of giving the user his own (probably customized) text editing environment. |
I agree @Sflip, I've got a PR up now that's made a start on opening e.g. vim as a subprocess, but I can't quite get it working. Any help on that and would be much appreciated :) |
If you're keeping track, I'd be totally fine with (and probably prefer) @MartinPetkov's suggestion to have a simple mechanism for multi-line commit messages without having to leave lazygit (i.e., no launching another editor). But... I'll gladly use whatever you choose to provide. ;-) |
@cmoesel at this point the in-lazygit solution is certainly the more straightforward one. I'll see if we can get this subprocess thing off the ground in the next couple of days and if not I'll (or somebody else is invited to) put a PR up for the simple solution |
💡 It would be awesome to consider the |
It would also be cool if you could open and close the commit message dialog without losing your message. I often build a large commit message while trolling through the changes I made step by step. |
I've come up with two solutions (with the help of @from-nibly ), both of which are in the latest release:
As for point 1, you can now escape the popup commit message panel and reopen it without losing what you wrote @ponsfrilus if you use the shift+C approach your commit.template will be used Let me know if you guys have any concerns/questions :) |
Cool for the shift+C. I have to say that I was used to TAB to switch pane (as for the down arrow). |
Yeah it's not an ideal situation, but I can't really think of any other key that you're unlikely to need in actually typing the commit message. gocui uses termbox under the hood so the best you get from it is using the alt key (or maybe it's the command key I'm not really sure) but that's already linked to all kinds of stuff with people's individual hotkeys |
Yeah I saw that when I lookup why shift+tab wasn't doing the opposite of the tab key. Termbox just doesn't implement that and it doesn't feel that simple to add it... |
Yeah it would really make a difference having shift as as 'modifier'. People could use shift+down instead of right to go to the next panel for example. Ah well |
I agree, Shift+Enter would be great, but I'm personally fine with Tab for now. I just tried it out and I'm happy with it, so I'm closing the issue. Thank you for the quick response and the good work! I've been using lg over the past week and I've enjoyed it. |
I know this is closed but what if you went with vim keys instead. q to close the commit while clearing the message, esc to save the message but close the window, w to commit, and enter for newlines? |
@from-nibly this wouldn't just be a matter of rebinding keys: it requires a sense of 'mode' to be stored so that when you're in insert mode and press 'q' it actually prints a 'q' rather than close the panel. I'd happily merge a PR that implements this :) |
I know that this issue is closed, but I stumbled upon an inconsistency in the UI, so I wanted to mention it here first before opening a new issue. The multiline comment behavior differs between the Commits > "reword commit" action and the Files > "commit" action. In the first one, wrapping happens automatically, but in the second one, I need to use the If you intended this difference in behavior, then I don't mind it enough to propose changing it. :) |
Furthermore, while rewording already existing multi-line commits, I cannot navigate to lines below the first one, I can only enter new newlines with tab. |
@juligreen you can rename commits in an external editor via @jbrains I agree the two interfaces should be the same. Would you prefer wrapping in both cases? |
Thank you, and sorry for not reading the keybindings properly! |
@jesseduffield Hm! I'm not sure. I think I prefer manual wrapping (so as to avoid eventual configuration settings and resulting bikeshedding), but then |
What about the opposite? In a textarea ENTER add a new line.
Le mar. 13 oct. 2020 à 16:09, J. B. Rainsberger <notifications@github.com>
a écrit :
@jesseduffield <https://github.com/jesseduffield> Hm! I'm not sure. I
think I prefer manual wrapping (so as to avoid eventual configuration
settings and resulting bikeshedding), but then TAB is a fairly unexpected
character to use to insert a newline. I would expect to use Shift+ENTER,
for example, to insert a newline in the middle of a commit comment when
ENTER behaves as "submit".
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFH6RQUHLJIULIZV4OX2CTSKRNR7ANCNFSM4FN67Q5A>
.
--
Damien Snoeck
|
If shift+enter were a permissible key I would certainly use that, but we're in an unfortunate situation where we can't really use enter with any modifier key (shift/cmd/ctrl). Luckily the keybindings are configurable in the latest release so you can remap the 'appendNewLine' and 'confirm' keybindings in the commit message panel to whatever you want. As for defaults, I think most people only write commits with a single line so enter would be better for them. If we made enter append a newline by default, users would get confused about how to submit the commit message. I completely agree that using 'tab' to enter a newline is awkward though. Maybe there could be some other key to toggle you in and out of multiline mode where enter either appends a newline or submits the message depending on the mode you're in. |
(just realised that branch actually isn't merged yet but SOON those keys will be configurable) |
@jesseduffield Thank you for describing the constraints; I didn't know about them. Given those constraints, I don't think I'd have decided significantly differently. I strongly agree with optimizing the user experience for a single-line commit message. I don't remember what it felt like to learn that Thank you. |
@jbrains good to hear :) Could you raise an issue about the inconsistency? |
Maybe enter for new line, enter-enter to commit? So we could have both ways, just remove last newline on enter-enter and here we go, on single line commit messages we just need to press enter twice. On multiline messages, after last line press enter twice. |
Allows users to dynamically increase or decrease the height of the commit message window by using the up & down arrows. Pressing the down arrow when the cursor is on the last line of the window increases the height of the window. Pressing the up arrow when the cursor is on the last line, AND the last line is blank, decreases the height of the window by one line. Relates to: jesseduffield#28
What about using the up & down arrow keys to dynamically resize the commit message window? I understand the reasoning behind using to insert a newline, but it still feels a little weird to me. My initial spike using up/down to resize the window is here: #1204 |
@sl4mmy thanks for making that PR, I gave it a test and it seems straight-forward enough. I'm interested to gauge other people's thoughts on that approach too. I did some digging myself and found that using the tcell library we can handle an alt+enter key combination. I've got a branch up that I'm yet to complete which switches our terminal dependency to tcell and I've made a spike PR off that for a POC. Let me know your thoughts: #1207 |
This sounds promising. I'm certainly happy to try it. |
Is supposed to work at the moment for adding a newline to the commit? This is currently not working for me. (lazygit 0.29) |
Just tried using |
@anvandaren I don't actually recall removing the 'tab' key but it looks to indeed be removed. You should be able to use cmd+enter on mac or alt-enter on windows to get the same behaviour now |
@jesseduffield Ok thanks, |
I am unable to use |
@WolffTech you should be able to get back the old behaviour in the config with: keybinding:
universal:
appendNewline: '<tab>' |
On windows, alt+enter is the conventional default to toggle fullscreen and it's the case for conhost, windows terminal, and alacritty in my testing. In windows terminal I removed the keybinding in As for alacritty, you can rebind key_bindings:
# From the docs: "To unset a default binding, it can be mapped to the `ReceiveChar` action."
- { key: Return, mods: Alt, action: ReceiveChar } No idea about conhost. Hope this helps someone. |
speaking of which, I'm looking at that PR right now, hoping to address a couple remaining issues |
Ah, thanks for the hint. I'm new to lazygit and don't follow lazygit development (yet) so I had no clue there was movement in this area. :) Thanks for making it happen! |
There should be a way to write multi-line commit messages. For example, you could use Enter for newlines and Shift+Enter to commit.
The text was updated successfully, but these errors were encountered: