aboutsummaryrefslogtreecommitdiff
path: root/readme.md
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-07-29 22:38:06 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-07-29 22:47:35 +0300
commit7d55951050016f2cd9af80c7129bab3200abc810 (patch)
tree04c65c79679a2c4291e8914bd1dcda646493fa6e /readme.md
parent30003d48f9a04676b81bf2980a235106ec7886b0 (diff)
downloadqmk_firmware-7d55951050016f2cd9af80c7129bab3200abc810.tar.gz
qmk_firmware-7d55951050016f2cd9af80c7129bab3200abc810.zip
Fix the quick aliases documentation section
Also move all keyboard customization documentation under the "Going Beyond the keycodes" heading.
Diffstat (limited to 'readme.md')
-rw-r--r--readme.md28
1 files changed, 15 insertions, 13 deletions
diff --git a/readme.md b/readme.md
index f717f8e4c..45af1b0c3 100644
--- a/readme.md
+++ b/readme.md
@@ -229,10 +229,18 @@ For a value of `4` for this imaginary setting. So we `undef` it first, then `def
229 229
230You can then override any settings, rather than having to copy and paste the whole thing. 230You can then override any settings, rather than having to copy and paste the whole thing.
231 231
232## Going beyond the keycodes 232# Going beyond the keycodes
233 233
234Aside from the [basic keycodes](doc/keycode.txt), your keymap can include shortcuts to common operations. 234Aside from the [basic keycodes](doc/keycode.txt), your keymap can include shortcuts to common operations.
235 235
236## Quick aliases to common actions
237
238Your keymap can include shortcuts to common operations (called "function actions" in tmk).
239
240These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk `ACTION_*` functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/doc/keymap.md#2-action).
241
242Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
243
236### Switching and toggling layers 244### Switching and toggling layers
237 245
238`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack. 246`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack.
@@ -310,7 +318,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
310 * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped 318 * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped
311 * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift. 319 * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift.
312 320
313### Space Cadet Shift: The future, built in 321## Space Cadet Shift: The future, built in
314 322
315Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. 323Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
316 324
@@ -335,7 +343,7 @@ COMMAND_ENABLE = no # Commands for debug and configuration
335 343
336This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time. 344This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time.
337 345
338### The Leader key: A new kind of modifier 346## The Leader key: A new kind of modifier
339 347
340If 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. 348If 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.
341 349
@@ -373,7 +381,7 @@ void matrix_scan_user(void) {
373 381
374As 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. 382As 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.
375 383
376### Tap Dance: A single key can do 3, 5, or 100 different things 384## Tap Dance: A single key can do 3, 5, or 100 different things
377 385
378Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. It's one of the nicest community-contributed features in the firmware, conceived and created by [algernon](https://github.com/algernon) in [#451](https://github.com/jackhumbert/qmk_firmware/pull/451). Here's how algernon describes the feature: 386Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. It's one of the nicest community-contributed features in the firmware, conceived and created by [algernon](https://github.com/algernon) in [#451](https://github.com/jackhumbert/qmk_firmware/pull/451). Here's how algernon describes the feature:
379 387
@@ -409,7 +417,7 @@ Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-danc
409 417
410For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros. 418For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.
411 419
412#### Examples 420### Examples
413 421
414Here's a simple example for a single definition: 422Here's a simple example for a single definition:
415 423
@@ -518,11 +526,11 @@ const qk_tap_dance_action_t tap_dance_actions[] = {
518}; 526};
519``` 527```
520 528
521### Temporarily setting the default layer 529## Temporarily setting the default layer
522 530
523`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does. 531`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
524 532
525### Prevent stuck modifiers 533## Prevent stuck modifiers
526 534
527Consider the following scenario: 535Consider the following scenario:
528 536
@@ -543,12 +551,6 @@ This option uses 5 bytes of memory per every 8 keys on the keyboard
543rounded up (5 bits per key). For example on Planck (48 keys) it uses 551rounded up (5 bits per key). For example on Planck (48 keys) it uses
544(48/8)\*5 = 30 bytes. 552(48/8)\*5 = 30 bytes.
545 553
546### Remember: These are just aliases
547
548These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/doc/keymap.md#2-action).
549
550Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
551
552## Macro shortcuts: Send a whole string when pressing just one key 554## Macro shortcuts: Send a whole string when pressing just one key
553 555
554Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c). 556Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c).