Live data from Hacker News

Here is why vim uses the hjkl keys as arrow keys

catonmat.net

81–90 of 100 posts

Re: Here is why vim uses the hjkl keys as arrow keys

#82

Doesn't this go way back though? The reason that keyboard had those arrows keys on it was because those keys correspond to CTRL-H, J, K, L and the CTRL key back then worked by killing bit 6 (and bit 5) of the characters being typed. The effect was that H which is ASCII 0x48 would become 0x08 which is backspace. If you look at an ASCII table (e.g. http://www.asciitable.com/ ) you will notice how the uppercase ASCII le…

This is correct, and the reason they used those keys was that it was the 'home row' on a typewriter which was used in teletypes which meant your little finger could push 'ctrl' and your right hand could drive the cursor through forms without moving off the home row. When I saw the title I was expecting to see a picture of the rogue screen. Rogue (and later hack, and nethack) is a text displayed dungeon exploration ga…

Count me in the school of thought that the control key is meant to be to the left of the A key, just like the horn button is meant to be in the center of a car steering wheel. Every computer keyboard I worked with before the advent of IBM PCs had this arrangement. Every computer I work with now I reconfigure to swap the caps lock with the control key.

IT IS THE NATURAL ORDER OF THINGS.

Re: Here is why vim uses the hjkl keys as arrow keys

#83

ADM3a was a terminal, not a computer. I used to use these two in around 1976 or so. And the hjkl pattern has nothing to do with this or any other terminal. The ASCII control codes for Ctrl-H, Ctrl-J, Ctrl-K and Ctrl-L were used to make the Teletype's printing carriage move left, down, up or right. Bill Joy's innovation was "modes" so that Ctrl-H did not delete the character when it moved left, etc...

  8 H backspace
  9 I tab (right a lot)
 10 J line feed (down)
 11 K vertical tab (down a lot)
 12 L form feed (down a page)
 13 M carriage return (left a line)

Re: Here is why vim uses the hjkl keys as arrow keys

#84

Earlier quoted context omitted.

That's a brilliant layout. Unfortunately it appears to require a "tall enter" keyboard rather than the much more common "wide enter". I'm in the market for a nice cherry blue keyboard, so I'll see if I can find one with a tall enter. Anybody have any sources?

I'm using the silent ([EDIT: I had this in reverse..] cherry mx brown; non silent is cherry mx blue) DAS keyboard[1]. The "professional" model has the letters on the keys, if you don't want a blank one. They seem to come in both US (wide enter) and UK (tall enter) versions. I personally chose the UK one as that's what I'm used to. Here[2] is a photo of my keyboard. The coloured keys are sold as WASD/escape keys but I…

I bought a das keyboard last year for home. I got the blank keyboard, but found that a lot of random hand issues went away. I ended up buying myself a second one for work, and will absolutely not go back to a standard keyboard.

Re: Here is why vim uses the hjkl keys as arrow keys

#85

This feature of vi/vim along with not being able to save and quit as quickly as I can in emacs (ctrl-s ctrl-x, baby, none of that :q! shite) is the reason I use emacs. I totally respect those that use vim, but I'm not a freaking machine.

:x or ZZ instead of :wq wins :)

Re: Here is why vim uses the hjkl keys as arrow keys

#86

Most of the answers I've seen as to why hjkl have fallen into the "so your fingers stay on the home row / it's actually quite fast once you get used to it" realm. But those answers were never completely satisfactory to me. Once you get used to it, it's fine. But I feel like it would have been fine as adsw, or jkl; (so that your hand really is on the home keys) or some other 4 key combination near the home row, too. T…

I have another good suggestion: learn pressing the left control with the side of your palm. It's usually a very minimal movement, and I find it a lot easier (and less straining) than moving the pinky to press control. The only drawback is that it doesn't really work on a laptop keyboard. I picked that up a few years back playing World of Warcraft and some other games, to avoid having to move my left hand away from WA…

Yeah, I do that. One reason why I hate laptop keyboards!

Re: Here is why vim uses the hjkl keys as arrow keys

#87

Earlier quoted context omitted.

I have created an ergonomic layout based on the us layout, called us_split. In it, Vim's hjkl actually are the home position. The layout works under Gnome. It's just like qwerty but a bit different. Basically the two columns from the right are put in the middle. Time to learn to use it fluently is only a couple of days if you touch type qwerty already. https://bitbucket.org/cheater/us_split/overview I see a lot of pe…

That's a brilliant layout. Unfortunately it appears to require a "tall enter" keyboard rather than the much more common "wide enter". I'm in the market for a nice cherry blue keyboard, so I'll see if I can find one with a tall enter. Anybody have any sources?

It works for horizontal enter as well.. the only key that is missing from a horizontal-enter keyboard is the one between left shift and z, which is just backspace, so you can disregard it. It's just that with a horizontal enter key, the ; key is above the enter. With a boot-shaped enter key the ; is next to l, which makes it easier for me to hit it. I use the command line a lot.

If you're looking for a good place that does boot shaped enter keyboards then you can use Unicomp's Model M. You can rearrange the keys as you wish and they'll even print key caps with anything you want on them with the home row indicator tab, so you can put one on the h key.

Re: Here is why vim uses the hjkl keys as arrow keys

#88
post #50
post #19

Earlier quoted context omitted.

Just never decide to learn dvorak.

This is good advice in all situations, having watched my bandwagon-jumping friends flail helplessly when using anyone else's computer. And all for a small potential increase in speed, at the cost of making your computer unusable to others and completely screwing the convenience of most keyboard shortcuts.

> at the cost of making your computer unusable to others

I have a qwerty guest keyboard next to my Kinesis Advantage. Also dvorak isn't necessarily that faster, but rather more comfortable.

Re: Here is why vim uses the hjkl keys as arrow keys

#89
post #49
post #36

Earlier quoted context omitted.

I prefer caps lock to Control. ^C does the same thing as escape in Vi[m]. While it is chording, the combo is pretty easy to hit. This is a bit of a compromise, but all the other programs that are not vim will benefit from it.

Never knew that Ctrl-C does the same thing as escape. Thanks for the info!

Life changes. Yet again. Thank you, thank you ..

Re: Here is why vim uses the hjkl keys as arrow keys

#90
post #36

Earlier quoted context omitted.

I prefer caps lock to Control. ^C does the same thing as escape in Vi[m]. While it is chording, the combo is pretty easy to hit. This is a bit of a compromise, but all the other programs that are not vim will benefit from it.

Another excellent trick I read somewhere is to map 'jj' or 'jk' to esc when in insert mode (so 'inoremap jj '). As a digraph they never occur in a natural language, so you'll never type it accidentally. And you can hit it on the home row easy-peasy. Although personally I type in Colemak, I still use this, just with 'yy' instead. To be honest, it's a barely noticeable slow-down but it's much less stressful for my hand…

It's common to use double letters (ii, jj, kk) as inner indices when writing tiled multi-dimensional array code. Regardless of whether you think that is a good convention, you should be preserving that convention if you are editing legacy code that was written that way.
Post reply on HN