iTerm 中的 Bash 键盘快捷键,如 Alt+d 和 Alt+f

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18923765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 00:13:26  来源:igfitidea点击:

Bash keyboard shortcuts in iTerm like Alt+d and Alt+f

macosbashkeyboard-shortcutsitermiterm2

提问by rewolf

Everyone at work recommended iTerm2 to me instead of the native Terminal. But iTerm2 doesn't seem to allow me to use bash shortcuts like Alt+B and Alt+Fto jump back/forward between tokens, or Alt+Dto delete a word.

工作中的每个人都向我推荐 iTerm2,而不是本地终端。但是 iTerm2 似乎不允许我使用像Alt+B Alt+这样的 bash 快捷方式F在标记之间向后/向前跳转,或者使用Alt+D来删除单词。

I can't imagine this isn't available. Can anyone help me out?

我无法想象这是不可用的。谁能帮我吗?

回答by chepner

The Optionkey (the Mac name for the Alt key) by default has other uses. Press Command+Oto open the list of profiles, select Default (I assume that is the profile you are using), and click "Edit Profiles...". In the resulting window, click on the "Keys" tab, and select "+Esc" for one or both option keys. This should cause iTerm to treat the Option key the way you are accustomed.

Option默认情况下,该键(Alt 键的 Mac 名称)还有其他用途。按Command+O打开配置文件列表,选择默认(我假设这是您正在使用的配置文件),然后单击“编辑配置文件...”。在出现的窗口中,单击“键”选项卡,然后为一个或两个选项键选择“+Esc”。这应该会导致 iTerm 以您习惯的方式处理 Option 键。

Alternatively, you can simply use the Escapekey instead.

或者,您可以简单地使用Escape密钥。

enter image description here

在此处输入图片说明