mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-23 15:18:29 +00:00
Fix #22. Keybindings for vi-mode bash.
This commit is contained in:
parent
245ee42763
commit
b22fd6de6d
27
install
27
install
@ -97,10 +97,6 @@ EOF
|
|||||||
# ------------
|
# ------------
|
||||||
if [[ $- =~ i ]]; then
|
if [[ $- =~ i ]]; then
|
||||||
|
|
||||||
# Required to refresh the prompt after fzf
|
|
||||||
bind '"\er": redraw-current-line'
|
|
||||||
|
|
||||||
# CTRL-T - Paste the selected file path into the command line
|
|
||||||
__fsel() {
|
__fsel() {
|
||||||
find * -path '*/\.*' -prune \
|
find * -path '*/\.*' -prune \
|
||||||
-o -type f -print \
|
-o -type f -print \
|
||||||
@ -110,10 +106,27 @@ __fsel() {
|
|||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
bind '"\C-t": " \C-u \C-a\C-k$(__fsel)\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er"'
|
|
||||||
|
|
||||||
# CTRL-R - Paste the selected command from history into the command line
|
if [ -z "$(set -o | grep '^vi.*on')" ]; then
|
||||||
bind '"\C-r": " \C-e\C-u$(HISTTIMEFORMAT= history | fzf +s | sed \"s/ *[0-9]* *//\")\e\C-e\er"'
|
# Required to refresh the prompt after fzf
|
||||||
|
bind '"\er": redraw-current-line'
|
||||||
|
|
||||||
|
# CTRL-T - Paste the selected file path into the command line
|
||||||
|
bind '"\C-t": " \C-u \C-a\C-k$(__fsel)\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er"'
|
||||||
|
|
||||||
|
# CTRL-R - Paste the selected command from history into the command line
|
||||||
|
bind '"\C-r": " \C-e\C-u$(HISTTIMEFORMAT= history | fzf +s | sed \"s/ *[0-9]* *//\")\e\C-e\er"'
|
||||||
|
else
|
||||||
|
bind '"\C-x\C-e": shell-expand-line'
|
||||||
|
bind '"\C-x\C-r": redraw-current-line'
|
||||||
|
|
||||||
|
# CTRL-T - Paste the selected file path into the command line
|
||||||
|
# - FIXME: Selected items are attached to the end regardless of cursor position
|
||||||
|
bind '"\C-t": "\eddi$(__fsel)\C-x\C-e\e0P$a \C-x\C-r"'
|
||||||
|
|
||||||
|
# CTRL-R - Paste the selected command from history into the command line
|
||||||
|
bind '"\C-r": "\eddi$(HISTTIMEFORMAT= history | fzf +s | sed \"s/ *[0-9]* *//\")\C-x\C-e\e$a\C-x\C-r"'
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user