VIM: Doesn't VIM 'replace' use of CTRL with ESC?

99封情书 提交于 2019-12-05 10:27:43

问题


It is usually advertised that using VIM alleviates the need of moving the hand away from home row. However, it seems that instead of going to CTRL, I am stretching my hand to ESC all the time.
Note: I am a new vim user and I am trying to migrate from Notepad (windows) to VIM. I am asking this question, in case there is some issue in my use or understanding of VIM philosophy.


回答1:


When vi was originally written, it was written on this keyboard layout:

Note that the Esc is where Tab is on most modern day keyboard layouts and was much less of a stretch. This also explains why hjkl are the proper "arrow" keys in vim and why some of the other common keys in vim may seem like unusual selections.




回答2:


I almost always use Ctrl+[ instead of Esc. It is fairly easy key combination to type. The only exception is when I panic and have to escape ten times in a row.




回答3:


ESC is only used when switching from Insert/Replace to Normal mode. In Normal mode is where you spend the vast majority of your time - searching, scrolling, reading, cut/copy/paste (or, in vim terms, delete/yank/put), and so on.

While ESC is hit a lot, it shouldn't be anywhere near as much as CTRL on Notepad. However, there are also several alternative ways to avoid hitting the ESC key: http://vim.wikia.com/wiki/VimTip285 , as well as ways to put Caps Lock to use as ESC: How to map CAPS LOCK key in VIM?

Personally, I don't find it a problem, as my ESC key is the farthest key to the left on the top row; I can hit it without searching for it, and return my hands to their usual position while blindfolded. My wrist doesn't even move from its position on my laptop ;)




回答4:


As lzkata pointed out, it's only used to switch from insert to normal mode. Depending on the work you're doing, you might go back and forth more often. However, as you gain experience with vim, you'll find you switch modes much less frequently. (If you're going to make small edits of different types in different locations on many lines, you CAN use the arrow keys in insert mode if the terminal supports them, but you should generally try to find other normal mode ways of making common edits - get really good with fast navigation with t, T, f, F, G, etc. )



来源:https://stackoverflow.com/questions/8017899/vim-doesnt-vim-replace-use-of-ctrl-with-esc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!