summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-13 01:27:16 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-13 01:33:01 +0900
commitdd6138a6559363871d88c594ab9d170e36959129 (patch)
tree37daf90369a9fd99748b3d5c353a8b55219eb3a3 /install
parent68c5bea3f82cb0b9c29a298a1588838749054f4e (diff)
Fix #142, #144 - Improve CTRL-R for zsh
Diffstat (limited to 'install')
-rwxr-xr-xinstall7
1 files changed, 6 insertions, 1 deletions
diff --git a/install b/install
index f1fae0b2..b974afaa 100755
--- a/install
+++ b/install
@@ -326,7 +326,12 @@ bindkey '\ec' fzf-cd-widget
# CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() {
- LBUFFER=$(fc -l 1 | fzf +s --tac +m -n2..,.. | sed "s/ *[0-9*]* *//")
+ local selected
+ if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. -q "$LBUFFER"); then
+ num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g')
+ LBUFFER=!$num
+ zle expand-history
+ fi
zle redisplay
}
zle -N fzf-history-widget