Why use the keys hjkl on the same line instead of keys in a triangle like wasd for moving on video games?
Why not something equivalent with right hand, like ijkl or pl;'?
From http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/:
When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history!
hjkl
and not a more logical shape such as ijkl
?"
Commented
Aug 24, 2016 at 14:12
Nobe4's answer is great, and explains why we use hjkl
very well. However, it's really interesting to see the full keyboard, and a lot of strange things about vim make more sense when you can see the full keyboard it was designed on. For example, why does vi rely so heavily on the esc
key, when it's in such a weird and uncomfortable place? This is why:
As you can see, esc
is where tab is on most keyboards. ctrl
is another key that is slightly awkward to reach, but in a very comfortable location on this keyboard (where caps lock usually is).
vi
have a <Leader>
mapping? I thought that was a later invention...
Commented
Aug 24, 2016 at 16:27
:help <leader>
doesn't have the signature {not in Vi}
text, and it does say vi had :map
(although not :noremap
), so I'm pretty sure that vi had leader. Even if it didn't, I would imagine the history of the vi keyboard would at least somewhat influence the design of vim.
Commented
Aug 24, 2016 at 16:36
<leader>
feature in vi.
Commented
Aug 24, 2016 at 18:23
:map
at all)
Commented
Aug 24, 2016 at 18:25
As to why these arrows were printed on these keys... it's because they could be used with the control key for local cursor movement. Ctrl-H and Ctrl-J (backspace and line feed) are obvious, and an easy mnemonic even today. Ctrl-K is "vertical tab", but was sometimes used for reverse linefeed on pre-ANSI terminals. The use of Ctrl-L for a non-destructive cursor forward was probably chosen based on its keyboard location.
You may also have noticed in the picture of the keyboard in the other answer that "HOME" is on the ^
/~
key. Of course, Ctrl-^ homes the cursor (sends to the top left of the screen, or bottom left, depending on mode).
These control mappings were also used for Wyse terminals, the Kermit protocol, and were supported in some versions of PC ANSI.SYS.
Sources:
kcuf1=^L
and kcuu1=^K
vim
is exempt from keeping up with technological advances :3h
but rather on thej
(that's why you have a "nipple" on thej
key). Reason for that is that you will useb
much more thanh
and having;
accessible is handy in a lot of programming language (and with a shift, you have:
which is ever more handy in Vim).