修复在 Terminator 终端模拟器中运行 Zsh 时 .zshrc 中的关键设置(Home/End/Insert/Delete)
我运行的是 Ubuntu 11.04。我安装了 Terminator Terminal Emulator 0.95 和 Zsh 版本 4.3.15。
我的 Zsh 内的密钥存在(众所周知的)问题。至少这些:
- Home/End,没有任何反应
- 插入/删除/PageUp/PageDown:键入“~”
我已经尝试了 .zshrc 的一些配置,这应该可以解决问题,但到目前为止还没有真正有效的方法。也许这与终结者和Zsh的结合有关。我在此页面上获取了 2 个配置: https://bbs.archlinux.org/viewtopic.php?pid=428669 。
oneone 是否有类似的配置(尤其是 Terminator 和 Zsh)并弄清楚需要在 .zshrc 中插入什么来修复关键设置?
I'm running Ubuntu 11.04. I installed the Terminator Terminal Emulator 0.95, and Zsh, version 4.3.15.
I have (commonly known) problems with my keys inside the Zsh. At least these:
- Home/End, nothing happens
- Insert/Delete/PageUp/PageDown: a "~" is typed
I already tried some configurations for .zshrc which should solve the problem, but no approach really worked so far. Maybe this is related to the combination of Terminator and Zsh. I took the 2 configs on this page: https://bbs.archlinux.org/viewtopic.php?pid=428669.
Does oneone have a similar configuration (especially Terminator and Zsh) and figured out what needs to be inserted into the .zshrc to fix the key settings?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要了解某个键的代码,请执行
cat
,按 Enter 键,按该键,然后按 Ctrl+C。对我来说,
Home
发送^[[H
和End
^[[F
,所以我可以把我的.zshrc
在我的主目录中这些代码可能会随着您使用的终端模拟器而改变。
自动加载 zkbd ; zkbd 将创建一个包含要使用的键码数组的文件,例如
bindkey "${key[Home]}" begin-of-line
,并且您可以根据情况获取不同的文件终端。To know the code of a key, execute
cat
, press enter, press the key, then Ctrl+C.For me,
Home
sends^[[H
andEnd
^[[F
, so i can put i my.zshrc
in my home dirThese codes could change with the terminal emulator you use.
autoload zkbd ; zkbd
will create a file with an array of keycodes to use, likebindkey "${key[Home]}" beginning-of-line
, and you can source a different file depending on the terminal.感谢@lolesque,但该解决方案对我不起作用。使用 zkbd 检查我的按键绑定后,我得出了以下解决方案。顺便说一句,我的
$TERM
是xterm
。希望有帮助。
Thanks to @lolesque, but the solution doesn't work with me. After using
zkbd
to check my key binding, I came out the below solution. BTW, my$TERM
isxterm
.Hope it helps.
对于 WSL2(Windows 10)上的我来说,这就是
cat
技巧对我不起作用,因为它打印了^[[H
,如接受的答案所示,但我能够通过在运行 zsh 的新窗口终端中键入Ctrl+v Home
找出^[OH
序列。For me on WSL2 (Windows 10) this was it
The
cat
trick did not work for me as it printed^[[H
as in the accepted answer but I was able to find out the^[OH
sequence by typingCtrl+v Home
in the new Window Terminal running zsh.