mirror of
https://github.com/tmux-plugins/tmux-yank.git
synced 2026-09-10 07:36:17 -04:00
Support tmux 2.4 for copy_line
This commit is contained in:
parent
21c3ba7f84
commit
adda216aa0
|
|
@ -36,7 +36,10 @@
|
|||
}
|
||||
|
||||
start_tmux_selection() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
if tmux-is-at-least 2.4; then
|
||||
echo "$TMUX_COPY_MODE" >> /tmp/tmux
|
||||
tmux send -X begin-selection
|
||||
elif [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
# vi copy mode
|
||||
tmux send-key 'Space'
|
||||
else
|
||||
|
|
@ -47,7 +50,13 @@
|
|||
|
||||
# works when command spans accross multiple lines
|
||||
end_of_line_in_copy_mode() {
|
||||
if [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
if tmux-is-at-least 2.4; then
|
||||
tmux send -X -N 150 'cursor-down' # 'down' key. 'vi' mode is faster so we're
|
||||
# jumping more lines than emacs.
|
||||
tmux send -X 'end-of-line' # End of line (just in case we are already at the last line).
|
||||
tmux send -X 'previous-word' # Beginning of the previous word.
|
||||
tmux send -X 'next-word-end' # End of next word.
|
||||
elif [ "$TMUX_COPY_MODE" == "vi" ]; then
|
||||
# vi copy mode
|
||||
# This sequence of keys consistently selects multiple lines
|
||||
tmux send-key '150' # Go to the bottom of scrollback buffer by using
|
||||
|
|
@ -68,7 +77,11 @@
|
|||
}
|
||||
|
||||
yank_to_clipboard() {
|
||||
tmux send-key "$(yank_wo_newline_key)"
|
||||
if tmux-is-at-least 2.4; then
|
||||
tmux send -X copy-pipe-and-cancel "$(clipboard_copy_command)"
|
||||
else
|
||||
tmux send-key "$(yank_wo_newline_key)"
|
||||
fi
|
||||
}
|
||||
|
||||
go_to_the_end_of_current_line() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue