Integrate fzf with IRB's reverse search (Ctrl+R) for a better command history search experience.
- Replace IRB's default reverse search with fzf's fuzzy finder
- Support for multiline commands
- Fast and intuitive search through command history
- Unique command filtering (no duplicates)
- Easy to enable/disable
You need to have fzf installed on your system:
# macOS
brew install fzf
# Ubuntu/Debian
sudo apt install fzf
# Other systems: https://github.com/junegunn/fzf#installationAdd this line to your application's Gemfile:
gem 'irb-fzf-history'And then execute:
bundle installOr install it local bundle as:
gem install irb-fzf-historyAdd the following to your ~/.irbrc file:
require 'irb-fzf-history'
IRB::FZF::History.enable!That's it! Now when you press Ctrl+R in IRB, you'll get fzf's fuzzy search interface instead of the default reverse search.
You can disable fzf temporarily without modifying your .irbrc:
USE_FZF_REVERSE_I_SEARCH=false irbYou can also enable/disable fzf integration programmatically:
# Enable fzf integration
IRB::FZF::History.enable!
# Disable fzf integration (restore default behavior)
IRB::FZF::History.disable!
# Check if fzf is available
IRB::FZF::History.fzf_available?This gem monkey-patches Reline's vi_search_prev method (triggered by Ctrl+R) to use fzf instead of the built-in reverse search. It properly handles:
- Multiline commands (commands ending with
\) - Command history deduplication
- Graceful fallback to default behavior if fzf is not available
After checking out the repo, run bundle install to install dependencies.
Bug reports and pull requests are welcome on GitHub.
The gem is available as open source under the terms of the MIT License.