Skip to content

Allow a command to include history as a completion source #4344

@mqudsi

Description

@mqudsi

Perhaps for fish 3.0 we can include support for a completion script to indicate that its completions should come from fish's history file, so that tabbing would provide a list of matches from history. A lot of commands do not have local file completions, but are often used and reused from within a certain set of arguments, this would be a huge convenience for such commands.

To illustrate with a real-life example, I use autojump religiously (aliased to j as their setup routine does automatically under all supported shells). j watches your directory changes and learns what directories you use, so that when you type in - from any CWD - j foo it will take you to the directory you use most often that matches search pattern foo (even if foo is misspelled, an abbreviation, etc).

What would be amazingly convenient is if my previous usage of j were to be considered potential completions. So when I type in j f<TAB>, history entries such as j fish and j fish-shell could provide completions for the current command line, and the completions suggestions would list fish and fish-shell as options.

Other commands that I feel might benefit from this are ssh, ping, and other similar commands that are a) run often against the same targets, b) don't have "tangible" completions.

Additionally, any command that does not have completions but has history entries (basically while you are typing you get the ghost completion) can use this to complete from history, too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions