summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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