Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

notepad

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.

like image 970
Asad Iqbal Avatar asked Nov 05 '11 03:11

Asad Iqbal


People also ask

How do I use Esc in vim?

Ctrl - [ sends the same character to the terminal as the physical Esc key. The latter is simply a shortcut for the former, generally. I once had a real vt220 terminal, and its keyboard does not have a Escape key. Pressing Ctrl+[ was the only way to generate Escape .

How do I change the Esc key in Vim?

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. 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.

How do I exit Vim without escape?

Exit Vim Using a Shortcut Key In addition to command mode, Vim also has the option for shortcut keys: To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.

Why is my Esc button not working?

Why is my Esc button not working? There could be a number of reasons why the Esc button is not working on your Windows 11/10 PC. But a simple fix to the issue is by pressing the Shift and Escape keys. When the Esc key is not working, you can try pressing the key combination Shift + Esc to close the app.


1 Answers

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

enter image description here

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.

like image 150
Randy Morris Avatar answered Nov 15 '22 23:11

Randy Morris