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
Copy file name to clipboardExpand all lines: docs/customization/config_file.md
+44-4Lines changed: 44 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,7 +188,47 @@ Example:
188
188
189
189
### Shortcut keys
190
190
191
-
When the `use_shortcuts` config option is enabled, Commitizen can show and use keyboard shortcuts to select items from lists directly.
192
-
For example, when using the `cz_conventional_commits` Commitizen template, shortcut keys are shown when selecting the commit type.
193
-
Unless otherwise defined, keyboard shortcuts will be numbered automatically.
194
-
To specify keyboard shortcuts for your custom choices, provide the shortcut using the `key` parameter in dictionary form for each choice you would like to customize.
191
+
For a basic overview of `use_shortcuts` and how the default menu looks, see the [`use_shortcuts` option](../config/option.md#use_shortcuts).
192
+
193
+
#### `use_shortcuts` with `cz_customize`
194
+
195
+
When using `cz_customize`, enabling `use_shortcuts` lets you set an optional `key` for each list/select choice so that choice shows your chosen shortcut. Rules below.
196
+
197
+
Example:
198
+
199
+
```toml title="pyproject.toml"
200
+
[tool.commitizen]
201
+
name = "cz_customize"
202
+
use_shortcuts = true
203
+
204
+
[tool.commitizen.customize]
205
+
message_template = "{{prefix}}: {{message}}"
206
+
schema = "<type>: <body>"
207
+
schema_pattern = "(feat|fix|docs|test):(\\s.*)"
208
+
209
+
[[tool.commitizen.customize.questions]]
210
+
type = "list"
211
+
name = "prefix"
212
+
message = "Select the type of change you are committing"
213
+
choices = [
214
+
{ value = "feat", name = "feat: A new feature.", key = "f" },
215
+
{ value = "fix", name = "fix: A bug fix.", key = "x" },
216
+
{ value = "docs", name = "docs: Documentation only changes", key = "d" },
217
+
{ value = "test", name = "test: Adding or correcting tests", key = "t" }
218
+
]
219
+
220
+
[[tool.commitizen.customize.questions]]
221
+
type = "input"
222
+
name = "message"
223
+
message = "Commit body: "
224
+
```
225
+
226
+

227
+
228
+
**Rules for `key`**
229
+
230
+
| Rule | Description |
231
+
|------|-------------|
232
+
| Allowed | Lowercase `a`–`z` or digits `0`–`9` only |
233
+
| Uniqueness | Each `key` must be unique among all choices |
234
+
| Optional | Omit `key` to use default numeric order (1, 2, 3, …) |
0 commit comments