You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow multiline commit messages when using a custom .cz.toml #264
I would like to be able to write multiline commit messages, however this does not seem to be possible when configuring commitizen using .cz.toml.
Possible Solution
Based off of #74 it seems to work when you customize commitizen via a class, however the filter parameter in .cz.toml doesn't seem to work for this use case currently (it gives me ValueError: 'filter' needs to be function that accepts an argument no matter what I input).
One suggestion would be if you could enclose your commit message in double quotes, and any enter keypress within those double quotes would just input a newline to the commit message instead of ending the text input. Another suggestion would be if you could specify a parameter multiline or similar which upon asking the question opens up a default editor (nano/vim) where the user writes their message, just like how git does with git commit.
Probably we should add some notes to the prompt information? If it is possible, please feel free to assign this issue to me.
And I can also try to enhance this feature by enclosing the commit messages in single/double quotes so that it could accept the multiline messages more intuitivly.
IMO, I image the behavior of using quotes should work like entering value contain multi-line words in echo parameter.
So, if the message body is This "line" should not break, the body message will display as the same words but removing the quotes, like This line should not break. And it is required to add a backslash before the quote so that we could identify the quotes should be contained in the body message. On the other hand, if there is a newline character entering between the quotes. we should allow the user keep typing in the new line. Just like following screenshot:
I'm neutral to this one since multiple-line does not bother me at all recently haha. I'm curious whether there's tool that can help us make this echo behavior happen easier.
If you add | to your body (but not scope), it will be turned into a break line.
I assume this is something that needs to be configured manually if you're using a customized config? That's what I'm doing, and the | character is not being translated into a newline character for me.
Right, that's what I was trying to do with the filter parameter in the .toml config, but it didn't seem to be possible. Does this only work via the custom class configuration?
I was also curious about this feature and I did a little bit of digging around and found that Questionary was used to prompt the user to input commit information. So I had a look at Questionary and it looks like there's an option to enable multiline input there!
@Lee-W Do you think it would be possible to use that option in commitizen? I haven't tested this feature of Questionary myself though, so it might not be what I think it is either 🤔
Thanks @marier-nico ! Didn't notice this cool new feature.
But the behavior would change a bit. If we apply this, we'll need to type Esc, Enter or Alt, Enter when we type the message. Another idea is making it configurable. If not enabled, we'll keep the original | behavior. @woile What do you think?
Reacted by Nicolas Marier, Wilson Josix Wang and jtpavlock
For a normal flow it may be too disruptive, you want to move fast by pressing enter, I think the multiline should be enabled as a config indeed, set to False by default.
It seems we'd better wait for the latest questionary version. tmbo/questionary#109 Otherwise, we'll need to bound the python version to ">=3.6.1,<3.10"
One solution would be to allow passing of flags used by git commit via git cz commit (eg. git cz commit -e or git cz commit -- -e).
This is what I've been using for cz-cli.
Hi @arunanshub , the feature you propose was actually discussed on #248.
But the problem of this issue I that we did not make our cz rules highly configurable except cz_cutsomize.
Activity
Lee-W commentedon Sep 9, 2020
If you add

|to your body (but not scope), it will be turned into a break line. This feature is not well documented at this moment.josix commentedon Sep 9, 2020
Probably we should add some notes to the prompt information? If it is possible, please feel free to assign this issue to me.
And I can also try to enhance this feature by enclosing the commit messages in single/double quotes so that it could accept the multiline messages more intuitivly.
Lee-W commentedon Sep 10, 2020
Yes, we definitely should improve the message. Thanks for your help 🙂
I'm not sure the idea of the quote is what we wanted. What is the expected behavior if we have a
This "line" should not breakmessage?josix commentedon Sep 10, 2020
IMO, I image the behavior of using quotes should work like entering value contain multi-line words in

echoparameter.So, if the message body is
This "line" should not break, the body message will display as the same words but removing the quotes, likeThis line should not break. And it is required to add a backslash before the quote so that we could identify the quotes should be contained in the body message. On the other hand, if there is a newline character entering between the quotes. we should allow the user keep typing in the new line. Just like following screenshot:Lee-W commentedon Sep 10, 2020
I'm neutral to this one since multiple-line does not bother me at all recently haha. I'm curious whether there's tool that can help us make this
echobehavior happen easier.josix commentedon Sep 10, 2020
Yeah, I also have concern about it. I should make some survey.
FelixAbrahamsson commentedon Sep 10, 2020
I assume this is something that needs to be configured manually if you're using a customized config? That's what I'm doing, and the
|character is not being translated into a newline character for me.Lee-W commentedon Sep 10, 2020
@FelixAbrahamsson Yes, it uses the filter here
FelixAbrahamsson commentedon Sep 10, 2020
Right, that's what I was trying to do with the
filterparameter in the.tomlconfig, but it didn't seem to be possible. Does this only work via the custom class configuration?Lee-W commentedon Sep 10, 2020
I think custom class configuration should work in this case
blaggacao commentedon Oct 3, 2020
Wouldn't it just be possible to work with a proper heredoc for this?
Using
|still is very uncomfortable to properly format a paragraph.marier-nico commentedon Jul 8, 2021
I was also curious about this feature and I did a little bit of digging around and found that Questionary was used to prompt the user to input commit information. So I had a look at Questionary and it looks like there's an option to enable multiline input there!
Relevant Questionary docs: https://questionary.readthedocs.io/en/stable/pages/types.html#type-text
@Lee-W Do you think it would be possible to use that option in commitizen? I haven't tested this feature of Questionary myself though, so it might not be what I think it is either 🤔
Lee-W commentedon Jul 9, 2021
Thanks @marier-nico ! Didn't notice this cool new feature.
But the behavior would change a bit. If we apply this, we'll need to type
Esc, EnterorAlt, Enterwhen we type the message. Another idea is making it configurable. If not enabled, we'll keep the original|behavior. @woile What do you think?woile commentedon Jul 9, 2021
For a normal flow it may be too disruptive, you want to move fast by pressing
enter, I think the multiline should be enabled as a config indeed, set to False by default.Lee-W commentedon Jul 9, 2021
Same thought. I'll work on this one 💪
Lee-W commentedon Jul 9, 2021
It seems we'd better wait for the latest questionary version. tmbo/questionary#109 Otherwise, we'll need to bound the python version to ">=3.6.1,<3.10"
Lee-W commentedon Jul 9, 2021
I think to implement this feature we'll need to make cz configurable which might related this issue #395
arunanshub commentedon Jul 29, 2021
One solution would be to allow passing of flags used by
git commitviagit cz commit(eg.git cz commit -eorgit cz commit -- -e).This is what I've been using for
cz-cli.Lee-W commentedon Aug 3, 2021
Hi @arunanshub , the feature you propose was actually discussed on #248.
But the problem of this issue I that we did not make our cz rules highly configurable except cz_cutsomize.
ciscoski commentedon Jan 20, 2023
Hello there,
Is there any news on this ?
Thanks
Lee-W commentedon Jan 21, 2023
Hi @ciscoski , unfortunately, 'm out of bandwidth. Feel free to send us a PR. Thanks!
marcosdotme commentedon Jul 4, 2023
@ciscoski @FelixAbrahamsson @Lee-W
I'm creating an custom plugin as a Python module as mentioned on documentation here.
So, since commitizen is based on questionary we can pass the keyword argument multiline=True for each question that we have. For example:
I also tested the same behavior configuring the questions through a file:
Using this plugin:
This is the result: