在 gnu 屏幕会话中使用 less 时箭头键停止工作
有时,当我在 screen
选项卡中使用 less
时,箭头键会显示 ^[OA
、^[OB
、 ^[OC
和 ^[OD
而不是做我希望他们做的事情。我可以做些什么来解决这个问题并再次获得对 less
的控制吗?
Sometimes when I am using less
within a screen
tab, the arrow keys display ^[OA
, ^[OB
, ^[OC
, and ^[OD
instead of doing what I want them to do. Is there something I can do to fix this and gain control of less
again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 less 提示符下输入
!reset
enter
!reset
at the less prompt我发现从内部屏幕
重置
有时并不能解决问题,因为它是外部客户端/shell,其状态实际上是混乱的并且屏幕从reset
捕获控制字符并阻止它们到达外部客户端。在这种情况下,我必须分离我的会话(Ctrl+a,d),运行reset
,然后再次附加到会话 (screen -r
)。I have found that
reset
from within screen does not solve the problem sometimes, as it's the outer client/shell whose state is actually confused and screen captures the control characters fromreset
and prevents them from reaching the outer client. In this situation, I have to detach my session (Ctrl+a, d), runreset
, then attach to the session again (screen -r
).cat
或less
二进制文件)通过发送 控制字符。您需要从命令行运行reset
命令来恢复。cat
orless
a binary file) shatters your console by sending it control characters. You need to runreset
command from command line to recover.另一件要检查的事情是你的 TERM 变量。就我而言,我通过 ssh 进入 Linux 机器并在屏幕内运行较少的内容 - TERM 变量设置为“屏幕” - 这会破坏箭头键。如果我这样少跑的话,它会完美地工作:
Another thing to check is your TERM variable. In my case I ssh into a Linux box and run less inside screen - the TERM variable was set to 'screen' - which breaks arrow keys. It works perfectly if I run less this way: