Skip to content

Conversation

bart2
Copy link

@bart2 bart2 commented Jul 19, 2025

This PR implements #3575

I find fzf a very convenient way to search shell history and was missing that functionality in aider.

Demo showcasing fzf based reverse history search in aider with ctrl-r:

Screen.Recording.2025-07-19.at.1.45.31.PM.mov

@CLAassistant
Copy link

CLAassistant commented Jul 19, 2025

CLA assistant check
All committers have signed the CLA.

@veracioux
Copy link

Hi @bart2. Does this also add a configuration option in the config files? Sorry if it's a stupid question, I'm still in the early stages of getting familiar with the codebase.

@bart2
Copy link
Author

bart2 commented Jul 20, 2025

Hi @bart2. Does this also add a configuration option in the config files? Sorry if it's a stupid question, I'm still in the early stages of getting familiar with the codebase.

Yeah, the test above was done with the following in the .aider.conf.yml config file:

fzf-history-search: true

I didn't pass the command line option.

@meliache
Copy link

meliache commented Jul 20, 2025

Is there anything to this fzf-specific except the subprocess command? I think it would be a more general interface to have a history_command option. Then, in the configuration, the user could specify:

history_search_command: ["fzf", "--reverse", "--height", "20"]

Advantages

  • the user can customize the fzf cli options, e.g. choose a different height, without any need for additional configuration options
  • the user could easily use a different fuzzy finder, e.g. skim
  • if no history search command is provided, the revert to the default behaviour.
  • according to "A Philosophy of Software Design" by John Ousterhout, interfaces should be as general and simple as possible. A config is also an interface.

Disadvantages

  • Enabling fzf history search is quite complex this way. If you e.g. want to enable it on the command line via --history-search-command, you would need to provide all fzf cli options correctly, not sure how practical it is
  • If you use a different fuzzy searcher, it might not work if the output is formatted differently than the fzf-output
  • The above two options mean that such an option should be documented well, maybe with the fzf-command provided as an example.

Alternative: Keep the current code, but make the cli option --history-search fzf

I think it's fine only adding fzf support for now with the code as it currently is in the PR, but in the future somebody might want to add support for a different fuzzy finder. So instead of having a fzf_history_search boolean option, I think it would be better having a history_search: Literal["default", "fzf"] option and add the choices to the cli via click.option("history_search", choices=["default", "fzf"], ...), so that the user can do --history-search fzf. Just implementing this would require very little changes to this PR. But then, if e.g. skim-support is added in the future, there would be no need in introducing a new cli flag (and to think what happens if both fzf and skim are flags are true), but just an additional option.

DISCLAIMER: I'm not an aider developer/maintainer, so don't take this comment as blocking. I'm just a programmer and aider user, as well as a fan of fuzzy search and good cli's. So when I saw this PR I decided to take a look. Having fuzzy history search would be awesome!

@vk4s
Copy link

vk4s commented Jul 21, 2025

If anyone's interested. I have added history search feature in #4344.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants