Skip to content
cajhin edited this page Jan 17, 2021 · 10 revisions

Deep Water Starts Here

Defining Combos is the heart of Capsicain, powerful, flexible, and a bit complex.

Below, I will describe how my own 'King configuration' works. I've been using and refining this configuration for 15 years; I wrote Capsicain with it; I'm writing this paragraph with it. I would recommend it wholeheartedly for touchtypists and programmers.

Let's do an awesome thing: map CapsLock + I J K L to the cursor keys.

Step 1: understand modifier strings

There is no way around this if you want to define combos.

If you don't understand what [&.] and [& .... ....] means,
read Modifier Strings

Step 2: define a virtual modifier

Turn CapsLock into the virtual modifier MOD9

REWIRE Caps MOD9

My other virtual modifiers are

TAB     MOD10
LWIN    MOD11
LALT    MOD12
RALT    MOD12

Notes

  • rewiring keys to MODx removes a bunch of complications. Windows never sees the MODs, and there can be no conflicts with existing shortcuts that Windows defines.
  • If you don't rewire LWIN, tapping LWIN will open the start menu.
  • Don't rewire Shift and Control. Those are used for a lot of standard Windows combos, and you don't want to deal with all of them.
  • The CapsLock key is in an excellent position on the home row, this is a great modifier for touch typists.

Step 3: Restore your lost keys

After REWIRE Caps MOD9 you no longer have a CapsLock key. I don't use it often, but I need it.
-> define combos that restore the lost functionality

This will turn CapsLock ON with 'LShift + RShift', and turn it OFF with 'RShift + LShift' :

COMBO  LSHF   [.... ...& ....] > key(CAPSOFF)  #[RSHIFT] + [LSHIFT] = ShiftLock OFF.
COMBO  RSHF   [.... .... ...&] > key(CAPSON)   #[LSHIFT] + [RSHIFT] = ShiftLock ON.

Restore my other keys

TAB

holding TAB makes it MOD10, tapping TAB creates a "Tab". (This works really well in real life. This puts a Number Pad under my right hand, and does various special keys and shortcuts with the left hand).

REWIRE TAB MOD10 TAB

See Keyword: Rewire for details how to set up tapping.

LWIN

holding LWIN makes it MOD11, tapping once then holding LWIN makes it LWIN. (rather new in my config, but works well so far. I use Win combos to start applications).

REWIRE LWIN MOD11 // LWIN

ALT

Holding any ALT makes it MOD12, tapping then holding makes it LALT/RALT.

REWIRE     LALT    MOD12  //  LALT
REWIRE     RALT    MOD12  //  RALT

This works well for me because I don't use the real Alt much. The Alt keys are in a great location if you have an Apple keyboard or similar, where LAlt is under the C/X keys. (I love the Filco Minila Air for its extra Fn keys, bought two of them and retired the Apple boards).

I use Alt combos to create all special keys !@#$ (){}[]<> `~|_.

Step 4: Define MOD9 combos

This will give you the cursor keys without moving the right hand. Pressing CapsLock is so much faster than moving your right hand to the cursor keys and back to the homerow. We're not even talking about laptops. If I could have only one config, I would choose the cursor keys.

COMBO  J   [^^^& .... ....] > key(LEFT)
COMBO  L   [^^^& .... ....] > key(RIGHT)
COMBO  I   [^^^& .... ....] > key(UP)
COMBO  K   [^^^& .... ....] > key(DOWN)

Notes

  • With ^^^& I explicitly define that this matches only when the CapsLock key is the only virtual modifier. This lets me define additional combos like MOD9+MOD10+J
  • The 8 real modifiers are undefined, so the combo matches regardless of the state of Shift/Control/Win/Alt. Therefore, Shift+MOD9+J will result in Shift+Left. This is important, because Shift-Cursor selects. Win-Cursor is nice, too. (learned just now: Alt+left/right is FireFox page back / forward)

Step 5: Learn the new combos

Now that Caps+IJKL is cursor up/left/down/right, you must learn to use it.

Do not underestimate this step. It takes a hundred times until your fingers learn to do it automatically, and only then will a config really improve your skills.

It is easy to come up with ideas for 100 funky combos, but they will be useless until you have learned them. My approach was to start with a rather small set of combos (maybe 10), and expand as I learn them.

Warning: learning new combos, then changing them and re-learn the new combos, is a pain in the finger. Think twice before you define your own setup.

I can recommend my own 'CapsLock' layer for cursor control, this one has been battle tested daily for many years.
It defines all other cursor keys like home/end/pageUp/backspace/delete.
It also defines A/S/D/F/G = Undo/Cut/Copy/Paste/Redo (very nice to have).

The result is that I can do complex text edits with lots of moving around, marking, cutting, pasting - and all I do is keep CapsLock pressed, while my hands never move and the fingers go TaTaTaTaTa doing 5 edit operations per second.

Truth be told, I've never seen anyone write or edit C/Java code or config files as fast as I do. Not even close. (I'm sure there are some Emacs wizards out there, though).

More COMBO Power

The Keyword: Combo is a powerful one. It is the only one that can trigger functions(). See the Reference section for which functions exist and what they do.

COMBO Order

COMBOs are evaluated in the order they appear in the ini. The first matching rule wins.

This is a bad config, because both Control+[1] and Shift+Control+[1] will produce F1:

COMBO 1 [&.]  > key (F1)
COMBO 1 [&&]  > key (F11)

Two ways to fix it:

  1. put the more specific combo first. This can be difficult to maintain with big configs.
COMBO 1 [&&]  > key (F11)
COMBO 1 [&.]  > key (F1)
  1. explicitly define "when Control is down, and Shift is NOT down"
COMBO 1 [&^]  > key (F1)
COMBO 1 [&&]  > key (F11)

Release real modifiers

When you define a combo with a real modifier like "Control + J = Left", you have a problem with the Control key.

  1. you define COMBO J [&.] > key (Left)
  2. you press Control. There is no rule for that, so Capsicain sends Control-Down to Windows
  3. you press J. Your Combo matches. Capsicain sends "Left" to Windows
  4. Windows sees "Control down, Left" and jumps one word to the left (if you're in a text editor).

Workarounds:

  • Use a combo with a virtual modifier instead
  • instead of key(), use Function: moddedKey(). This function will send "Control Up", then any modifiers you define, then the key, then "Control Down" to restore the correct state in Windows.
Clone this wiki locally