'How do you switch from a tmux pane that you've scrolled up in to another tmux pane?

If I have two tmux panes open and I go to one and scroll back to the history using CTRL-B [, then for some reason I can't switch to the other pane without making the current pane scroll back to the bottom. Does anyone know how to work around this? Note that I use some custom tmux configuration, as described here, to make it easier to navigate between vim windows and tmux panes. Is this somehow messing up how tmux scrolling works?



Solution 1:[1]

Is it possible you're running into a conflicting default keybinding for tmux when it's in copy mode?

When tmux is running, you can check the currently active keybindings by doing prefix+?. When I do this on a bare tmux config, I can see that C-k is bound to send-keys -X copy-end-of-line, and it will move a buffer that's in copy mode to the end of the buffer, like you're describing. Alternatively, if you're using tmux's copy-mode-vi, then it looks like C-j is bound by default to send-keys -X copy-selection-and-cancel.

Try adding the following to your .tmux.conf:

unbind-key -Tcopy-mode C-k
unbind-key -Tcopy-mode-vi C-j

After this configuration update, I'm able to use C-j and C-k to navigate panes like described in the article you linked.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Reece Stevens