Skip to content

cz commit should let you type / search for the type of change you are commiting. #1921

Description

@snus-kin

Description

As a user I would like to be able to e.g. type 'fi' and 'fix' be highlighted. or 're' and 'refactor' be highlighted to save pressing the down arrow to get to the type I wish to select.

Possible Solution

No response

Additional context

No response

Related issues

No response

Activity

  1. ttw225 commented on Apr 2, 2026

    @ttw225
    Contributor

    Hi, here’s one solution that may help.

    You can enable use_shortcuts in your configuration, which lets you select options more quickly with shortcuts.

    Also, a bit of context that may be useful: Commitizen’s interactive prompts are built on top of tmbo/questionary.
    Based on your description, this seems more related to Questionary’s autocomplete prompt type.

    If you need to further customize the question types, you may want to use the Python class customization approach.

  2. snus-kin commented on Apr 2, 2026

    @snus-kin
    Author

    Thanks, this is a bit of a start but doesn't work 100% amazingly. Might be useful for some other people though.

    from commitizen.cz.conventional_commits import ConventionalCommitsCz
    from prompt_toolkit.shortcuts import CompleteStyle
    
    
    class CzCustomCz(ConventionalCommitsCz):
        def questions(self):
            questions = super().questions()
    
            for q in questions:
                if q.get("name") == "prefix":
                    q["type"] = "autocomplete"
                    if "choices" in q:
                        q["choices"] = [
                            c["name"] if isinstance(c, dict) else c for c in q["choices"]
                        ]
                    q["match_middle"] = True
                    q["ignore_case"] = True
                    q["complete_style"] = CompleteStyle.MULTI_COLUMN
                    q["complete_while_typing"] = True
                    break
    
            return questions
    
    
    discover_this = CzCustomCz

    I think what I really want is a fzf lookup in the types but maybe this is just a limitation of questionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions