不离开主行返回正常模式
我一直在尝试 vim,对于经验丰富的程序员来说,强调速度和可访问性是有意义的。我以前使用过 emacs,目前使用 nano,以及诸如 之类的东西gedit 或 geany。
我对不断切换模式的需要感到困惑,并且从插入模式返回到正常模式需要离开主行按 Esc。我之前读过,在一些首次使用 vim 的系统上,这个键是 Tab ,这更有意义,但在当前的系统上,在编码时 tab 预计参与智能缩进,则不是这样。
返回正常模式是您始终需要执行的操作。是否有一些替代键映射可以使此操作更快,或者我根本不知道可以执行此操作的映射?
I've been trying out vim, and the emphasis on speed and accessibility makes sense for the veteran programmer. I've previously used emacs, and currently use a combination of nano, and stuff like gedit or geany.
I'm confused by the need to constantly switch modes, and that returning from insert mode to normal mode requires leaving the home row to press Esc. I've read that previously, this key was Tab on some systems where vim was first used, which makes a lot more sense, but not on current systems where tab is expected to participate in smart indenting when coding.
Returning to normal mode is an operation that you need to perform all the time. Is there some alternative key mapping that makes this quicker, or mappings that I simply don't know about that do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Ctrl+C 也可让您返回正常模式
Ctrl+C also return you to normal mode
您也可以使用 ^[。如果您已将大写锁定键映射到控制(强烈推荐),那么这将变得相当简单。
You can also use ^[. If you've mapped your caps lock key to control (highly recommended), this becomes a rather easy keystroke.
你可以映射任何你想转义的内容:
除了当我谈论这个映射时之外,我还没有遇到过需要在彼此旁边键入 kj 的情况。我见过其他人使用 jk 或 jj,但 kj 最适合我。
You can map whatever you like to escape:
I haven't yet run across a situation where I need to type kj next to each other, besides when I talk about this mapping. I've seen other people use jk or jj, but kj works best for me.
我个人使用
Capslock
键作为第二个Esc
键,所以非常舒服。您可以通过将以下行添加到.xmodmap
文件中来完成此操作:I personally use the
Capslock
key as the secondEsc
key, so it is very comfortable. You can do it by adding the following lines to your.xmodmap
file:我个人使用
ii
退出插入模式,同时停留在主行,但这只是个人喜好的问题:inoremap ii
i
进入插入,ii
进入退出。这对于您的手指来说很容易记住。 (不过我仍然倾向于使用
)I personally use
ii
to get out of insert mode while staying on the home row, but it is only a matter of personal preference:inoremap ii <Esc>
i
to go in insert andii
to go out. This is easy for your finger to remember. (I tend to still use<Esc>
though)我个人使用 Left Control 作为转义键,使用 Caps Lock 作为 Left Control。它不是 vim 映射,而是
X 键盘选项中的 xmodmap+setxkbmap magic: 和 ctrl:nocaps 。不过,您可能有不同的密钥代码。
I personally use Left Control as escape and Caps Lock as Left Control. It is not vim mapping, but some xmodmap+setxkbmap magic:
and
ctrl:nocaps
in X keyboard options. You may have different keycode though.在终端中使用 Alt/Meta
Use Alt/Meta In a Terminal