QMK Firmware
Step 1: Declare
Create each layer as an entry in an enum. Replace YOUR_LAYER_1, YOUR_LAYER_2, etc., below, with names of your layers.
// Layer Declarations
+QMK Firmware Cheatsheet 0.3 QMK Firmware
Step 1: Declare
Create each layer as an entry in an enum. Replace YOUR_LAYER_1, YOUR_LAYER_2, etc., below, with names of your layers.
// Layer Declarations
enum {
YOUR_LAYER_1 = 0,
YOUR_LAYER_2,
@@ -16,7 +16,7 @@
// ..., the rest of your layers
-};
Step 3: Use
Here are a variety of ways to change the layer.
Keycode Description MO(YOUR_LAYER)
While held, MOmentarily switch to YOUR_LAYER. LT(YOUR_LAYER, KC_XXXX)
Layer Tap. When held: go to YOUR_LAYER.
When tapped: send KC_XXXX TG(YOUR_LAYER)
Layer Toggle. When tapped, toggles YOUR_LAYER on or off TO(YOUR_LAYER)
When tapped, goes to YOUR_LAYER TT(YOUR_LAYER)
When tapped, toggles YOUR_LAYER on or off.
When held, activates YOUR_LAYER. OSL(YOUR_LAYER)
One-Shot Layer. Sends key on YOUR_LAYER
Light LEDs according to layer
Create a function called matrix_scan_user, and add a case for each layer. Note, you will have to look up which function your keyboard calls to turn LEDs on/off, and insert them to the code, below.
// Runs constantly in the background, in a loop.
+};
Step 3: Use
Here are a variety of ways to change the layer.
Keycode Description MO(YOUR_LAYER)
While held, MOmentarily switch to YOUR_LAYER. LT(YOUR_LAYER, KC_XXXX)
Layer Tap. When held: go to YOUR_LAYER.
When tapped: send KC_XXXX TG(YOUR_LAYER)
Layer Toggle. When tapped, toggles YOUR_LAYER on or off TO(YOUR_LAYER)
When tapped, goes to YOUR_LAYER TT(YOUR_LAYER)
When tapped, toggles YOUR_LAYER on or off.
When held, activates YOUR_LAYER. OSL(YOUR_LAYER)
One-Shot Layer. Goes to YOUR_LAYER for the next keypress
Light LEDs according to layer
Create a function called matrix_scan_user, and add a case for each layer. Note, you will have to look up which function your keyboard calls to turn LEDs on/off, and insert them to the code, below.
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
@@ -63,7 +63,7 @@
//
}
return MACRO_NONE;
-};
Step 3: Use
M(YOUR_MACRO_1)
Record and play keystrokes
Step 1: Setup
enum planck_keycodes {
+};
Step 3: Use
M(YOUR_MACRO_1)
Record and play back sequences of keystrokes. Note: macros are not kept in memory after the keyboard is unplugged.
Step 1: Setup
enum planck_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
@@ -81,7 +81,14 @@
}
#include "dynamic_macro.h"`
-
Step 2: Use
Keycode Description DYN_REC_START1
start recording the macro 1 DYN_REC_START2
start recording the macro 2 DYN_MACRO_PLAY1
replay the macro 1 DYN_MACRO_PLAY2
replay the macro 2 DYN_REC_STOP
finish the macro that is currently being recorded.
Send different key codes depending on how many times key is tapped. Tap key once does one thing, tap twice does another thing, etc.
Step 1: Setup
TAP_DANCE_ENABLE = yes
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (!process_record_dynamic_macro(keycode, record)) {
+ return false;
+ }
+ return true;
+}
+
+
Step 2: Use
Keycode Description DYN_REC_START1
Start recording Macro 1 DYN_REC_START2
Start recording Macro 2 DYN_REC_STOP
Stop recording current Macro DYN_MACRO_PLAY1
Replay Macro 1 DYN_MACRO_PLAY2
Replay Macro 2
Send different key codes depending on how many times key is tapped. Tap key once does one thing, tap twice does another thing, etc.
Step 1: Setup
TAP_DANCE_ENABLE = yes
#define TAPPING_TERM 200
Step 2: Declare
Create an entry for each tap dance in an enum. Replace YOUR_TAPDANCE_1, YOUR_TAPDANCE_2, etc., with the names of your tap dances.
// Tap Dance Declarations
enum {
@@ -103,5 +110,35 @@
#define MOUSEKEY_TIME_TO_MAX 20
#define MOUSEKEY_WHEEL_MAX_SPEED 8
#define MOUSEKEY_WHEEL_MAX_TIME_TO_MAX 40
-
Step 2: Use
Keycode Description KC_MS_UP
Mouse Cursor Up KC_MS_DOWN
Mouse Cursor Down KC_MS_LEFT
Mouse Cursor Left KC_MS_RIGHT
Mouse Cursor Right KC_MS_BTN1
Mouse Button 1 KC_MS_BTN2
Mouse Button 2 KC_MS_BTN3
Mouse Button 3 KC_MS_BTN4
Mouse Button 4 KC_MS_BTN5
Mouse Button 5 KC_MS_WH_UP
Mouse Wheel Up KC_MS_WH_DOWN
Mouse Wheel Down KC_MS_WH_LEFT
Mouse Wheel Left KC_MS_WH_RIGHT
Mouse Wheel Right KC_MS_ACCEL0
Set Mouse Acceleration Speed to 0 KC_MS_ACCEL1
Set Mouse Acceleration Speed to 1 KC_MS_ACCEL2
Set Mouse Acceleration Speed to 2
Coming soon
Step 2: Use
Keycode | Description |
| Mouse Cursor Up |
| Mouse Cursor Down |
| Mouse Cursor Left |
| Mouse Cursor Right |
| Mouse Button 1 |
| Mouse Button 2 |
| Mouse Button 3 |
| Mouse Button 4 |
| Mouse Button 5 |
| Mouse Wheel Up |
| Mouse Wheel Down |
| Mouse Wheel Left |
| Mouse Wheel Right |
| Set Mouse Acceleration Speed to 0 |
| Set Mouse Acceleration Speed to 1 |
| Set Mouse Acceleration Speed to 2 |
Set up your keyboard to input Unicode, working through additional, required software.
NOTE: The instructions here only apply for characters up to 0xFFFF. For higher characters, please consult the official docs.
Prerequisites: Configure OS and Software
Windows
Install WinCompose.
MacOS
In System Preferences -> Keyboard -> Input Sources ->, add a new layout. In the Others menu, select Unicode Hex Input. Note: Enable Unicode Hex Input each time you want to input Unicode. Check the box for "Show Input menu in menu bar" to switch to this quickly.
Linux
Add the Unicode input method for your distro. Note: Enable Unicode Hex Input each time you want to input Unicode. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
Step 1: Setup
UNICODE_ENABLE = yes
+
void matrix_init_user(void) {
+ set_unicode_input_mode(UC_XXXX); // REPLACE UC_XXXX with the Unicode Input Mode for your OS. See table below.
+};
+
Unicode Input Mode | Description |
| Windows using WinCompose. |
| MacOS using Unicode Hex Input. Can also send `UC_OSX_RALT` to use the Right Alt key. |
| Linux using Unicode input method. |
Step 2: Define
#define STAR 0x2605 // ★
+// ...,repeat for all characters
+
Step 3: Use
UC(STAR)
+
Press a sequence of keys to trigger functionality, in the style of Vim.
Step 1: Setup
LEADER_EXTERNS();
+
Step 2: Define
void matrix_scan_user(void) {
+ LEADER_DICTIONARY() {
+ leading = false;
+ leader_end();
+
+ // for single key sequences
+ SEQ_ONE_KEY(KC_XXXX) {
+ // INSERT CODE HERE: anything you can do in a macro https://docs.qmk.fm/macros.html
+ }
+
+ // for two-key sequences
+ SEQ_TWO_KEYS(KC_XXXX, KC_YYYY) {
+ // INSERT CODE HERE: anything you can do in a macro https://docs.qmk.fm/macros.html
+ }
+
+ // for three-key sequences
+ SEQ_THREE_KEYS(KC_XXXX, KC_YYYY, KC_ZZZZ) {
+ // INSERT CODE HERE: anything you can do in a macro https://docs.qmk.fm/macros.html
+ }
+
+ // ..., the rest of your Leader Key definitions.
+ }
+}
Step 3: Use
Tap the `KC_LEAD` followed by the sequence of keys, to access your functionality.
KC_LEAD