当我在没有 tmux 的情况下运行 shell(在 Gnome 终端中)时,鼠标滚动在tmux 中不起作用。似乎 tmux 发送鼠标滚动事件就像我按下向上/向下键一样。但我希望它通过 shell输出历史滚动。有没有办法让 tmux 像这样工作?
注意:我知道如何使用键盘滚动(感谢这里的另一个问题)。
我尝试在两个版本的 tmux 中进行鼠标滚动:
小智 325
要在输出的历史记录中滚动,您将使用^b+[
然后您可以使用 M+V 向上翻页,使用 ^V 向下翻页。我不知道是否可以使用真正的PgUp和PgDown不过。我的终端不会将这些密钥发送到 tmux。相反,它滚动自身而不是 tmux 历史记录。
要退出复制模式,请按 ESC
要在此模式(称为复制模式)下使用鼠标,请按^b+:
并输入以下内容:
setw -g mouse on
Run Code Online (Sandbox Code Playgroud)
注意:在 tmux < 2.1 中,该选项被命名为mode-mouse,而不是mouse
现在,当您更改为复制模式时,您可以使用鼠标滚动浏览它。如果需要,您可以将此命令放在 ~/.tmux.conf 中,以便每次运行 tmux 时都会加载它。
更新:从 tmux 1.5 开始,此选项使使用滚轮自动切换到复制模式并回滚 tmux 回滚缓冲区。没有必要先打Ctrl-B+[了。向下滚动到提示也会自动结束复制模式。
Dan*_*yRe 136
Tmux 2.1 有一些变化
鼠标模式已被重写。现在不再有以下选项:
相反,只有一种选择:“鼠标”,它完全打开鼠标支持。
那将是
set -g mouse on
# to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
Run Code Online (Sandbox Code Playgroud)
buk*_*zor 69
当前版本的 tmux (1.5) 允许您简单地将模式鼠标选项设置为开启,并允许您使用鼠标滚轮滚动。
mode-mouse [on | off]
Mouse state in modes. If on, the mouse may be used to
enter copy mode and copy a selection by dragging, to
enter copy mode and scroll with the mouse wheel, or to
select an option in choice mode.
Run Code Online (Sandbox Code Playgroud)
在我的 .tmux.conf 中:
set-window-option -g mode-mouse on
Run Code Online (Sandbox Code Playgroud)
更新- 从 tmux 2.1 开始,此选项已重命名为mouse
Joh*_*nis 64
更新:
像其他人提到的那样,在较新的 tmux 版本中,您只需将以下内容放入 .tmux.conf
setw -g mouse on
Run Code Online (Sandbox Code Playgroud)
以前对旧 tmux 版本的建议:
在你的 .tmux.conf 中试试这个
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
# Scroll History
set -g history-limit 30000
# Set ability to capture on start and restore on exit window data when running an application
setw -g alternate-screen on
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
Run Code Online (Sandbox Code Playgroud)
取自http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY
Jed*_*els 16
有人(来自我丢失的消息来源)建议将以下内容添加到~.tmux.conf:
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
Run Code Online (Sandbox Code Playgroud)
我不知道它是如何工作的或它的作用,但这现在允许我在 tmux 会话中使用鼠标滚轮滚动,而无需进入 tmux 的复制模式;我只是滚动滚轮和 BAM!有用。请注意,我使用的是 terminal.app,但我记得 OP 给出了专门用于gnome-terminal.
小智 11
如果您已经在 tmux 会话中,则可以运行该命令
set mouse on
Run Code Online (Sandbox Code Playgroud)
提醒:要运行命令,请使用您的前缀 then :。
tmux 2.1 引入了新的鼠标绑定。
我今天刚刚写了这些绑定。当不在 Vim 中时,它无缝地将鼠标滚轮绑定到箭头,因为 Vim 能够解释原始的鼠标滚轮代码(用于诸如根据鼠标悬停在哪个 Vim 窗口上为您选择要滚动的 Vim 窗口等目的)。
这意味着我们最终只能使用鼠标来查看多个手册页以及其他任何接受箭头键的内容。您可以if根据需要扩展和链接逻辑,以便为您的应用程序实现更多逻辑。
bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"
Run Code Online (Sandbox Code Playgroud)
使用这种新的滚轮绑定功能,可以编写鼠标滚轮脚本来执行您喜欢的任何上下文相关行为。
| 归档时间: |
|
| 查看次数: |
197568 次 |
| 最近记录: |