Stop tmux-yank from Scrolling Down After Copying Text with Your Mouse
By default when you copy text with the mouse yank will scroll you back to the bottom of your buffer. Here's how to disable that behavior.
I’m sure you’ve experienced this. You’re using the tmux-yank plugin, scroll up in your buffer and copy text with your mouse. After you release your left mouse button you get auto-scrolled down to the bottom of your buffer.
I normally like being in control of when things on my screen change. Oftentimes after I copy text I still want my scroll position to be where the selected text is. This is especially true when recording videos where I want to talk about the thing that was just copied and I’m not ready to paste it yet.
In your tmux config you can set set -g @yank_action "copy-pipe"
instead of
using the default "copy-pipe-cancel"
action. After restarting your tmux
server you’ll no longer get auto-scrolled. When you want to scroll down
manually you can hit q
.
I’ve commit this change to my dotfiles and the video below shows both options in action.
# Demo Video
Timestamps
- 0:08 – Scrolling to the bottom by default
- 0:49 – Configuring tmux-yank to prevent auto-scrolling
- 1:19 – Showing the new behavior
Are you going to configure tmux this way? Let me know below.