Skip to content

Commit

Permalink
Allow for tmux versions ending in "a"
Browse files Browse the repository at this point in the history
If the tmux version ends in "a", as it does today with version 3.3a,
your `~/.tmux.conf` will break and you will be sad.

I'm removing the check for version 2.4 because it shipped a while ago
and allows me to remove the dependency on `bc`.

Here's where I figured this all out:
tmux/tmux#3219 (comment)
  • Loading branch information
SalvatoreT committed Jun 10, 2022
1 parent 47a13e8 commit 4d68bd6
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,10 @@ run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"

# Setup 'v' to begin selection as in Vim
# Update default binding of `Enter` to also use copy-pipe
#
# New keybindings for vi-mode when version >= 2.4
# https://github.com/tmux/tmux/issues/754
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
'bind-key -T copy-mode-vi v send-keys -X begin-selection ; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" ; \
unbind -T copy-mode-vi Enter ; \
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"; ' \
'bind-key -t vi-copy v begin-selection ; \
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" ; \
unbind -t vi-copy Enter ; \
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"; '
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"

set-window-option -g display-panes-time 1500

Expand Down

0 comments on commit 4d68bd6

Please sign in to comment.