Skip to content

Feature request: delete history entries during Ctrl+R shell history search #4715

Description

@og900aero

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.70.0 (eacef5e)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

It would be great to have a built-in way to delete shell history entries directly from the Ctrl+R interactive search, without leaving the fzf interface.

Current behavior:
When using fzf for shell history search (Ctrl+R), there is no way to delete an entry from history. The user has to exit, manually find the line number via history, delete it with history -d <n>, and repeat — which is tedious, especially since line numbers shift after each deletion.

Desired behavior:
While browsing history with Ctrl+R, the user could press a key (e.g. Del or F8 or ) to delete the currently selected entry from history, and the list would refresh in place — similar to how hstr handles deletion, but integrated into the fzf Ctrl+R flow.

Why this is tricky:
The main challenge is that history -d only works in the current shell process. Actions triggered via --bind execute or execute-silent run in a subshell, so history modifications don't propagate back to the parent shell. A native fzf mechanism (e.g. a delete-history action) would be needed to work around this limitation cleanly.

Workaround:
A bash wrapper function using a while loop around fzf with --tac and --multi can approximate this behavior, but it requires exiting and re-entering fzf after each deletion round, which is not seamless.

A native solution in fzf would make it the definitive interactive history manager for shell users.

Metadata

Metadata

Assignees

Labels

enhancementEnhancement to existing featureshellShell scripts

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions