Skip to content

Commit

Permalink
[fzf-tmux] Disallow popup mode on tmux 3.1 or below
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Apr 1, 2023
1 parent 302e21f commit 025aa33
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/fzf-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down

0 comments on commit 025aa33

Please sign in to comment.