tmux set -g mouse-mode on doesn't work

匿名 (未验证) 提交于 2019-12-03 00:56:02

问题:

I've been looking around and people say that putting

set -g mouse-mode on 

should let you scroll through the terminal output when running tmux. However, after both putting this in my ~/.tmux.conf file and saying tmux set -g mouse-mode on when in a tmux session, nothing changes. When I scroll I still get outside of tmux like scrolling in vim with default settings.

Anyone know why this is?

回答1:

So this option has been renamed in version 2.1 (18 October 2015)

From the changelog:

 Mouse-mode has been rewritten.  There's now no longer options for:     - mouse-resize-pane     - mouse-select-pane     - mouse-select-window     - mode-mouse    Instead there is just one option:  'mouse' which turns on mouse support 

So this is what I'm using now in my .tmux.conf file

set -g mouse on 


回答2:

As @Graham42 noted, mouse option has changed in version 2.1. Scrolling now requires for you to enter copy mode first. To enable scrolling almost identical to how it was before 2.1 add following to your .tmux.conf.

set-option -g mouse on  # make scrolling with wheels work 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 

This will enable scrolling on hover over a pane and you will be able to scroll that pane line by line.

Source: https://groups.google.com/d/msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ



回答3:

Just a quick heads-up to anyone else who is losing their mind right now:

https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12

so that's just

 :setw -g mouse 


回答4:

this should work:

setw -g mode-mouse on 

then resource then config file

tmux source-file ~/.tmux.conf 

or kill the server



回答5:

As @Graham42 said, from version 2.1 mouse options has been renamed but you can use the mouse with any version of tmux adding this to your ~/.tmux.conf:

is_older="[[ $(tmux -V | cut -d' ' -f2) -lt 2.1 ]] && true || false" if-shell "$is_older" "set -g mode-mouse on; set -g mouse-resize-pane on;\   set -g mouse-select-pane on; set -g mouse-select-window on" "set -g mouse on" 

Hope this helps



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!