junegunn / junegunn/fzf

I need help to remove entries from history

Open
#3,522 16 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
83.1k
Forks
3.1k
Avg merge
17h 8m
Merged PRs (30d)
10

Description

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

For some days now, I'm trying to implement a shortcut into the CTRL-R function, unfortunately to no avail. What I'm trying to achieve is the ability to remove commands from history (enabling multiselection too), within the fzf view; refreshing the fzf results once done.

This is the farthest I could go:

~/.zshrc
export FZF_CTRL_R_OPTS="--bind=\"ctrl-d:execute-silent(awk '{print \$1}' {+f1..} | while read -r linenum; do sed -i "\${linenum}d" "$HISTFILE"; done),ctrl-d:+refresh-preview\" --header \"CTRL-D to remove command from history\""

it can successfully delete the highlighted command from history file but:

  • multiselection do not work (I even enabled -m in /usr/share/fzf/key-bindings.zsh but it still remove the first selected element only)
  • I don't know how to implement the results refresh (I should add something like ctrl-d:+reload(command here)?

Thank you, amazing piece of software

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CTRL-R setup in ~/.zshrc and the binding implementation in /usr/share/fzf/key-bindings.zsh. Read the fzf binding and reload documentation, then reproduce the single- and multi-selection behavior in a Linux zsh session. Done means selected history entries are removed safely and the view refreshes with the remaining entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
awk, zsh
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.