1
0
mirror of https://github.com/samoshkin/tmux-config.git synced 2026-01-05 01:08:01 +00:00

Copy on MouseDragEnd event but do not reset copy mode and selection. Add shortcut to copy whole line. Strip trailing new lines from copied text

This commit is contained in:
Alexey Samoshkin
2017-11-29 23:24:09 +02:00
parent af2efd9561
commit 64e01e6bb4
3 changed files with 17 additions and 11 deletions

View File

@@ -358,9 +358,11 @@ There is a root keybinding to enter Copy mode: `M-Up`. Once in copy mode, you ha
`Space` starts selection, `Enter` copies selection and exits copy mode. List all items in copy buffer using `prefix C-p`, and paste most recent item from buffer using `prexix p`.
You can also use `y` which is equivalent to `Enter`, and `Y` will copy text, exit copy mode and immediately paste buffer to you command line.
`y` just copies selected text and is equivalent to `Enter`, `Y` copies whole line, and `D` copies by the end of line.
You can also select text using mouse. Default behavior is to copy text and immediately cancel copy mode on `MouseDragEnd` event. This is annoying, because sometimes I select text just to highlight it, but tmux drops me out of copy mode and reset scroll by the end. I've changed this behavior, so `MouseDragEnd` does not execute `copy-selection-and-cancel` action. You can then copy text just by left mouse click, and continue working in copy-mode.
Also, note, that when text is copied any trailing new lines are stripped. So, when you paste buffer in a command prompt, it will not be immediately executed.
You can also select text using mouse. Default behavior is to copy text and immediately cancel copy mode on `MouseDragEnd` event. This is annoying, because sometimes I select text just to highlight it, but tmux drops me out of copy mode and reset scroll by the end. I've changed this behavior, so `MouseDragEnd` does not execute `copy-selection-and-cancel` action. Text is copied, but copy mode is not cancelled and selection is not cleared. You can then reset selection by mouse click.
![copy and scroll](https://user-images.githubusercontent.com/768858/33231146-e390afc8-d1f8-11e7-80ad-6977fc3a5df7.gif)