iterm2 单词跳转
iTerm is a great terminal replacement that I like to use. One feature that I wanted after my migration from Windows to OS X was the ability to jump between words in the command line, and not having to go through the whole line, character by character.
iTerm是我喜欢使用的绝佳终端替代品。 从Windows迁移到OS X后,我想要的一项功能是能够在命令行中的各个单词之间跳转,而不必逐个字符地浏览整行。
It turns out that this is quite possible and doesn’t cause much pain and effort on your side. You do not need to pay 1 BTC to Apple to get this working. You only need to make a few keystroke changes in your iTerm preferences and you are done.
事实证明,这是完全可能的,不会给您带来太多的痛苦和精力。 您无需向Apple支付1 BTC即可启动此功能。 您只需要在iTerm首选项中进行一些按键更改就可以了。
In other words, you do not need to install anything else in your OS X. All you have to do is make a few configurations in the iTerm preferences, and you are good to go.
换句话说,您不需要在OS X中安装其他任何东西。所有您需要做的就是在iTerm首选项中进行一些配置,您就很好了。
It’s that easy.
就这么简单。
Let’s get started.
让我们开始吧。
To make this work for the right option key, you need to set the key modifier to act as an escape sequence.
为了使此功能适用于正确的选项键,您需要设置键修饰符以充当转义序列。
First, you need to set your left ⌥ key to act as an escape character.
首先,您需要将左left键设置为转义字符。
After that, you can either change the current shortcut for ⌥ ← or create a new one, in the profile shortcut keys, with the following settings:
之后,您可以使用以下设置在配置文件快捷键中更改⌥←的当前快捷方式或创建一个新的快捷方式:
- Keyboard Shortcut: ⌥← 键盘快捷键:⌥←
- Action: Send Escape Sequence 行动:发送转义序列
- Esc+: b Esc +:b
Now we need to repeat a similar process for the ⌥→ keyboard shortcut with the following settings:
现在,我们需要使用以下设置对⌥→键盘快捷键重复类似的过程:
- Keyboard Shortcut: ⌥→ 键盘快捷键:⌥→
- Action: Send Escape Sequence 行动:发送转义序列
- Esc+: f Esc +:f
That’s all we need to do. After we are done, we may need to restart the iTerm to be able to use the changes that we just made.
这就是我们要做的。 完成后,我们可能需要重新启动iTerm才能使用我们刚刚进行的更改。
Now we can skip entire words on the command line interface by holding down the left ⌥ key and hitting ← or →.
现在,我们可以通过按住左⌥键并单击←或→跳过命令行界面上的整个单词。
I hope you find this article helpful.
希望本文对您有所帮助。
This article was first published by the author on his blog.
翻译自: https://www.freecodecamp.org/news/jump-between-words-using-keyboard-shortcuts-in-iterm-fb1a70cecf79/
iterm2 单词跳转
本文介绍了如何在iTerm2中设置快捷键,以便利用⌥+←和⌥+→快速在命令行的单词之间跳转,无需逐个字符浏览,提高操作效率。

被折叠的 条评论
为什么被折叠?



