Linked by Thom Holwerda on Fri 9th Mar 2012 19:11 UTC
General Development "I was reading about vim the other day and found out why it used hjkl keys as arrow keys. When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys, so naturally he reused the same keys." As interesting as that is, John Graham-Cumming goes even further back in history. "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." Truly fascinating stuff, even though it's from way before my time (I'm from 1984).
Thread beginning with comment 510188
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: ...
by Alfman on Sat 10th Mar 2012 03:14 UTC in reply to "RE: ..."
Alfman
Member since:
2011-01-28

Doc Pain,


"Imagine a person with impaired movement of the arm (arm in singular may mean that only one arm is available) or the hand uses a computer. Compare the travelling distance of the fingers from the alphanumeric keyboard section over to the cursor keys. Know that the Escape key is used to switch vi's modes. Now you can easily recognize that having the alternative not to use the cursor keys can be a benefit!"

Personally, I have mixed feelings about VI. I do use it all the time simply because it's available everywhere and that makes it an essential tool. But VI's modes often get in the way of what my brain is thinking and I'd much rather use a stateless interface so my poor escape key can get some rest. To be honest I find ESC to be even less "accessible" than arrow keys are, and while the arrow keys are supported these days, dropping to command mode is still a frequent requirement. Raise your hands, how many people accidentally type or paste text into command mode? I prefer stateless hotkeys because pressing and releasing a modifier has no side effects and I don't have to concentrate on what mode my editor is in (ALT changes focus to menu bar on windows, but CTRL is stateless). I do appreciate the technical limitations under which VI evolved, and I will continue to use it on the console simply out of habit.

Reply Parent Score: 4

RE[3]: ...
by Doc Pain on Sat 10th Mar 2012 04:39 in reply to "RE[2]: ..."
Doc Pain Member since:
2006-10-08

Personally, I have mixed feelings about VI. I do use it all the time simply because it's available everywhere and that makes it an essential tool.


Similar here: I can use when I have to use it, but I prefer a different editor for "normal" use (stateless, as you continue to explain).

To be honest I find ESC to be even less "accessible" than arrow keys are, [...]


Compare its position on "historical" keyboards. The escape key typically has been located on the left, near the number keys (above the Tab key). This changed when the PC became modern (see transition of XT to AT to MF2 keyboard layout).

[...] and while the arrow keys are supported these days, dropping to command mode is still a frequent requirement.


In vi, yes. Many of its "power user functions" are addressed by that mode, whereas the "usual functions" are to be controlled directly.

I prefer stateless hotkeys because pressing and releasing a modifier has no side effects and I don't have to concentrate on what mode my editor is in (ALT changes focus to menu bar on windows, but CTRL is stateless).


I agree. Let me look back when I did use TP (a WordStar-inspired text processing program used on the SCP and DCP operating systems). Control plus one or two letters was the standard way of accessing program functions. Later on, I discovered the editor "joe" and found that it also uses that interface. Together with a good visual representation, this approach is very powerful and grants access to "power user functions". An example: You mark a block with ^KB (block begin) and ^KK (block end), and you can move the block margins intependently, you can even change the block's content while the selection is active (those things are usually impossible in "modern" mouse-driven editors). ^KC copies, ^KM moves and ^KY deletes the block.

But also the editor of the Midnight Commander ("mcedit") focuses on good keyboard support. It uses the programmable function keys which need some "travel distance" for the hands, but can be quickly accessed without visual confirmation. An example regarding blocks: PF3 marks beginning and end of block, PF5 copies, PF6 moves and PF8 deletes it, such as PF5 copies, PF6 moves and PF8 deletes files in the "parent" application. Note that this editor can be used as a stand-alone program, but is known for its excellent integration with the MC.

However, pasting command sequences into the command mode is something that you cannot easily achieve with editors that use hotkeys to address program functions. How would you copy a sequence of key combinations? You need to manually re-type them.

I do appreciate the technical limitations under which VI evolved, and I will continue to use it on the console simply out of habit.


The initial article educated us about why vi initially used HJKL for cursor control. The ability to still use them can be a benefit in "niche situations", but for today's considerations of use, they have (nearly) no meaning than their historical reasons.

Stateful and stateless editors both have their benefits. Use them together. Use them in peace. :-)

Reply Parent Score: 2

RE[3]: ...
by bouhko on Sat 10th Mar 2012 12:22 in reply to "RE[2]: ..."
bouhko Member since:
2010-06-24

I usually map "Caps Lock" to "Escape" (using xmodmap). Caps Lock is useless anyway (at least for me) and this decrease travelling distances significantly.

Reply Parent Score: 2

RE[3]: ...
by viton on Sat 10th Mar 2012 17:37 in reply to "RE[2]: ..."
viton Member since:
2005-08-09

To be honest I find ESC to be even less "accessible" than arrow keys are

I'm not sure about your keyboard, but I can easily press ESC+F on Apple (and pc laptop) keyboards , but can't reach cursor keys without moving a hand.
Also arrow keys on laptop keyboard are too small to be usable.

Reply Parent Score: 2

RE[3]: ...
by Rugxulo on Sat 10th Mar 2012 18:12 in reply to "RE[2]: ..."
Rugxulo Member since:
2007-10-09


Personally, I have mixed feelings about VI. I do use it all the time simply because it's available everywhere and that makes it an essential tool. But VI's modes often get in the way of what my brain is thinking and I'd much rather use a stateless interface so my poor escape key can get some rest.


IIRC, VIM has an easy mode, something like -E option.


To be honest I find ESC to be even less "accessible" than arrow keys are


You can also use Ctrl-[ as an ESC equivalent.

Reply Parent Score: 2

RE[4]: ...
by Anachronda on Mon 12th Mar 2012 16:27 in reply to "RE[3]: ..."
Anachronda Member since:
2007-04-18

You can also use Ctrl-[ as an ESC equivalent.


Unless you're using a Televideo 950. On that terminal, [ and ] are on the same key. Ctrl-[ will send Ctrl-], regardless of shift.

Not that I'm bitter or anything...

Reply Parent Score: 1