]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "fzy" plugin
authorAlexander Barton <alex@barton.de>
Sun, 29 Mar 2020 23:19:28 +0000 (01:19 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 29 Mar 2020 23:19:28 +0000 (01:19 +0200)
plugins/fzy/README.md [new file with mode: 0644]
plugins/fzy/fzy.zshrc [new file with mode: 0644]

diff --git a/plugins/fzy/README.md b/plugins/fzy/README.md
new file mode 100644 (file)
index 0000000..afd82ec
--- /dev/null
@@ -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 (file)
index 0000000..f831e2a
--- /dev/null
@@ -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