Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iTerm2中设置跳转&删除等快捷键 #9

Open
JayFate opened this issue Aug 18, 2023 · 0 comments
Open

iTerm2中设置跳转&删除等快捷键 #9

JayFate opened this issue Aug 18, 2023 · 0 comments

Comments

@JayFate
Copy link
Owner

JayFate commented Aug 18, 2023

作为一名软件工程师,我发现自己每天都在使用终端来运行各种各样的命令。我目前选择的终端是iTerm2,我已经愉快地使用了很多年了。

每当我在新的Mac上设置iTerm2时,我做的第一件事就是为命令提示符中的常见导航和编辑操作配置熟悉的键盘快捷键。例如,我通常会配置⌥←的快捷键,让我跳到光标下的单词的开头。

要在iTerm2中配置自定义键盘快捷键,请打开偏好对话框,并导航到 "配置文件""按键""按键映射"标签。

image.png

点击 "+"按钮添加一个新的按键映射,或者双击现有的按键映射来编辑它。对于 "跳到单词开头 "命令,选择 "发送转义序列 "动作并发送转义序列Esc+b

image.png

现在,每当你在iTerm2中输入一个命令时,真的很容易跳回到单词(甚至是多个单词)的开头,以插入更多的文字或删除命令的一部分--不再需要反复按←键来逐字导航。

下面是我为各种跳转和删除命令配置的全部键盘快捷键列表。

快捷方式 命令 Action 发送
⌥← 跳到字的开头 Send Escape Sequence b
⌥→ 跳到字的末尾 Send Escape Sequence f
⌘← 跳到行的开头 Send Hex Code 0x01
⌘→ 跳到行尾 Send Hex Code 0x05
⌥⌫ 删除到字的开头 Send Hex Code 0x17
⌘⌫ 删除整行 Send Hex Code 0x15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant