= = =

Let me tell you a story.

A child in his hometown, used to eat with his left hand, even wipe his ass, are with his left hand to take paper. This habit, it turns out, was discovered by his careless grandmother, who, for some reason, is as grumpy as a tiger.

The next day, the grandmother beside him chanting, chanting… He was even sentenced to death. A few days ago, I went back and saw that this habit had changed abruptly.

In the distance you could see the little top with the doll’s right hand spinning. I leaned in the same direction as the baby, bent down and gestured to make sure it was my right hand.

Why force a child to use his right hand? Because she was right-handed and had right-leaning infrastructure, she thought her left hand was neither fish nor fish.

The problem of Vim

Vim is undoubtedly the most popular editor for programmers. Whether you are active or passive, you will have some contact with it. Major Idea, Atom, VSCode, and so on all provide vim key bindings via plug-ins. Even Chrome offers plugins like Vimium that allow vim to roam.

The most basic operation is the control of the optical target.

H left L right J down K upCopy the code

What makes people wonder is that these four letters, there is no abbreviation meaning, he is just a few keys connected.

Because I use these keys so much, the caps are smooth and bright.

You can say that you are a vim party through and through.

Why are vim arrow keys ridiculed

In order to stop using arrow keys to control cursor movement and force the use of H, J, K, and L, you can disable these four keys in vim configuration files.

noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
Copy the code

In this way, when you press the ARROW key, nothing will happen, forcing your hand on HJKL.

Don’t talk about religion or philosophy. It’s just a habit.

In order to illustrate this problem, I drew several lines specially, inactivating the four HJKL keys and replacing them with the corresponding SDFG.

S 'left' G 'right' D 'down' F 'upCopy the code

If you follow this model, it will still work, for beginners there will be no difference. However, some concepts make you feel uncomfortable for the master. I can control the direction with my left hand, control the mouse with my right hand, crush you in theory. Don’t talk to me about being close to I (insert mode), because I can change w to the corresponding function.

That means a complete transfer of experience and customization, so I’m not going to do that.

So why should the use of arrow keys to control the direction of vim’s movement be ridiculed? Is it because the D-pad is small? It should be. Because a lot of keyboards now have no arrow keys, you can change machines blind.

A faster way to browse

The following content, from a discussion in 2013, has been discussed on Hacknews. I’m going to change to the first person.

Reference content:

Habit breaking, habit making ( 1t.click/a8r5 )

Vim users: stop using hjkl (vimcasts.org) (1t.click/a8r8)

The cursor moves one by one at a snail’s pace. Is there a faster speed? There is.

Five times faster left to right

H and L are used to control the left and right movement of the cursor, one distance unit at a time. There’s a faster way to move left or right.

This corresponds to B and W; E, GE, etc. If the average length of each word is 5, the movement is 5 times faster.

Single-line character search

We usually use, maybe a little more search mode. Type/search in normal mode. And for a row, through f, f, t, t,,; And other keys, can be fast, instantaneous positioning to the corresponding position.

'f' lookup character; F {char} will locate to the cursor position 'f' where the first {char} appears; Similar to f, but looking backwards; 'repeat last search', 'if you repeat last search too much, you can go back through', 'Copy the code

These operations are relatively unfashionable. But for someone who’s already introduced to Vim, mastering it can be a boon. To enforce these commands, disable some buttons and enter hard mode.

If you want to practice this skill, you must first go to the palace. Look what’s banned!

noremap h <NOP>
noremap j <NOP>
noremap k <NOP>
noremap l <NOP>
Copy the code

Start your training with a cup of tea on a leisurely and enchanting afternoon.

You can force your muscles to accept this faster setting by forcing some of the keys mentioned above to increase roaming speed. This is invaluable if you’re looking for faster efficiency.

End

The theme of this article is actually quite clear. Besides talking about a possible way to make your Vim fly faster, it mainly illustrates a habit problem.

The problem of habit is the problem of habit, although there are some explanations of faith, or some miraculous adulation, but this is from the high. What are good habits? It’s just the majority of opinions about something in group evolution, there’s no right or wrong.

But it’s always a little off. In addition to the problem of habit in line with the masses, it seems not so incongruous, more important, is a kind of active correction and evolution. Although the pain, but endless benefit.

Blocks don’t have to be horizontal, but now you’re reading lines from left to right.

It’s like, when everyone’s wiping their asses with their left hand, I’m definitely not using my right.

You can follow my B station account →→→→B station account

Study communication groups →→→→ →Communication group