tmux: Put some parts in version >= 3.3 checks

Ubuntu 22.04 is shipped with 3.2a... There might be more issues with
that version, but these were the ones I could find for now.

Tmux commits needed:
- c03b57465bdf/866117636e47 ("Add different command historys for
  different types of prompts ("command", "search" etc). From Anindya
  Mukherjee.") for `prompt-history-limit`
- e06a4e041c68 ("Set mouse_x and mouse_y on the status line, GitHub
  issue 2913.") for mouse_x in MouseDragEnd1StatusDefault binding
- 9f6164a05cc0 ("Make send-keys without any arguments send the key it is
  bound to (if any). GitHub issue 2904.") for `C-d`, `Enter` bindings
This commit is contained in:
2025-03-13 14:15:07 +01:00
parent e956b8955e
commit 0c8d1f4292

View File

@@ -3,7 +3,9 @@ set -g mouse on
set -g mode-keys vi
set -g extended-keys always
set -g prompt-history-limit 999999
if -F "#{>=:#{version},3.3}" {
set -g prompt-history-limit 999999
}
set -g history-file "$XDG_DATA_HOME/tmux/tmux_history"
run-shell 'mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/tmux"'
@@ -168,11 +170,14 @@ bind -r P swap-window -d -t :-1
bind -n MouseDrag1Status swap-window -d -t=
# TODO: do nothing on drags that don't start on a window name
bind -n MouseDragEnd1StatusDefault {
if -F "#{e|>|f|0:#{mouse_x},#{e|/|f:#{window_width},2}}" {
run-shell "tmux move-window -at #{last_window_index}"
} {
move-window -t0
# NOTE: mouse_{x,y} were not set in status line before 3.3
if -F "#{>=:#{version},3.3}" {
bind -n MouseDragEnd1StatusDefault {
if -F "#{e|>|f|0:#{mouse_x},#{e|/|f:#{window_width},2}}" {
run-shell "tmux move-window -at #{last_window_index}"
} {
move-window -t0
}
}
}
@@ -327,8 +332,14 @@ bind S set -w synchronize-panes
# Require confirmation before killing a pane
set -g remain-on-exit on
bind -n C-d if -F "#{pane_dead}" { kill-pane } { send }
bind -n Enter if -F "#{pane_dead}" { respawn-pane } { send }
if -F "#{>=:#{version},3.3}" {
bind -n C-d if -F "#{pane_dead}" { kill-pane } { send }
bind -n Enter if -F "#{pane_dead}" { respawn-pane } { send }
} {
# omitting the key argument was introduced in 3.3
bind -n C-d if -F "#{pane_dead}" { kill-pane } { send C-d }
bind -n Enter if -F "#{pane_dead}" { respawn-pane } { send Enter }
}
# Change installation location of plugins
setenv -g TMUX_PLUGIN_MANAGER_PATH "$XDG_CONFIG_HOME/tmux/plugins/"