Skip to content

Support search pattern in history-pager #10131

@shouya

Description

@shouya

Fish version: 3.6.1

I just migrated from zsh to fish and was generally very happy with it. However, one feature I am missing a lot was the ability to type search patterns in the "reverse-i-search" (aka "history-pager" in fish, bound to C-r by default). Although this feature needs to be enabled by binding history-incremental-pattern-search-backward as described here, I usually have it bound when configuring my zsh.

Put simply, this feature enables one to type the * as a wildcard during the incremental search session, which matches against arbitrary string. For example, input A*B matches string AwhateverinbetweenBandpossiblemoreafterwards.

Why is this feature so useful? Let me demonstrate a common use case. I typically have a lot of curl commands in the history. Typically, I have quite a number of varying options between the curl command and the <url>. However, when I am trying to recall a specific history entry, I usually only remember the two pieces of information: curl and the domain name I want. This is when I would search for stuff like curl*google and hope the results to be narrowed down significantly.

Now without this feature, what I have to do is to type C-r curl, scroll through the myriads of irrelevant history, and hope to find what I want somewhere. If that fails, I may have to fall back to running history search curl | grep google, which is also quite a lot of keystrokes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions