Why is h, j, k, l recommended to use the arrow keys for vim?

I am a vim user (not a beginner, not an advanced one). I use the arrow keys.
I have repeatedly read that to increase performance, it is strongly recommended to use the h, j, k, l keys.
I tried to use them, but I don’t see how they help in more productivity.

Because if I use the h,j,k,l keys to move up / down / right / left, I need to press ESC first to exit insert mode.
But that defeats the goal, right? Since the original idea is that you do not need to look away.
If I press ESC, I can also use the arrow keys and save the keystroke.
Maybe I'm something wrong here?

+5
source share
6 answers

Old terminal keyboards, such as the ADM-3A terminal, did not have arrow keys. The keyboard layout looked like this, and she already had arrows for hjkl. (By the way, also pay attention to the relationship between the ~ and Home keys)

ADM-3A terminal

I think that mainly for historical reasons, vim is still using it (and many are used to it). Perhaps also because many system administrators are nostalgic about things from 70/80, and because they can boast of how they can print faster (for example, typing is the reason for slow coding ...).

+4
source

A distinctive feature of vi / Vim is that it is mode-based. It means:

  • you stay only in insert mode for short input bursts
  • in other modes (mainly in normal mode), you have all the keys [combinations] available for powerful editing commands (which are very regular in Vim and can be combined with great effect).

So, it’s very important that you can easily switch between modes. For many users, this means reassigning the Esc key to a more convenient place (replacing Caps Lock or Ctrl ). Then, using H J K L for navigation (note that these are just the basics, and it is often better to use more specific movements, such as w or f{char} ), faster, because your fingers can stay on the home bar (assuming you're a touch driver you should invest in if you spend a lot of time on a computer). The arrow keys are so far away that switching takes too much time (using the mouse is even worse), and this is not good for your wrists.

+2
source

The problem with the arrows is not that they are too far away: the problem is that they allow you to move by character and in turn. And guess what? This is exactly what hjkl does. The only advantage of hjkl over arrows is that it keeps this slight movement of the hand from the arrows. Do you think this is profitable, this is your call. In my opinion, this is not so.

hjkl only slightly better than arrows, while Vim's more advanced movements, bBeEwWfFtT,;/?^$ etc., offer a huge advantage over arrows and hjkl .

FWIW, I use arrows for small movements, in normal and plug-in modes, and advanced movements higher for large movements.

 mouse-using sucker everyone laughs at: (move)↓↓↓↓↓↓↓↓↓↓→→→→→(move) hjkl-obsessed hipster: jjjjjjjjjjlllll efficient vimmer: /fo<CR> 
+2
source

h, j, k and l are on the home line. If you move your hand to use the arrow keys, you must redo it when done with the arrow keys. This is only a problem for touch typists (who were all that day).

+1
source

If you like to use the arrow keys, use them. There is one advantage that I see with hjkl: the arrow keys work in insert mode. Others prefer to move their fingers only minimally. This is a good argument if you are a touch typist and you need to type a lot of text. At least for me, my thinking is always slower than my editing, so typing speed and minimal finger movement is not so much a problem for me.

In the end, this is a rather subjective question. Use what works for you, but try to inspect and extend your horizon from time to time.

0
source

hjkl is a step towards more powerful features. Do you really think that left, right, up, down is as advanced as moving the cursor into the 21st century (or 1976)?

0
source

Source: https://habr.com/ru/post/1206060/


All Articles