tmux: Copy multi-click selection into primary
Also split the MouseDragEnd1Pane binding so that the full xclip arguments can be written out to stay consistent.
This commit is contained in:
@@ -22,13 +22,23 @@ set -g prefix C-a
|
||||
bind C-a send-prefix
|
||||
|
||||
# Copy selection into primary selection (without aborting)
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear "xclip -se p"
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane {
|
||||
send -X copy-pipe-no-clear "xclip -selection primary"
|
||||
}
|
||||
|
||||
# Select word or line on double or triple click respectively (w/o aborting).
|
||||
# (These are the defaults w/o the `run -d 0.3; send -X copy-pipe-and-cancel`)
|
||||
bind -T copy-mode-vi SecondClick1Pane select-pane -t= \; send -X select-word
|
||||
bind -T copy-mode-vi TripleClick1Pane select-pane -t= \; send -X select-line
|
||||
bind -n DoubleClick1Pane {
|
||||
bind -T copy-mode-vi SecondClick1Pane {
|
||||
select-pane -t=
|
||||
send -X select-word
|
||||
send -X pipe-no-clear "xclip -selection primary"
|
||||
}
|
||||
bind -T copy-mode-vi TripleClick1Pane {
|
||||
select-pane -t=
|
||||
send -X select-line
|
||||
send -X pipe-no-clear "xclip -selection primary"
|
||||
}
|
||||
bind -n SecondClick1Pane {
|
||||
select-pane -t=
|
||||
if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" {
|
||||
send -M
|
||||
@@ -36,6 +46,7 @@ bind -n DoubleClick1Pane {
|
||||
copy-mode
|
||||
send -X select-word
|
||||
}
|
||||
send -X pipe-no-clear "xclip -selection primary"
|
||||
}
|
||||
bind -n TripleClick1Pane {
|
||||
select-pane -t=
|
||||
@@ -45,6 +56,7 @@ bind -n TripleClick1Pane {
|
||||
copy-mode
|
||||
send -X select-line
|
||||
}
|
||||
send -X pipe-no-clear "xclip -selection primary"
|
||||
}
|
||||
|
||||
# Scroll up 5 lines when entering copy-mode through the mouse wheel, send 5x`up`
|
||||
|
||||
Reference in New Issue
Block a user