Skip to content

Commit e8a03cf

Browse files
authored
Merge pull request #104 from kaliberr44/master
yank default action for TMUX > 2.4 + MouseDragEnd1Pane
2 parents 19b1123 + ab918db commit e8a03cf

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

scripts/helpers.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ yank_wo_newline_option="@copy_mode_yank_wo_newline"
2121
yank_selection_default="clipboard"
2222
yank_selection_option="@yank_selection"
2323

24+
yank_action_default="copy-pipe-and-cancel"
25+
yank_action_option="@yank_action"
26+
2427
shell_mode_default="emacs"
2528
shell_mode_option="@shell_mode"
2629

@@ -71,6 +74,10 @@ yank_selection() {
7174
get_tmux_option "$yank_selection_option" "$yank_selection_default"
7275
}
7376

77+
yank_action() {
78+
get_tmux_option "$yank_action_option" "$yank_action_default"
79+
}
80+
7481
shell_mode() {
7582
get_tmux_option "$shell_mode_option" "$shell_mode_default"
7683
}

yank.tmux

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ set_copy_mode_bindings() {
4141
local copy_wo_newline_command
4242
copy_wo_newline_command="$(clipboard_copy_without_newline_command "$copy_command")"
4343
if tmux_is_at_least 2.4; then
44-
tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X copy-pipe-and-cancel "$copy_command"
44+
tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
4545
tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
4646
tmux bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
47-
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X copy-pipe-and-cancel "$copy_wo_newline_command"
47+
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
4848

49-
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X copy-pipe-and-cancel "$copy_command"
49+
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
5050
tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
5151
tmux bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer"
52-
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X copy-pipe-and-cancel "$copy_wo_newline_command"
52+
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
5353
else
5454
tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command"
5555
tmux bind-key -t vi-copy "$(put_key)" copy-pipe "tmux paste-buffer"

0 commit comments

Comments
 (0)