Arrow Keys Layout Efficiency: vi's {H J K L} vs Inverted T {I J K L}

,

vi/vim use {h j k l} keys to move cursor. Another approach is Inverted T {i j k l}. This page investigates which is more efficient.

terminal ADM-3A keyboard
terminal ADM-3A keyboard, where Bill Joy used to create vi. Note the arrows on {h j k l}. 〔➤ History of Emacs & vi Keys (Keyboard Influence on Keybinding Design)

Let's assign score to key positions with respect to ease of key press. Let's set k to have the max score of 1. We'd have something like this:

                  i
                 0.8
      h     j     k     l
     0.5   0.9    1    0.7

now look at these command's frequency.

Arrow Keys Frequency
keycommand%
previous-line15.48
next-line17.10
backward-char3.23
forward-char5.51

〔➤ Emacs's Command Frequency Statistics

Multiply the percentage with the score. Let's use a Python script to calculate.

# -*- coding: utf-8 -*-
# python

# is vi's {h j k l} keys more efficient or inverted T {i j k l}

key_score = {
    "i":0.8,
    "j":0.9,
    "k":1,
    "l":0.7,
    "h":0.5,
}

command_frequency = {
    "up":15.48,
    "down":17.1,
    "left":3.23,
    "right":5.51,
}

vi_key_map = {
    "h":"left",
    "j":"down",
    "k":"up",
    "l":"right",
}

inverted_T_map = {
    "i":"up",
    "j":"left",
    "k":"down",
    "l":"right"}

vi_score =sum(map(lambda x: (key_score[x[0]] * command_frequency[x[1]]) , vi_key_map.iteritems()))

invertedT_score =sum(map(lambda x: (key_score[x[0]] * command_frequency[x[1]]) , inverted_T_map.iteritems()))

print("vi score", vi_score)                # 36.342
print("inverted T score", invertedT_score) # 36.248

so, this means, they are about the same degree of efficiency.

Try to adjust the key score or command frequency. Overall, score comes out about the same.

This test only considers ease of each key press. For just these 4 keys, this simple measure can be considered a reasonable test of efficiency. But note that a robust test should also consider digraph frequency and other factors. 〔➤ What's the Most Efficient Keyboard Layout? Dvorak vs Colemak?

vi has h move away, while inverted T has the i moved away. Which one is better? (in other words: when moving cursors, how often does digraph involving happen, and how often does it happen with ?)

Another factor is intuitiveness. The inverted T is more intuitive. vi's row arrows require learning. That's one big win for inverted T.

Conclusion

The vi's {h j k l} and inverted T {i j k l} have about the same efficiency.

One may be slightly better than the other, depending how one assigns the score for the keys and the frequency of cursor movement commands.

blog comments powered by Disqus