Vim知道
xterm公司
-类似终端(以TERM开头
xterm
,或对
t_RV
序列,如果定义的话)支持某些修改键的扩展序列,但它不认为
screen
TERM(您应该在下使用
tmux公司
).
然而,如果存在TMUX,并且TERM以
屏幕
(第一行启用了(更好的)鼠标支持
tmux公司
,您可能也喜欢):
if &term =~ '^screen' && exists('$TMUX')
set mouse+=a
" tmux knows the extended mouse mode
set ttymouse=xterm2
" tmux will send xterm-style keys when xterm-keys is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
execute "set <xHome>=\e[1;*H"
execute "set <xEnd>=\e[1;*F"
execute "set <Insert>=\e[2;*~"
execute "set <Delete>=\e[3;*~"
execute "set <PageUp>=\e[5;*~"
execute "set <PageDown>=\e[6;*~"
execute "set <xF1>=\e[1;*P"
execute "set <xF2>=\e[1;*Q"
execute "set <xF3>=\e[1;*R"
execute "set <xF4>=\e[1;*S"
execute "set <F5>=\e[15;*~"
execute "set <F6>=\e[17;*~"
execute "set <F7>=\e[18;*~"
execute "set <F8>=\e[19;*~"
execute "set <F9>=\e[20;*~"
execute "set <F10>=\e[21;*~"
execute "set <F11>=\e[23;*~"
execute "set <F12>=\e[24;*~"
endif
正如注释所示,您还需要有窗口
xterm-keys
选项已启用。你可以对所有的窗口都这样做(在你的
~/.tmux.conf
):
set-option -gw xterm-keys on
(请记住,更改为
~/.tmux.conf
不会自动加载。为了有效,您需要手动运行此命令(在
tmux
shell命令,或在前缀处
:
提示),或使用重新加载配置文件
source ~/.tmux.conf
(在
tmux公司
shell命令,或在前缀处
:
提示),或重新启动服务器(退出所有会话并重新启动
tmux公司
)).