Modified Colemak for Programming

Petrus Theron picture Petrus Theron · Feb 20, 2013 · Viewed 7.2k times · Source

Does there exist a modified Colemak keyboard layout designed specifically for programming?

I went cold-turkey on the Colemak keyboard layout a few days ago and I really like it for normal typing, but I have some issues for frequent programming characters like the ; (semicolon) key. A modified layout that has direct mappings for braces and parentheses would be nice.

Obviously I could remap these keys myself via trial-and-error, but I'm hoping someone has done some testing to determine an optimal layout for common language characters.

Answer

Anon picture Anon · Apr 29, 2017

Background

I am obsessed with efficient workflows, and the results from my experiments are very compelling and I guarantee it is very much worth the endeavour. This is also my third major edit, and I have more or less settled upon the layout I use today.

I will be try to be brief and to the point.


Current Layout:

Highlight: Finger rest

  • Your fingers rest on the highlight

  • Wide Angle Mod: Right hand has shifted one column. Benefits:

    • Less stress on right wrist
    • Layout is now symmetrical
    • Shift R + Level5 is easier to reach.
  • 8 layer layout requires 3 modifiers:

    1. Shift
    2. Level3 usually known as Altgr
    3. Level5
    include "level3(lalt_switch)" // Left Alt
    include "level5(ralt_switch)" // Right Alt
  • level5 is very obscure and extremely useful to know about, if you wish to expand. For example, on my layout, it would allow for around 200 extra characters to be added.

How 8 Layers works

Layer:

  1. No modifiers
  2. Shift
  3. Level3
  4. Level3 + Shift
  5. Level5
  6. Level5 + Shift
  7. Level5 + Level3
  8. Level5 + Level3 + Shift

Numbers

Highlight: How you input numbers

  • Accessed solely on Layer3
  • A programmer who uses numbers often, is a bad programmer. See: https://en.wikipedia.org/wiki/Magic_number_%28programming%29
  • This was why it was taken off of Level1 ( No Modifiers )
  • For convenience, it is arranged in a number pad.
  • 1230, constitute the most common numbers, and hence are found on the home row.
  • The right hand number pad has close access to -+.,#%$*/\;:=, the most relevant mathematical operators.
  • I search for keys about 10× less compared to a standard 1234567890 layout. I find this much easier and more intuitive to use.

Alternative Characters ( Requires Modifier )

Highlight: Level Characters

The least common alternative characters were delegated to Level3 and Level5 modifiers. They were mapped with the following reasoning:

  • @ resembles Q
  • & resembles B
  • $ resembles Z
  • × resembles X
  • ~ resembles W
  • ` is on C, "aCute"
  • | is on V, "Vertical pipe"
  • % is on M, "Modulus"
  • # is on H, "Hash"
  • < and > Easy Access for writing html etc.
  • ^ is next to < and >
  • + and - is next to the Numbers, with - easiest to access

Alternative Characters ( No Modifier required )

Highlight: Non-Modifiable Keys

Generally the most common programming characters that you will type exist here:

  • ? ! in the corner, because they typically close off sentences. Colemak was designed that letters that end sentences are more common on index and middle fingers, and placing it here on the pinky improves hand movement. ! also remains on its original position.
  • [ and ] are easy access, because Regular Expressions tend to use them a lot. They mirror ) (.
  • ) ( are reversed because it is easier to roll the fingers from the pinky to the index finger. The following trigram is also very common: (); and works best in this orientation.
  • " is on an easy access area, and mirrors '.
  • ' is on the opposite hand as s which is important for the 's bigram.
  • { } are usually automatically handled by editors, so they are placed in the hardest to reach region.
  • * and / are for the /* bigram and are common vim commands.
  • \ is on the right hand at the far corner, to resemble Escape and to work best with the following bigrams, \t \n \r
  • ; : = are all similar, and resemble Return. Again, because they exist near the corners, and they typically end sentences, they work best on the Pinky and Ring Fingers.
  • Prior Next aka Page Up Page Down are directional keys in the middle. This is exceptionally useful on Thinkpad Keyboards, as they are right next to the Trackpoint. Even without the trackpoint, it is nice when it comes to just scrolling through documents. The reason why they are not the same as Page Up Page Down is to grant more flexibility for run configurations.
  • _ the underscore here works well for writing object names, and works well with the m_ and s_ bigrams. It also is not a letter because that makes shifting it a painful exercise.

Directional Keys

Highlight: Moving Up Down Left Right

  • Inspired by Vim
  • Without the "Wide Angle Mod", the thumb will cramp up reaching for Level5
  • Amazing for editting regular documents.

Letters

Shift + [A-Z]

Highlight: Alphabet

  • Capslock and Enter Removed and replaced by Shift
  • Shift's are replaced by Control
  • Shift's are 3× more comfortable
  • Control's are 5× more comfortable
  • Capslock was not missed. Prefer it as Shift over Backspace or Escape provided that I have access to those keys on Level3 or Level5

Return

Highlight: How one Returns

  • Placed on the o because in vim, its functionality is similar to Enter.
  • Sometimes can cause issues with Games which will not detect it.
  • Surprisingly, not a big issue. I would consider it maybe 1.3× more difficult to use compared to its original position, which is great tradeoff to be able to get Shift on the home row.

Functional Keys

Highlight: Functional Keys

  • Accessible by either modifier.

  • Backspace is on the left pinky, to be intuitive with the direction you are deleting.

  • Delete is on D, and is intuitive with the direction you are deleting.

  • Escape for some reason, feels best on the Ring Finger, rather than the pinky.

  • End and Home are inspired by a colemak Vim configuration:

    • InSert, which will go to the beginning of the line before editting.
    • Append being on the T, which goes the opposite direction.
  • Backspace is used 10× more ( Meaning that I will use the Home Row position 10× more, rather than its default position. ).

  • Delete is used about 20× more.

  • Escape is used about 15× more.

  • Home and End is used about 200× more often and utilized far more often, being especially useful in editting documents outside a vim environment.


Todo:

If you are up for the challenge, there are some useful ideas I have played around with, however was not able to formally add to the layout simply due to the difficulty of doing so.

In short, you could theoretically map characters or functions to the modifier keys, that only execute upon a key release. For example,

  1. Press Shift and no other keys
  2. If you release it within 1 second, Its alternative key would execute.

And that's that.


Lazy Installation:

  1. Go here: https://paste.ubuntu.com/p/TbJJkm2vxM/
  2. sudo vim /usr/share/X11/xkb/symbols/us
  3. Replace the contents
  4. WARNING: This will replace your default Colemak.

Configuration Files