m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

edit: Another CTRL-R script to insert the selected command from history into the command line/region

D630
2015-09-30 20:51:52 +02:00
parent f0144b06d0
commit 2f92fe0e56

@@ -125,13 +125,21 @@ __fzf_history ()
: end
'
)";
READLINE_LINE="${READLINE_LINE:+${READLINE_LINE:0:READLINE_POINT}}${READLINE_LINE_NEW}${READLINE_LINE:+${READLINE_LINE:READLINE_POINT}}";
READLINE_POINT="$((READLINE_POINT + ${#READLINE_LINE_NEW}))"
if
[[ -n $READLINE_LINE_NEW ]]
then
builtin bind '"\er": redraw-current-line'
builtin bind '"\e^": magic-space'
READLINE_LINE=${READLINE_LINE:+${READLINE_LINE:0:READLINE_POINT}}${READLINE_LINE_NEW}${READLINE_LINE:+${READLINE_LINE:READLINE_POINT}}
READLINE_POINT=$(( READLINE_POINT + ${#READLINE_LINE_NEW} ))
else
builtin bind '"\er":'
builtin bind '"\e^":'
fi
}
builtin set -o histexpand;
builtin bind '"\er": redraw-current-line';
builtin bind '"\e^": magic-space';
builtin bind -x '"\C-x1": __fzf_history';
builtin bind '"\C-r": "\C-x1\e^\er"'
```