如何在tmux vi复制模式下快速滚动时保留上下文?

如何在tmux vi复制模式下快速滚动时保留上下文?,tmux,Tmux,我想知道tmux vi拷贝绑定的可能选项是什么。我的.tmux.conf中有以下内容: bind -t vi-copy e start-of-line bind -t vi-copy r end-of-line bind -t vi-copy v begin-selection bind -t vi-copy V rectangle-toggle bind -t vi-copy K page-up bind -t vi-copy J p

我想知道tmux vi拷贝绑定的可能选项是什么。我的.tmux.conf中有以下内容:

bind -t vi-copy e      start-of-line
bind -t vi-copy r      end-of-line
bind -t vi-copy v      begin-selection
bind -t vi-copy V      rectangle-toggle
bind -t vi-copy K      page-up
bind -t vi-copy J      page-down
bind -t vi-copy h      cursor-left  
bind -t vi-copy j      cursor-down
bind -t vi-copy k      cursor-up
bind -t vi-copy l      cursor-right
bind -t vi-copy C-f    cancel
Q1:我在配置文件中已经有一段时间了,不知道上一列中的选项来自哪里。谷歌搜索只向我展示了其他有类似代码片段的论坛。我找不到关于这些关键字的文档。有什么想法吗?不,不是:)

Q2:如果可能的话,我想将K改为(尝试过的和失败的)半页,甚至改为“上5行”,以保留上下文

已尝试但失败:


谢谢

您可以使用
tmux列表键-t vi copy
查看在vi复制模式下映射的所有功能的列表。如果您希望看到所有可能的命令,您可以查看源代码,特别是。我不认为有任何文档列出了所有这些

您要查找的映射是:

bind-key -t vi-copy 'K' halfpage-up
bind-key -t vi-copy 'J' halfpage-down

不幸的是,这一部分在tmux中没有很好的文档记录

这是从源代码中删除的版本2.2中“复制模式”命令的完整列表:

append-selection
back-to-indentation
begin-selection
bottom-line
cancel
clear-selection
copy-end-of-line
copy-line
copy-pipe
copy-selection
cursor-down
cursor-left
cursor-right
cursor-up
end-of-line
goto-line
halfpage-down
halfpage-up
history-bottom
history-top
jump-again
jump-backward
jump-forward
jump-reverse
jump-to-backward
jump-to-forward
middle-line
next-space
next-space-end
next-word
next-word-end
other-end
page-down
page-up
previous-space
previous-word
rectangle-toggle
scroll-down
scroll-up
search-again
search-backward
search-forward
search-reverse
select-line
start-named-buffer
start-number-prefix
start-of-line
top-line
所有这些命令都适用于vi复制和emacs复制模式,但行为可能会有所不同,从而与vi或emacs保持一致

tmux处于“模式”时存在一些缺点:

  • “模式”命令没有合理的命令列表或选项卡完成
  • 无法在“模式”中组合命令:只能将一个操作绑定到按键,并且操作集是有限的
还有一个补丁可以解决这些问题:

它向tmux中添加了全面的脚本支持

使用该选项,可以列出所有可用命令:

info commands ::tmux::*
info commands ::tmux::mode::*
info commands ::tmux::mode::copy::*
列出所有“模式”命令:

info commands ::tmux::*
info commands ::tmux::mode::*
info commands ::tmux::mode::copy::*
列出所有“复制模式”命令:

info commands ::tmux::*
info commands ::tmux::mode::*
info commands ::tmux::mode::copy::*
在复制模式下绑定多个操作:

bind-key -t vi-copy K tcl { scroll-up ; scroll-up }

看来我的第一次尝试“翻半页”就差一点了。tip on模式键的Thx。我应该自己弄明白的。我在那里找到了89个映射选项的列表。是否可以“向上移动5行”或“向左移动5列”?