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;'?
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?"
– Martin Tournoij
Aug 24 '16 at 14:12
← for assignment and ↑ for return, both of which were present on the Xerox keyboard layouts. Nowadays Smalltalk uses := and ^.) I believe, the navigation keys are the ones in the top right corner with the fingers pointing in different directions.
– Jörg W Mittag
Aug 24 '16 at 14:37
^I is tab.) - though I suppose in theory they could have used UHJK, if we assume that they only cared about maintaining the meaning of ^H and ^J.
– Random832
Aug 24 '16 at 18:36
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...
– Martin Tournoij
Aug 24 '16 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.
– DJMcMayhem
Aug 24 '16 at 16:36
<leader> feature in vi.
– Random832
Aug 24 '16 at 18:23
:map at all)
– Random832
Aug 24 '16 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
vimis exempt from keeping up with technological advances :3 – Alexander Aug 23 '16 at 15:15hbut rather on thej(that's why you have a "nipple" on thejkey). Reason for that is that you will usebmuch more thanhand having;accessible is handy in a lot of programming language (and with a shift, you have:which is ever more handy in Vim). – nobe4 Aug 23 '16 at 16:05