From 11a1010e9e4cefb95f2ddcd8ebc0758c73bf0f36 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 9 Nov 2013 01:16:39 +0900 Subject: [PATCH] Add zsh widget examples --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index ad575f2..4806709 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,30 @@ bind '"\C-t": " \C-u \C-a\C-k$(fzf)\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er"' bind '"\C-r": " \C-e\C-u$(history | fzf +s | sed \"s/ *[0-9]* *//\")\e\C-e\er"' ``` +zsh widgets +----------- + +```sh +# CTRL-T - Paste the selected file path into the command line +fzf-file-widget() { + LBUFFER+=$( + find * -path '*/\\.*' -prune \ + -o -type f -print \ + -o -type l -print 2> /dev/null | fzf) + zle redisplay +} +zle -N fzf-file-widget +bindkey '^T' fzf-file-widget + +# CTRL-R - Paste the selected command from history into the command line +fzf-history-widget() { + LBUFFER+=$(history | fzf +s | sed "s/ *[0-9]* *//") + zle redisplay +} +zle -N fzf-history-widget +bindkey '^R' fzf-history-widget +``` + License -------