在zsh中寻找ALT + LeftArrowKey解决方案 [英] Looking for ALT+LeftArrowKey solution in zsh

查看:120
本文介绍了在zsh中寻找ALT + LeftArrowKey解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近刚从bash切换到zsh,但是我想念我的 Alt + LeftArrowKey Alt + RightArrowKey 一次来回一个字.

I just recently switched from bash to zsh, however I miss my Alt+LeftArrowKey and Alt+RightArrowKey to go back and forth a word at a time.

现在,如果按 Alt + LeftArrowKey ,我会返回几个字母,然后卡住.我不会再往后退了,也不会像我期望的那样用 Alt + RightArrowKey 返回到行尾.我什至不能使用箭头键转到行尾,只能倒数第二行.无法在该行上输入新字符或删除.

Right now, if I press Alt+LeftArrowKey I go back a couple of letters and then I'm stuck. I won't go any further backwards and it won't back to the end of the line with Alt+RightArrowKey as I would expect. I can't even use the arrow keys to go to the end of the line, only to the second to last. Can't input new chars on the line either or indeed delete.

如何找回我心爱的快捷方式?

How do I get my beloved shortcut back?

如果重要的话,我正在Mac OS X上使用终端.

I'm on Mac OS X using Terminal if that's important.

推荐答案

运行cat,然后按键以查看快捷方式发送的代码.
(完成操作后,按 Ctrl + C 杀死cat.)
对我来说,(ubuntu,konsole,xterm)按 Alt + 发送^[[1;3D,所以我要放入 .zshrc

Run cat then press keys to see the codes your shortcut send.
(Press Ctrl+C to kill the cat when you're done.)
For me, (ubuntu, konsole, xterm) pressing Alt+ sends ^[[1;3D, so i would put in my .zshrc

bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word

(实际上,我更喜欢使用 Ctrl +箭头逐字移动,就像在Windows或linux gui下的普通文本框中一样.)

(Actually I prefer to use Ctrl + arrow to move word by word, like in a normal textbox under windows or linux gui.)

相关问题:在Terminator Terminal Emulator中运行Zsh时,修复.zshrc中的键设置(Home/End/Insert/Delete)

这篇关于在zsh中寻找ALT + LeftArrowKey解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆