Skip to content

Ctrl-r for shell history but also bulk select and remove from history #3629

Answered by LangLangBart
rieje asked this question in Q&A
Discussion options

You must be logged in to vote

This setup requires 3 things:

  • a modified fzf-history-widget
  • the assigned FZF_CTRL_R_OPTS environment variable with a complex keybinding for deletion and
    reloading
  • assigned HISTFILE, HISTSIZE, and SAVEHIST environment variables

Note

The values assigned to FZF_CTRL_R_OPTS can also be incorporated into the modified
fzf-history-widget. However, I found this method simpler to avoid complications with quotation
marks.

If you place everything in your .zshrc, after sourcing the fzf/shell/key-bindings.zsh file,
it should work seamlessly. The history will always be read from your $HISTFILE, thus I also set
these options:

setopt INC_APPEND_HISTORY  # Write to the history file immediately, not whe…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@andrevmatos
Comment options

@LangLangBart
Comment options

@enoryw
Comment options

@mattmc3
Comment options

@YasserKa
Comment options

Answer selected by rieje
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants