Tmux 2.6 copy/paste and bind tips and tricks!

I recently updated my tmux install to the latest version 2.6-rc3. I hadn’t updated since prior to April. When I did update, my former .tmux.conf I mentioned in my macOS ohmyzsh + tmux + vim + iTerm2 + Powerlevel9k = Badass terminal blog post had several errors due to breaking changes. This post will address the ones that took me a little while to solve.

The simple explanation of what broke is copy/paste from within tmux and most bind-key commands.

In short, I learned key tables changed dramatically from version 2.3 to version 2.4. As quoted in tmux’s changes.md:

There are also new commands with send -X now such as copy-pipe-and-cancel, which we will use shortly. As a result, I couldn’t copy and paste anymore from either a mouse drag or using keys. I updated my file to the following configuration:

As you’ll see, I am now using the new “copy-pipe-and-cancel” command, I am specifying MouseDragEnd1Pane, and I even include a confirmation message to confirm a successful copy to the clipboard.

I hope this saves someone time as it took me several hours of searching to discover the solution to fix the broken copy paste function. On the same topic of broken configurations, I also learned my scroll ability was broken from within vim (and probably other parts of my terminal). I could scroll down, but not up; when I would attempt, I could get command history, not the actual buffer window scroll. First, I discovered I could temporarily fix this by holding shift as I scroll, but that was not a long-term solution. At last, I discovered from this GitHub issue thread I could press ‘Command+r’ to reset the terminal state, which fixed the problem.

For those interested, you can view my .vimrc, .zshrc, and .tmux.conf files here.

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *