This script uses fzf
to complete flags from
your history by typing <c-q>
.
This relies on fzf
, so make sure you have that installed.
The script assumes that you have gawk
and rg
(i.e.
ripgrep
) installed and on your path.
Also, normally <c-q>
is already bound to a command. It is the counterpart to
<c-s>
, which I wouldn't be surprised if at some point you've accidentally
entered and then wondered why your terminal was frozen. I've disabled <c-s>
by
putting this in my zshrc
:
stty -ixon
If you want to keep default <c-q>
behavior, you'll need a different trigger.
After all the dependencies are out of the way, source fzf-complete-flags.zsh
.
I have this block in my zshrc
:
# Make sure you clone this first on new installations:
# git clone https://github.com/srsudar/fzf-complete-flags ~/.zsh/fzf-complete-flags
if [ ! -f ~/.zsh/fzf-complete-flags/fzf-complete-flags.zsh ]; then
echo "fzf-complete-flags.zsh not found--did you clone the repo?" >&2
else
source ~/.zsh/fzf-complete-flags/fzf-complete-flags.zsh
fi
This began as an issue on the
main fzf
repo. This blog
post describes what
the script does.