I sourced the /usr/share/doc/fzf/examples/key-bindings.bash file so fzf works in Bash; but how do you get that to work with the rlwrap ed approach?
1 Answer
This question is mainly about using rlwrap and fzf together, and only circumstantially about ed.
rlwrap has limited support for fzf, but you can actually get them to work together, albeit with some restrictions.
To get rlwrap to use fzf, you would rely on one of rlwrap's "filters" (see the section of the manual describing -z or --filter) called handle_hotkeys (since rlwrap 0.44).
$ rlwrap -z handle_hotkeys grep: /home/myself/.inputrc: No such file or directory Usage: rlwrap -z handle_hotkeys <command> handle hotkeys (but only if bound to 'rlwrap-hotkey' in your .inputrc): \C-f: use fzf to choose from history entries that match current input before cursor \C-n: edit current history with 'vi +%L' - add empty line (lines) to select (accept) the following line \C-p: use peco to choose from history entries that match current input before cursor \C-t: show current time in echo area \C-y: insert from clipboard \M-\C-m: show current time in echo area Currently bound hotkeys in /home/myself/.inputrc: Here we see that we can bind Ctrl+f (rather than Ctrl+r) to the function rlwrap-hotkey to trigger fzf.
Example .inputrc file:
$if ed C-f: rlwrap-hotkey $endif Example rlwrap+ed invocation:
$ rlwrap -z handle_hotkeys ed file To initialise Bash keybindings for fzf, instead of sourcing a file deep within fzf's directories (which may be in a different place on different systems), just use
eval "$(fzf --bash)"
rlwrap edapproach". What do you want to do? My idea of whatfzfdoes is a bit fuzzy.edto invokefzf?