Skip to content

Commit

Permalink
yank double click and triple click
Browse files Browse the repository at this point in the history
  • Loading branch information
NgoKimPhu committed Dec 6, 2023
1 parent acfd36e commit 345c399
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions yank.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,23 @@ set_copy_mode_bindings() {
tmux bind-key -T copy-mode-vi "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer -p"
tmux bind-key -T copy-mode-vi "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer -p"
tmux bind-key -T copy-mode-vi "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"
if [[ "$(yank_with_mouse)" == "on" ]]; then
tmux bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse"
fi

tmux bind-key -T copy-mode "$(yank_key)" send-keys -X "$(yank_action)" "$copy_command"
tmux bind-key -T copy-mode "$(put_key)" send-keys -X copy-pipe-and-cancel "tmux paste-buffer -p"
tmux bind-key -T copy-mode "$(yank_put_key)" send-keys -X copy-pipe-and-cancel "$copy_command; tmux paste-buffer -p"
tmux bind-key -T copy-mode "$(yank_wo_newline_key)" send-keys -X "$(yank_action)" "$copy_wo_newline_command"

if [[ "$(yank_with_mouse)" == "on" ]]; then
tmux bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse"
tmux bind-key -T copy-mode-vi DoubleClick1Pane "select-pane ; send-keys -X select-word ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\""
tmux bind-key -T copy-mode-vi TripleClick1Pane "select-pane ; send-keys -X select-line ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\""

tmux bind-key -T copy-mode MouseDragEnd1Pane send-keys -X "$(yank_action)" "$copy_command_mouse"
tmux bind-key -T copy-mode DoubleClick1Pane "select-pane ; send-keys -X { select-word ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\" }"
tmux bind-key -T copy-mode TripleClick1Pane "select-pane ; send-keys -X { select-line ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\" }"

tmux bind-key -n DoubleClick1Pane "select-pane -t = ; if-shell -F \"#{||:#{pane_in_mode},#{mouse_any_flag}}\" { send-keys -M } { copy-mode -H ; send-keys -X select-word ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\" }"
tmux bind-key -n TripleClick1Pane "select-pane -t = ; if-shell -F \"#{||:#{pane_in_mode},#{mouse_any_flag}}\" { send-keys -M } { copy-mode -H ; send-keys -X select-line ; run-shell -d 0.3 ; send-keys -X \"$(yank_action)\" \"$copy_command_mouse\" }"
fi
else
tmux bind-key -t vi-copy "$(yank_key)" copy-pipe "$copy_command"
Expand Down

0 comments on commit 345c399

Please sign in to comment.