Skip to content

Commit

Permalink
support tmux 2.4
Browse files Browse the repository at this point in the history
TMUX has changed the way bind-keys works in version 2.4+
This change supports both older and newer versions.
  • Loading branch information
docwhat committed Apr 21, 2017
1 parent 7d9c728 commit d595cc1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions open.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ set_copy_mode_open_bindings() {
local key_bindings=$(get_tmux_option "$open_option" "$default_open_key")
local key
for key in $key_bindings; do
tmux bind-key -t vi-copy "$key" copy-pipe "$open_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$open_command"
if tmux-is-at-least 2.4; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$open_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$open_command"
else
tmux bind-key -t vi-copy "$key" copy-pipe "$open_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$open_command"
fi
done
}

Expand All @@ -98,8 +103,13 @@ set_copy_mode_open_editor_bindings() {
local key_bindings=$(get_tmux_option "$open_editor_option" "$default_open_editor_key")
local key
for key in $key_bindings; do
tmux bind-key -t vi-copy "$key" copy-pipe "$editor_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$editor_command"
if tmux-is-at-least 2.4; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
else
tmux bind-key -t vi-copy "$key" copy-pipe "$editor_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$editor_command"
fi
done
}

Expand Down

0 comments on commit d595cc1

Please sign in to comment.