Skip to content

Commit 8e99f32

Browse files
author
Robert Przybylowicz
committed
yank action + MouseDragEnd1Pane yank
1 parent feb9611 commit 8e99f32

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-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"
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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,25 @@ 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 MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command"
45+
tmux bind-key -T copy-mode-vi "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
4546
tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
4647
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"
48+
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
4849

49-
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X copy-pipe-and-cancel "$copy_command"
50+
tmux bind-key -T copy-mode MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command"
51+
tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
5052
tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
5153
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"
54+
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
5355
else
56+
tmux bind-key -t vi-copy MouseDragEnd1Pane copy-pipe "$copy_command"
5457
tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command"
5558
tmux bind-key -t vi-copy "$(put_key)" copy-pipe "tmux paste-buffer"
5659
tmux bind-key -t vi-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"
5760
tmux bind-key -t vi-copy "$(yank_wo_newline_key)" copy-pipe "$copy_wo_newline_command"
5861

62+
tmux bind-key -t emacs-copy MouseDragEnd1Pane copy-pipe "$copy_command"
5963
tmux bind-key -t emacs-copy "$(yank_key)" copy-pipe "$copy_command"
6064
tmux bind-key -t emacs-copy "$(put_key)" copy-pipe "tmux paste-buffer"
6165
tmux bind-key -t emacs-copy "$(yank_put_key)" copy-pipe "$copy_command; tmux paste-buffer"

0 commit comments

Comments
 (0)