478 points · by freestyler · 14y ago · 98 comments
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 letters line up nicely with the control characters so that just dropping bit 6 will get you there. Same thing with the lowercase (drop bits 5 and 6) and you are on the control characters.
The CTRL-H, J, K, L therefore correspond to BS, LF, VT, FF. BS is backspace (i.e. left), LF (down), VT is vertical tab (so up) and FF is form feed (which in this case takes you up). I'm not sure why FF was used for up.
This is also why CTRL-I is tab, CTRL-D ends a communication. All of that goes back to teletype days. Also for telnet users out there you'll see that CTRL-[ lines up nicely with ESC. And when you see a ^@ being printed on the terminal you can see why it corresponds to a null byte.
One other interesting thing about ASCII: uppercasing and downcasing can be done by twiddling a single bit.
If you look at this picture of an ASR-33 Teletype you'll see that come of the control characters on the keyboard correspond to those in the ASCII set. This is because ASCII evolved from the earlier teletype character sets: http://upload.wikimedia.org/wikipedia/commons/0/0b/ASR-33_2....
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.
IT IS THE NATURAL ORDER OF THINGS.
I'm still looking for a hardware dongle that does nothing but map the caps lock scan code to left ctrl. Sure, I can rebind the key (and I do) but as a contractor I move around a lot and having something that circumvents the OS entirely would come in handy.
> I'm not sure why FF was used for up.
Did you mean "used for right"?
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)This explanation of the origin hjkl is the first one to satisfy me. Now I can see the others, not as explanations as to why it is, but explanations as to why it stuck.
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 WASD as much as possible, but it has served me very well in a lot of other applications since then.
Edit: Well, that was supposed to be an answer to cheatercheater below this comment. Woops.
https://bitbucket.org/cheater/us_split/overview
I see a lot of people in the comments talk about vim's "weird" layout choices. I suggest in your OS you change caps lock to esc; and that in vim you remap ; to : and : to ; in order to stop having to press shift every time. You can then really start doing the whole home row thing; IMO it's impossible without those two crucial settings.
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...
They have tons of choices of blue, black, and brown Cherry switches (I think), you just have to match up their terminology with the right color.
They ship from England too, fyi.
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.
This is a bit of a compromise, but all the other programs that are not vim will benefit from it.
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
And then one day I walked into the lab with shiny new VT-100 terminals with their soft keys; but started hammering on them by habit. And everybody turned around and looked at me as if I was possessed..... :-D
If you make a serious commitment to vi(m) though, binding your capslock to esc is probably the better way to go.
[Edit:] or at least that's what I thought, wavetossed's comment below provides interesting insight.
The thing about ASCII Control characters doesn't quite map to left-up-down-right, and even if it were part of the answer, we could ask again: why were those characters chosen for those control-roles?
It seems more the case that the designers of that computer chose those particular keys on the basis of a desire for efficiency that vi also followed, so there was no need to create a new convention.
How does the author's "That's the whole story!" ending make you feel like he's saying hjkl being used as the navigation keys was a coincidence?
The coolest part is that there is no microprocessor, just a bunch of 7400 series ICs and some DIP switches to configure things.
" remap h to i and use ijkl for inverse T cursor movement
map k g<Down>
map i g<Up>
map j <Left>
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.
" disable arrow keys
nnoremap <Up> <nop>
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>Though I guess the mappings I provided would have to be noremap instead of map.
All those awkward Control reaches originally laid comfortably under the thumbs.
" remap <Leader> to ,
let mapleader = ","
" save with ,w
nmap <Leader>w :w<CR>I have a qwerty guest keyboard next to my Kinesis Advantage. Also dvorak isn't necessarily that faster, but rather more comfortable.
Seriously though, I think with a tiny bit of key-swapping in the vimrc, you can use dvorak or colemak just fine.