-# The Leader key: A new kind of modifier
+# The Leader Key: A New Kind of Modifier
If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen.
leader_end();
SEQ_ONE_KEY(KC_F) {
- register_code(KC_S);
- unregister_code(KC_S);
+ // Anything you can do in a macro.
+ SEND_STRING("QMK is awesome.");
}
- SEQ_TWO_KEYS(KC_A, KC_S) {
- register_code(KC_H);
- unregister_code(KC_H);
+ SEQ_TWO_KEYS(KC_D, KC_D) {
+ SEND_STRING(SS_LCTRL("a")SS_LCTRL("c"));
}
- SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
+ SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
+ SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
+ }
+ SEQ_TWO_KEYS(KC_A, KC_S) {
register_code(KC_LGUI);
register_code(KC_S);
unregister_code(KC_S);
}
```
-As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
\ No newline at end of file
+As you can see, you have a few function. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_KEYS` for longer sequences.
+
+Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.