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
16
Examples.md
16
Examples.md
@@ -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"'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user