I have read it in many articles (e.g.) that it's a bad practice to use arrow keys in normal mode. Could somebody explain why is it considered a wrong practice, if at all?
Actually this is not a bad practice.
A lot of people (including Vim's doc as @B Layer's answer shows) argue that you shall not use arrow keys because it makes your hands move from the home row (the second line of your keyboard where you have hjkl) and that make you less efficient.
This is (IMO at least) a bad result from vim "purists" circle jerk: new users follow this blindly, some even disable the arrow keys and then they complain that they are not as efficient as before.
The only real rule to use vim is to use it efficiently: if you feel more comfortable using Left and Right than h and l be it, use the arrow keys. Vim even has
set mouse=a option if you want to use a mouse!
Once you get used to vim and get better with the different available motions (f, t, ,, ;, w, b, e, ge, and basically everything in
:h quickref) you might realize that you don't use arrow keys that much. And if you still use them, it's not a problem, use what you are most efficient with.
Note That the argument of don't leave the home row for more efficiency is not that good in my opinion: If you take a look at Why does vim use hjkl you'll see that these keys were chosen because there weren't any arrow keys when Vi was written. One could argue that maybe if the keyboards were different at this time no one would consider not using the arrow keys a good practice.
I don't know if this is really relevant any more, but I'm an old-timer so here's a bit of history.
In the old days, VT100 terminals had arrow keys, but pressing one transmitted an escape sequence like
<ESC>[A for up,
<ESC>[B for down, etc.
Also, being a serial terminal communicating at 9600 baud, it was possible for the user to press the keys too fast to transmit the whole sequence which would cause one key press to interrupt the sequence of the previous key press and confuse vi.
This would cause vi to inexplicably go into insert mode and insert [B[B[B[B[B[B into your file if you held down the down arrow. I say inexplicably because there's nothing about this sequence that should enter insert mode and the fact that each sequence starts with an ESC character should have exited insert mode. But still, it would insert garbage. Not always - just when you were in a hurry.
One quickly got tired of this and decided to just stick to the
While I agree with @statox that no one should be chastised, shunned, excommunicated, or tarred-and-feathered if they choose to use the arrow keys...use your software however you see fit...I wouldn't exude as much of a laissez-faire attitude if I were giving guidance to an open-minded new user. I'd pretty strongly recommend that they start with following best practices. They are "best practices" for a reason...they've been employed to good effect by lots of people who came before you and me.
Heck, even Vim's own help nudges you in that direction, though not without hyperbole ("greatly slow down")...
You can also move the cursor by using the arrow keys. If you do, however, you greatly slow down your editing because to press the arrow keys, you must move your hand from the text keys to the arrow keys. Considering that you might be doing it hundreds of times an hour, this can take a significant amount of time.
There's also the fact that whatever choices you make at the start may become habits that are difficult to break if you want to change in the future. So all else being equal why not adopt a recommended habit now rather than take the chance that using arrow keys is inefficient or carpal-killing?
All in all, consider giving an honest effort to doing things without arrow keys. After a reasonable amount of time if you just can't live without up/down/left/right...don't.
...is what I would say to a new user who was interested in my opinion. Don't take it personally if you don't agree (I'm talking to you, downvoter).
Other answers have said that the efficiency loss from moving your hands from the home row isn't that big a deal, and I mostly agree. However, what is a big deal is when you are learning vim, always using arrow keys to avoid switching back into normal mode.
In other words, using a single ← where you would have used a single h isn't a huge loss in productivity, but using ←←←←←←←←←← where you could have used EscI is a huge loss.
That's why people tell you to avoid the arrow keys when you're learning vim, because it forces you to learn normal mode instead of never leaving insert mode. Normal mode is where all your efficiency gains are.
There are two main reasons why people say you shouldn't use the arrow keys. Some claim that hjkl is preferred because it keeps your hands on the home row, which isn't false, but also doesn't matter. Others, including myself, would say you shouldn't use the arrow keys if you're moving more than a few characters, but you shouldn't use hjkl, either.
The important thing isn't which keys you're using, but rather how many. If you want to move to the beginning of the word, you don't hit
hhh; you hit
b. End of the word is
llll. Beginning of the line:
0, end of the line:
$. And anything further,
/search for the text that exists where you want to go. (or whichever of the advanced movement commands you prefer).
But any time you find yourself typing the same key more than twice in a row, there's a better way to do it.
A more precise statement might be "using the arrow keys is bad practice while trying to learn vim better". People new to vim are used to using the arrow keys to move around and so don't learn
hjkl, thus not getting the chance to see if this is preferable.
Personally, after gaining some general familiarity with vim, I disabled the arrow keys for a while to get the hang of
hjkl and reenabled them later to simplify my
.vimrc. The conventional wisdom holds in my case; once I knew how to use both
hjkl and the arrow keys, I found myself almost exclusively using the former.
The usual answer involves efficiency. You've likely been trained over the years to employ touch typing, which employs keeping your hands on asdf and jkl;. A vast majority of the key bindings in Vi are designed around this fact, including the hjkl movement commands.
Personally I actually use both. I use hjkl when I'm actively editing large sections of text, and the arrow keys when scrolling through log files (and |, g, and / when I'm doing spot edits throughout a file). This just happens to be what works well for me, and in a case like this, that's what really matters.
Long time ago, many terminals did not have arrow keys, or did not have all four of them. Software systems that needed navigation normally provided some sort of navigation approach without relying on arrow keys, and vi's hjkl is a canonical example. (Another classical example is WordStar's ^E-^S-^X-^D.) As keyboard navigation's utility became increasingly obvious, more and more new terminals began to come with arrow keys, and software systems often mapped these to the old ways of navigation. However, this provided a portability concern of sorts: if children trained at schools were to come to rely on such a fancy new-fangled feature as arrow keys, the thinking was, they might not be able to be productive on the — once common — keyboards without arrow keys.
So, teachers of courses into basic computing began to cautiously warn students to learn to use the lowest common denominator so as to maximise their employability. And this practice has long outlived any reasons that it may once have had.
In modern implementations of vi, the main reason to prefer hjkl is that it's slightly faster to use keys already under your hand than moving your hand to wherever your arrow keys are. The downside of avoiding the context switch of your hand, of course, is that you may need to perform a context switch of vi. Nowadays, when humans are very rarely treasured by typing speed, whether you do one or the other is pretty much a matter of personal preference, and there's nothing inherently bad about using arrow keys anymore, if there ever was.