[UPDATE] add key mapping in vim.md (#333)
This commit is contained in:
parent
260b2c5ad0
commit
36bb20bd5e
|
|
@ -20,6 +20,20 @@ There is a vast amount of learning material available on Vim, but the best way t
|
|||
- Use Vim's own `vimtutor` to practice. After installing Vim, type `vimtutor` directly into the command line to enter the practice program.
|
||||
- Then you can force yourself to use Vim for development, and you can install Vim plugins in your favorite IDE.
|
||||
- Once you're fully comfortable with Vim, a new world opens up to you, and you can configure your own Vim on demand (by modifying the `.vimrc` file), and there are countless resources on the Internet to learn from.
|
||||
- If you want to know more about how to customize Vim to suit your needs, [_Learn Vim Script the Hard Way_](https://learnvimscriptthehardway.stevelosh.com/) is a perfect start point.
|
||||
|
||||
## Remapping Keys
|
||||
|
||||
Ctrl and Esc keys are probably two of the most used keys in Vim. However, these two keys are pretty far away from home row.
|
||||
In order to make it easier to reach these keys, you can remap CapsLock to Esc or Ctrl.
|
||||
|
||||
On Windows, [Powertoys](https://learn.microsoft.com/en-us/windows/powertoys/) or [AutoHotkey](https://www.autohotkey.com/) can be used to achieve this goal.
|
||||
On macOS, you can remap keys in system settings, see this [page](https://vim.fandom.com/wiki/Map_caps_lock_to_escape_in_macOS).
|
||||
|
||||
A better solution is to make CapsLock function as Esc and Ctrl simultaneously. Click CapsLock to send Esc, hold CapsLock to use it as Ctrl key.
|
||||
|
||||
On Windows, this [AutoHotKey gist](https://gist.github.com/sedm0784/4443120) does just this.
|
||||
On macOS, this [karabiner rule](https://ke-complex-modifications.pqrs.org/#caps_lock_tapped_escape_held_left_control) does the magic.
|
||||
|
||||
## Recommended References
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,19 @@ Vim 的学习资料浩如烟海,但掌握它最好的方式还是将它用在
|
|||
- 用 Vim 自带的 `vimtutor` 进行练习,安装完 Vim 之后直接在命令行里输入 `vimtutor` 即可进入练习程序。
|
||||
- 最后就是强迫自己使用 Vim 进行开发,IDE 里可以安装 Vim 插件。
|
||||
- 等你完全适应 Vim 之后新的世界便向你敞开了大门,你可以按需配置自己的 Vim(修改 `.vimrc` 文件),网上有数不胜数的资源可以借鉴。
|
||||
- 如果你想对配置 Vim 有更加深入的了解,[_Learn Vim Script the Hard Way_](https://learnvimscriptthehardway.stevelosh.com/) 是一个很好的资源。
|
||||
|
||||
## 关于键位映射
|
||||
|
||||
用 Vim 编辑代码的时候会频繁用到 ESC 和 CTRL 键, 但是这两个键都离 home row 很远, 可以把 CapsLock 键映射到 Esc 或者 Ctrl 键,让手更舒服一些。
|
||||
|
||||
Windows 系统可以使用 [Powertoys](https://learn.microsoft.com/en-us/windows/powertoys/) 或者 [AutoHotkey](https://www.autohotkey.com/) 重映射键位。
|
||||
MacOS 系统提供了重映射键位的[设置](https://vim.fandom.com/wiki/Map_caps_lock_to_escape_in_macOS),另外也可以使用 [Karabiner-Elements](https://karabiner-elements.pqrs.org/) 重映射。
|
||||
|
||||
但更佳的做法是同时将 CapsLock 映射为 Ctrl 和 Esc,点按为 Esc,按住为 Ctrl。
|
||||
|
||||
Windows 系统下,这个[AutoHotKey gist](https://gist.github.com/sedm0784/4443120) 实现了这个功能。
|
||||
MacOS 可以导入[这个 karabiner rule](https://ke-complex-modifications.pqrs.org/#caps_lock_tapped_escape_held_left_control) 重映射。
|
||||
|
||||
## 推荐参考资料
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue