2012年9月30日星期日

tmux/screen里面如何用鼠标滚轮来卷动窗口内容

tmux里面用鼠标滚轮来卷动窗口内容

在tmux里面,因为每个窗口(tmux window)的历史内容已经被tmux接管了,所以原来console/terminal提供的Shift+PgUp/PgDn所显示的内容并不是当前窗口的历史内容,所以要用C-b [ 进入copy-mode,然后才能用PgUp/PgDn/光标/Ctrl-S等键在copy-mode中移动。

如果要启用鼠标滚轮来卷动窗口内容的话,可以按C-b :然后输入
    setw mode-mouse on
这就可以了。如果要对所有窗口开启的话:
    setw -g mode-mouse on
(这种情况下,Vi/Emacs等全屏程序并不受影响,还可以自己接管滚轮事件)

也可以加到~/.tmux.conf里面
     set-window-option -g mode-mouse on
(setw其实是set-window-option的别名)

摘自: Scroll shell output with mouse in tmux - Super User

gnu screen里面呢
一种说法是在~/.screenrc里面添加
    termcapinfo xterm* ti@:te@
xterm*用于匹配(glob match)你的当前term类型
Using the scrollwheel in GNU screen

另一种说法就比较复杂了,详见链接: How to use mousewheel in GNU Screen | Mikael Ståldal’s technical blog 

本文链接



(automatically copied by ifttt from http://www.cnblogs.com/bamanzi/archive/2012/08/17/mouse-wheel-in-tmux-screen.html)

没有评论: