tmux: Support repeatable yank motions via yank.sh
Implementing logic inside tmux's config starts to become tedious with growing complexity. Introduce a shell script that handles the logic of the (now also repeatable) vim-like bindings.
This commit is contained in:
@@ -132,23 +132,8 @@ bind -T copy-mode-vi C-v {
|
||||
send -X rectangle-toggle
|
||||
}
|
||||
|
||||
# Yank into system clipboard
|
||||
# TODO: This breaks on repeatable movements (e.g. `y2e`)
|
||||
bind -T copy-mode-vi y \
|
||||
if -F "#{selection_present}" {
|
||||
send -X copy-pipe
|
||||
} {
|
||||
command-prompt -k -p (operator-pending) {
|
||||
# do line-wise yank on yy
|
||||
if -F "#{==:%1,y}" {
|
||||
send -X select-line
|
||||
} {
|
||||
send -X begin-selection
|
||||
send "%1"
|
||||
}
|
||||
send -X copy-pipe
|
||||
}
|
||||
}
|
||||
# Yank into system clipboard with vim-like bindings
|
||||
bind -T copy-mode-vi y run-shell '${XDG_CONFIG_HOME:-$HOME/.config}/tmux/yank.sh'
|
||||
bind -T copy-mode-vi Y \
|
||||
if -F "#{selection_present}" { send -X copy-pipe-line } { send -X copy-pipe-end-of-line }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user