summaryrefslogtreecommitdiffstats
path: root/bin/fzf-tmux
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-04-02 00:16:00 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-04-02 00:16:00 +0900
commit025aa3377342135f527d728574e59db4cb781292 (patch)
tree20997282365458c7b3dcaaee677fb1584a8cbf0d /bin/fzf-tmux
parent302e21fd5813a3c4c7f6014367988829fc92770a (diff)
[fzf-tmux] Disallow popup mode on tmux 3.1 or below
Close #3198
Diffstat (limited to 'bin/fzf-tmux')
-rwxr-xr-xbin/fzf-tmux11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux
index a9d885c2..b4c7d1f9 100755
--- a/bin/fzf-tmux
+++ b/bin/fzf-tmux
@@ -179,12 +179,15 @@ trap 'cleanup' EXIT
envs="export TERM=$TERM "
if [[ "$opt" =~ "-E" ]]; then
- tmux_version=$(tmux -V)
- if [[ $tmux_version =~ ^tmux\ 3\.2[a-z]?$ ]]; then
- FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS"
- else
+ tmux_version=$(tmux -V | sed 's/[^0-9.]//g')
+ if [[ $(bc -l <<< "$tmux_version > 3.2") = 1 ]]; then
FZF_DEFAULT_OPTS="--border $FZF_DEFAULT_OPTS"
opt="-B $opt"
+ elif [[ $tmux_version = 3.2 ]]; then
+ FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS"
+ else
+ echo "fzf-tmux: tmux 3.2 or above is required for popup mode" >&2
+ exit 2
fi
fi
[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"