X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fmacros.md;h=6b128541b80e1be22540d72aefec4a4eeb478906;hb=f1536a3f547a48a0b244be122937c3329dfd31e0;hp=1418d24ab47f88eea20d7beee333dbef017598b0;hpb=51a86b85f35769533124d209c990aee18965ea6b;p=qmk_firmware.git diff --git a/docs/macros.md b/docs/macros.md index 1418d24ab..6b128541b 100644 --- a/docs/macros.md +++ b/docs/macros.md @@ -1,8 +1,10 @@ -# Macros - Send multiple keystrokes when pressing just one key +# Macros -QMK has a number of ways to define and use macros. These can do anything you want- type common phrases for you, copypasta, repetitive game movements, or even help you code. +Macros allow you to send multiple keystrokes when pressing just one key. QMK has a number of ways to define and use macros. These can do anything you want- type common phrases for you, copypasta, repetitive game movements, or even help you code. +{% hint style='danger' %} **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets ahold of your keyboard will be able to access that information by opening a text editor. +{% endhint %} # Macro Definitions @@ -41,7 +43,7 @@ A macro can include the following commands: ## Sending strings -Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you instead of having to build a `MACRO()`. Right now it assumes a US keymap with a QWERTY layout, so if you are using something else it may not behave as you expect. +Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you instead of having to build a `MACRO()`. For example: @@ -58,6 +60,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { }; ``` +By default, it assumes a US keymap with a QWERTY layout; if you want to change that (e.g. if your OS uses software Colemak), include this somewhere in your keymap: + +``` +#include +``` + ## Mapping a Macro to a key Use the `M()` function within your `KEYMAP()` to call a macro. For example, here is the keymap for a 2-key keyboard: @@ -135,7 +143,7 @@ This will clear all mods currently pressed. This will clear all keys besides the mods currently pressed. -# Advanced Example: Single-key copy/paste (hold to copy, tap to paste) +# Advanced Example: Single-key copy/paste This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released.