summaryrefslogtreecommitdiffstats
path: root/shell/key-bindings.fish
diff options
context:
space:
mode:
authorTom Fitzhenry <tom@tom.tf>2017-07-15 19:50:23 +1000
committerJunegunn Choi <junegunn.c@gmail.com>2017-07-15 18:50:23 +0900
commit7b5ccc45bc76f289fe2c48cf91e895b9ca99b1e2 (patch)
tree1fca9bdf2f9905c938f90bcb19ec2cdb39c589c4 /shell/key-bindings.fish
parent940214a1a2cbc64f32539e9a65beafc767f259e2 (diff)
[fish] Fix ctrl-r regression in versions <2.4 (#972)
Close #966
Diffstat (limited to 'shell/key-bindings.fish')
-rw-r--r--shell/key-bindings.fish16
1 files changed, 14 insertions, 2 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 803d0a93..97a3ec55 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -39,8 +39,20 @@ function fzf_key_bindings
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m"
- history -z | eval (__fzfcmd) --read0 -q '(commandline)' | perl -pe 'chomp if eof' | read -lz result
- and commandline -- $result
+
+ set -l FISH_MAJOR (echo $FISH_VERSION | cut -f1 -d.)
+ set -l FISH_MINOR (echo $FISH_VERSION | cut -f2 -d.)
+
+ # history's -z flag is needed for multi-line support.
+ # history's -z flag was added in fish 2.4.0, so don't use it for versions
+ # before 2.4.0.
+ if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];
+ history -z | eval (__fzfcmd) --read0 -q '(commandline)' | perl -pe 'chomp if eof' | read -lz result
+ and commandline -- $result
+ else
+ history | eval (__fzfcmd) -q '(commandline)' | read -l result
+ and commandline -- $result
+ end
end
commandline -f repaint
end