From: Alexander Barton Date: Sun, 29 Mar 2020 23:19:28 +0000 (+0200) Subject: New "fzy" plugin X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ax-zsh.git;a=commitdiff_plain;h=add56a5b9f3d7bb84ec505fc43c10256979e51a9 New "fzy" plugin --- diff --git a/plugins/fzy/README.md b/plugins/fzy/README.md new file mode 100644 index 0000000..afd82ec --- /dev/null +++ b/plugins/fzy/README.md @@ -0,0 +1,11 @@ +## fzy + +Integrate *fzy*, "a simple, fast fuzzy finder for the terminal", into ZSH. + +### Usage + +Integrate *fzy*(1) into ZSH. + +### Key Bindings + +- `CTRL-R`: Paste the selected command from history into the command line. diff --git a/plugins/fzy/fzy.zshrc b/plugins/fzy/fzy.zshrc new file mode 100644 index 0000000..f831e2a --- /dev/null +++ b/plugins/fzy/fzy.zshrc @@ -0,0 +1,18 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# fzy.zshrc: Setup Git + +axzsh_is_modern_terminal || return 91 + +# Make sure that "fzy(1)" is installed +(( $+commands[fzy] )) || return 1 + +function history-fzy() { + BUFFER=$(fc -lnr 0 | fzy -l $((LINES/2)) -q "$LBUFFER") + CURSOR=$#BUFFER + zle reset-prompt +} + +zle -N history-fzy +bindkey '^r' history-fzy + +return 0