If you use vim in a terminal, simply press alt/meta+normal_mode_key. Most terminals send an escape character followed by the normal_mode_key that you pressed, removing the need to press escape yourself.
The terminals konsole and gnome terminal send the escape by default when you press alt/meta+normal_mode_key. For Xterm you can ctrl+click and select the option "Meta sends escape" or "Alt sends escape". [1]
Thus in insert mode pressing alt+h alt+j alt+k alt+l all take you to normal mode and move in the expected direction. You can hold down alt when moving even while in normal mode since the additional ESC that is sent does no harm.
The advantage of using this scheme is that you can use the alt/meta+key combination with any normal mode key, e.g.
- alt+o opens a new line below the one you are currently editing,
- alt+A appends to the end of the current line,
- alt+p pastes at the current insert location.
- alt+k moves up
Thus using vim via a terminal gives you these short cut powers on any stock standard system without the need to edit each systems vim mappings.
====
http://vim.wikia.com/wiki/Avoid_the_escape_key
使用Vim编辑器时,在终端中可以通过Alt或Meta键配合其他按键快速进入正常模式并执行相应操作,无需手动按Esc键。这种方法适用于Konsole、GNOME Terminal及配置后的Xterm等终端。这种方式让用户可以更高效地利用Vim的各种功能。
3万+

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



