lazygit
lazygit copied to clipboard
Custom commands prompt type with multiline support
Hi,
I would like to adapt the custom command with conventional commit templates to add a step for writing a multiline description.
To do this, I am looking for a prompt type that could be used to input text on more than one line, like we have when committing (i.e. the prompt below the commit title).
Thanks
Are you thinking about the Custom command
popup when you press :
or the predefined custom commands you have in your config.yml
?
Predefined custom commands do support multiple lines, you just need to write them like this (>-
):
- key: 'D'
command: >-
echo "line1" &&
echo "line2"
context: 'localBranches'
stream: true
I don't think we document it anywhere, though :thinking:
Thanks for your answer :)
This is useful to know, but I think I might have been misunderstood...
I am talking about the predefined custom commands I can configure in config.yaml
. At least I need to pop up a prompt in which the user can write multiple lines of text. Ideally, I need to pop up a prompt exactly like the standard commit prompt which is in two parts (a one-line box, and a multi -line box below), and getting the text as a result keys from this prompt.
Ah, now I get it.
Currently we don't have something like that, but (at a glance) it shouldn't be too difficult to implement.
Would you maybe be willing to investigate this? (you can say no :) )
cool :)
I have to say no, learning go is not checked on my wish list yet... ;-)
Overall I think that a generic prompt supporting multi-line text could be more suitable as a custom command prompt type, rather than a mixed one-line / multi-line prompt which is more specific.
Overall I think that a generic prompt supporting multi-line text could be more suitable as a custom command prompt type, rather than a mixed one-line / multi-line prompt which is more specific.
Agreed, but the benefit of the mixed one is the confirmation
vs newline
problem is solved.
We use Enter
for both, but when in the single-line
prompt it means "Confirm", while in the mult-line
prompt it means \n
.
If we had only the multiline, then we'd have to figure out how to actually confirm the input or how to add newlines and sacrifice some other key.
Ah yes right! 😄
And I must say that it's a very good mechanism, it was very intuitive for me the first time I used it.
Hi, I created PR for a multiline supported prompt and named it textbox
Please review this. Thank you 😄
Thanks @yongjoon-km , it works :)
Regarding @mark2185 comment, I see you chose <a-enter>
as a key combination to confirm the multi-line textbox.
Works great for me, but could it be a problem if the combination is already associated somewhere in lazygit or system wide?
Thanks @yongjoon-km , it works :)
Regarding @mark2185 comment, I see you chose
<a-enter>
as a key combination to confirm the multi-line textbox.Works great for me, but could it be a problem if the combination is already associated somewhere in lazygit or system wide?
Hi @Djedouas, I chose confirmInEditor
keybinding in lazygit which is default <a-enter>
.
If <a-enter>
is being used in system wide, user should map another key as confirmInEditor
.
Note that this keybinding is also used in the commit description prompt.
Or <a-enter>
might be used by another keybinding in lazygit, then proper keybinding must be set for confirmInEditor
keybinding.
Also, the description of textbox prompt on the top right corner is applied by keybinding's key name.
Great that sounds perfect 😃