Live data from Hacker News

Here is why vim uses the hjkl keys as arrow keys

catonmat.net

31–40 of 100 posts

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

#31

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 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?

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

#32

Earlier quoted context omitted.

I use JKLI. The two main advantages are that you don't use your pinky finger repetitively, and the layout of JKLI makes intuitive sense as to what each key does.

Once you get used to hjkl,it's pretty "intuitive" (in that you don't need to think about what you're doing).

Unless you use Dvorak. I know I'm in a super minority here. But shortcuts based on keyboard location rather than tied to some mnemonic are damn near impossible to get right. Doubly so when I have to switch to QWERTY to work with anyone else.

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

#33
I've got one of those sitting in my spare room... I'd be using it right now were it not for a busted flyback, which emits a whine capable of giving me a headache within 15 minutes. It's really a rather nice terminal, with an oddly attractive screen font and a keyboard that is well-suited to UNIX.

The coolest part is that there is no microprocessor, just a bunch of 7400 series ICs and some DIP switches to configure things.

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

#34

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 use JKLI. The two main advantages are that you don't use your pinky finger repetitively, and the layout of JKLI makes intuitive sense as to what each key does.

You don't use your pinky for hjkl either, or use shift.

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

#35
post #6

Perhaps just as enlightening is the location of the Esc key (to the left of Q): http://en.wikipedia.org/wiki/File:KB_Terminal_ADM3A.svg

I'm just learning vim and just yesterday I was wondering why they chose the escape key.

These days I mostly use Ctrl-C instead of Esc, just because it's so much easier to type.

If you make a serious commitment to vi(m) though, binding your capslock to esc is probably the better way to go.

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

#36

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 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…

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.

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

#37
If anyone is apprehensive about vim's hjkl keys, and you like the arrow keys better, you can use ijkl instead and get all the benefits of the muscle memory you have built up for arrow keys, while still keeping your hands on the home row. Use this mapping:

    " remap h to i and use ijkl for inverse T cursor movement
    map k g
    map i g
    map j 
    noremap h i
Then the 'i' key will be replaced by 'h'. So press 'h' to insert, or for inner selections, instead of 'i'. Also note the 'g' for up/down motions, which means it won't skip the wrapped part of lines - just remove the 'g' if you don't like that.

If you're worried this breaks anything else, I've had this interfere with just one other thing: a plugin that let me select text based on indentation of the line the cursor was on, but I made a few minor changes to the vimfile for the plugin and fixed that pretty easily. The other thing is that random servers won't have these mapped, but just copy the config over if you'll be doing a lot of text editing on that server. Otherwise, you can just fall back to using hjkl awkwardly.

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

#38
post #19

I'm actually glad it worked out that way, I hate using the regular, out-of-the-way arrow keys. They're even more annoying than the mouse.

Just never decide to learn dvorak.

Agreed, learn Colemak instead ;-)

Seriously though, I think with a tiny bit of key-swapping in the vimrc, you can use dvorak or colemak just fine.

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

#39

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 game and was often the first exposure folks got to the convention of h,j,k,l as left right up down.

I really miss having control over there. I xkeymap it there of course but some keyboards have a physically 'push-on/push-off' caps lock key there which is annoying.

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

#40

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…

Then the question becomes, is there a reason those control characters correspond to those letters? I have a hard time imagining a world where BS is ^Q and VT is ^V and therefore the arrow keys are spread out all over the keyboard.
Post reply on HN