iterm + tmux isn't allowing me to scroll up with the mouse
Question
I recently rebuilt my system and everything works except I can't scroll my (iterm2) terminal window back to look at commands and output that have scrolled off the screen.
Without tmux I can scroll but with tmux I can't
When using vim this isn't an issue as I can scroll back within vim.
For basic terminal (which I don't normally use) the behavior is a little different in that the current line scrolls back to show previous commands, but just that line, not the whole window.
I do use tmux and I have a detailed .tmux.conf However I have removed these settings, applied with tmux source-file ~/.tmux.conf
,. seen the changes applied (back to default tmux setting) and still have the issue
My settings include
set -g mouse on
Solution
The recent release of tmux 2.1 changed some of the configuration options. This bit of code (taken from here) restores the previous functionality:
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
Add/place these in the ~/.tmux.conf
file
Apply with tmux source-file ~/.tmux.conf
OTHER TIPS
In iTerm2 all you need to do is to go to Preferences > Profile > Terminal and check ‘Save lines to scrollback when an app status bar is present’.