Live data from Hacker News

Here is why vim uses the hjkl keys as arrow keys

catonmat.net

41–50 of 100 posts

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

#41
post #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…

I'd recommend the opposite. If you're apprehensive about hjkl, force yourself to use it anyway!

  " disable arrow keys
  nnoremap  
  nnoremap  
  nnoremap  
  nnoremap  

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

#42

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…

Good point. One question:

> I'm not sure why FF was used for up.

Did you mean "used for right"?

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

#43

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?

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 used them for playing Skyrim - the green one on the right is especially handy for gaming as i don't have my fingers on the home row when playing games rather than typing. The blurred circuit board is a development version of the Midifighter 3D[3] as the photo was taken before they were announced.

[1] http://www.daskeyboard.com/model-s-ultimate-silent/

[2] https://plus.google.com/u/0/photos/100355674716107842386/alb...

[3] http://www.djtechtools.com/2012/02/27/introducing-the-midi-f...

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

#44
post #41
post #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…

I'd recommend the opposite. If you're apprehensive about hjkl, force yourself to use it anyway! " disable arrow keys nnoremap nnoremap nnoremap nnoremap

I didn't advocate using arrow keys, but rather using ijkl. Your suggestion is not mutually exclusive with my own, you can do both. :)

Though I guess the mappings I provided would have to be noremap instead of map.

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

#46
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.

I use dvorak with vim with (mostly) standard key bindings. It's not too bad. H and K are not far from their respective QWERTY positions. J and K remain next to each other.

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

#47
post #36

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…

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 hands.

There are really a lot of ways to do this. See: http://vim.wikia.com/wiki/Avoid_the_escape_key

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

#48
post #34

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.

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

Good point, not sure what I was thinking. For me the strain of moving my index finger from J to H is more than the strain of moving my middle finger from K to I, but that's probably quite subjective.

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

#49
post #36

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…

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!

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

#50
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.

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.
Post reply on HN