# Reducing Skip Bigrams Strain

> tldr implementation here:  
> [https://github.com/anantoghosh/My-QMK/blob/ananto-lily58/keyboards/lily58/rev1/keymaps/vial/skip\_bigrams.c](https://github.com/anantoghosh/My-QMK/blob/ananto-lily58/keyboards/lily58/rev1/keymaps/vial/skip_bigrams.c)

If you're an avid typist, particularly if you use a keyboard layout that involves frequent [same-finger bigrams](https://kennetchaz.github.io/symmetric-typing/layouts.html#:~:text=2.%20Same%2Dfinger%20bigrams.) or same-finger skip bigrams (typing keys with the same finger), you're probably familiar with the strain it can put on your fingers. Excessive finger movement can lead to fatigue and potential discomfort over extended typing sessions.

For example, in the [handsdown neu layout](https://sites.google.com/alanreiser.com/handsdown/home/hands-down-neu)

```plaintext
w  f  m  p  v   /  .  q  "  '  z
r  s  n  t  b   ,  a  e  i  h  j
x  c  l  d  g   -  u  o  y  k
```

Looking at the MNL column, typing the letters ML requires quick single finger movement over two row keys (2u).  
Such that typing words like  
**LAMB, MALL, MEAL, MILK, MELLOW, LAME, LIME** require too much movement.

For consecutive keys, such as in the word CALMLY, handsdown neu solves it with [adaptive keys](https://sites.google.com/alanreiser.com/handsdown/home/hands-down-neu?authuser=0#:~:text=Down%20Neu.-,Adaptive%20keys,-.). **But this does not work for skip bigrams, i.e. bigrams separated by other letters.**

To find out which skip bigrams affect you, test your layout in [https://cyanophage.github.io/](https://cyanophage.github.io/).

For example, the main skip bigrams that affect [colemak-dh](https://colemakmods.github.io/mod-dh/) are

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1712160159395/a1552394-89b6-4eb1-acb1-48541a28061c.png align="center")

## Implementing a solution

Let's say you have a keyboard layout with a column like this:

```plaintext
M
N
L
```

If you need to type **ML MAL MEAL LAME** etc., your finger would typically need to move the distance of two rows quickly. With this feature, you can define (M, L) as a **skip\_bigram\_pair** and a **BIGRAM\_KEY** which on press types the other bigram letter. For example, typing:

* `M > BIGRAM_KEY` will type "ML"
    
* `M > A > BIGRAM_KEY` will type "MAL"
    
* `M > E > A > BIGRAM_KEY` will type "MEAL"
    
* `M > A > BIGRAM_KEY > BIGRAM_KEY` will type "MALL"
    

> While this feature also works for regular bigrams, using [adaptive keys](https://sites.google.com/alanreiser.com/handsdown/home/hands-down-neu?authuser=0#:~:text=Down%20Neu.-,Adaptive%20keys,-.) may be a better solution for it.

### How Does It Work?

The Skip Bigrams feature works by defining a **BIGRAM\_KEY** that will type the separated letter when pressed after the first letter of a defined bigram pair. Here's how it works:

1. Define an array of **skip\_bigram\_pairs** in your keymap file.
    
2. Define a **BIGRAM\_KEY** keycode, which you can place in a less-used position on your keyboard layout.
    
3. When you type the first key of a defined bigram pair, the bigram mode is activated.
    
4. In bigram mode, any vowels (a, e, i, o, u, y) or other specified "ignore letters" can be typed without affecting the bigram mode.
    
5. When you press the **BIGRAM\_KEY**, it will type the second letter of the current bigram pair, effectively skipping the need to move your finger to that key.
    

### Customization

This implementation allows you to tailor the Skip Bigrams feature to your specific keyboard layout and typing habits.

* You can define any pair of keys as **skip\_bigram\_pairs**. It may not be in the same column.
    
* You can additionally use it decrease Lateral finger stretch or even regular same finger bigrams.
    
* By default, it only skips over vowels + y, but it can be changed to ignore all home row keys as well, such that in the MNL stack you can type `M > O > N > BIGRAM_KEY` to type MONL, for e.g.. in the word **commonly**.
    

### How to use

1. Simply copy the code from the provided source file (`` skip_bigrams.c, `skip_bigrams.h` ``) into your folder
    
    1. [skip\_bigrams.c](https://github.com/anantoghosh/My-QMK/blob/ananto-lily58/keyboards/lily58/rev1/keymaps/vial/skip_bigrams.c)
        
    2. [skip\_bigrams.h](https://github.com/anantoghosh/My-QMK/blob/ananto-lily58/keyboards/lily58/rev1/keymaps/vial/skip_bigrams.h)
        
2. In the `skip_bigrams.c` file, define your desired *skip\_bigram\_pairs* and *BIGRAM\_KEY* (default KC\_F17), and update your layout to contain the *BIGRAM\_KEY*
    
3. Update your `rules.mk` to include
    
    1. ```plaintext
         SRC += skip_bigrams.c
        ```
        
4. Hook it up in your `process_record_user` function in `keymap.c`
    
    1. ```c
         #include "skip_bigrams.h"
         
         bool process_record_user(uint16_t keycode, keyrecord_t *record) {
             if(!process_skip_bigrams(keycode, record)) {
                 return false;
             }
         }
        ```
        

Happy typing!
