Skip to content

Add auto suggestion feature #1545

Closed
Closed

Description

@ryanmerolle

Summary

Add support for "ghost hints" - a visual completion suggestion that appears as greyed-out or faded text after the user's current input, showing the most likely next completion without requiring the user to press Tab or complete it.

Use Case

This feature improves user experience by providing predictive guidance. As users type commands or arguments, they can see a hint for what cmd2 predicts they might want to complete next, similar to features in:

  • Fish shell's autosuggestions
  • IDE autocomplete ghosts
  • Command-line tools like fzf

Expected Behavior

  • When a user types a partial command or argument, cmd2 shows a faded/greyed-out suggestion of the most likely completion
  • The hint appears without interfering with what the user has typed
  • Users can press a key (Tab) to accept the suggestion
  • If the suggestion is incorrect, the user can simply continue typing and the hint updates
  • The feature should be optional and configurable (can be enabled/disabled)

Implementation Considerations

  • Integrate with cmd2's existing completion system
  • Make styling/appearance configurable

Activity

  1. github-actions commented on Dec 23, 2025

    @github-actions
    Contributor

    🤖 Hi @ryanmerolle, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

  2. github-actions commented on Dec 23, 2025

    @github-actions
    Contributor

    🤖 I'm sorry @ryanmerolle, but I was unable to process your request. Please see the logs for more details.

  3. changed the title [-]Add ghost hinting / completion feature[/-] [+]Add auto suggestion feature[/+] on Dec 23, 2025
  4. tleonhardt commented on Dec 23, 2025

    @tleonhardt
    Member

    @ryanmerolle
    Hey Ryan,

    Thanks for feature suggestion! Soon we will start working on our 4.0.0 release and for this the main change is we intend to migrate to using prompt-toolkit for our tab-completion capabilities. prompt-toolkit has good support for auto suggestion capabilities similar to those provided by the fish shell.

    I updated Issue #1538 to include investigating adding this capability once we migrate to prompt-toolkit. I'll leave this issue open as well for tracking.

    If you have the skill, time, and motivation to help we would be very happy to review a Pull Request.

  5. tleonhardt commented on Jan 25, 2026

    @tleonhardt
    Member

    PR #1553 which adds support for prompt-toolkit also adds a new auto_suggest boolean parameter to cmd2.Cmd. If True, then fish shell style auto-suggestions will be shown based on history. The user can press the right arrow key to accept the auto-suggestion.

    This works best when persistent history is used.

  6. ryanmerolle commented on Jan 25, 2026

    @ryanmerolle
    Author

    PR #1553 which adds support for prompt-toolkit also adds a new auto_suggest boolean parameter to cmd2.Cmd. If True, then fish shell style auto-suggestions will be shown based on history. The user can press the right arrow key to accept the auto-suggestion.

    This works best when persistent history is used.

    Surely impressive turnaround! Thanks!! I cannot wait to experiment.

  7. tleonhardt commented on Jan 26, 2026

    @tleonhardt
    Member

    @ryanmerolle
    Feel free to test it out if you like on the prompt-toolkit branch. Currently we are defaulting auto_suggest to True, so most of the examples under examples/ are using it. We may change that default before release based on testing and feedback. If you test it out, feel free to let us know what you think.

  8. ryanmerolle commented on Jan 27, 2026

    @ryanmerolle
    Author

    The feature works as expected. Thanks!

  9. tleonhardt commented on Feb 4, 2026

    @tleonhardt
    Member

    I'm going to close this. This feature will be in our 4.0.0 release once we get that out. We have some more tweaking we need to do before that is ready.

  10. ryanmerolle commented on Feb 5, 2026

    @ryanmerolle
    Author

    I was actually going to close this myself this morning.

    I am excited for the v4 release and I appreciate all your work!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions