From add56a5b9f3d7bb84ec505fc43c10256979e51a9 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 30 Mar 2020 01:19:28 +0200 Subject: [PATCH] New "fzy" plugin --- plugins/fzy/README.md | 11 +++++++++++ plugins/fzy/fzy.zshrc | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 plugins/fzy/README.md create mode 100644 plugins/fzy/fzy.zshrc 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 -- 2.39.2