From 76ee97e1b6c80b2acab4006f04c30695078650dd Mon Sep 17 00:00:00 2001 From: Genteure Date: Thu, 21 Nov 2024 01:58:05 +0800 Subject: docs: Move defines to the end in layer behaviors (#2639) --- docs/docs/keymaps/behaviors/layers.md | 49 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/docs/docs/keymaps/behaviors/layers.md b/docs/docs/keymaps/behaviors/layers.md index 0dbb0057e0..4a944dfbe4 100644 --- a/docs/docs/keymaps/behaviors/layers.md +++ b/docs/docs/keymaps/behaviors/layers.md @@ -6,27 +6,14 @@ sidebar_label: Layers ## Summary Often, you may want a certain key position to alter which layers are enabled, change the default layer, etc. -Some of those behaviors are still in the works; the ones that are working now are documented here. +Below are the list of behaviors that can be used to activate and deactivate layers. :::note -Multiple layers can be active at the same time and activating a layer will not deactivate layers higher up in the "layer stack". See [Layers](../index.mdx#layers) for more information. -::: - -## Defines to Refer to Layers +Multiple layers can be active at the same time and activating a layer will not deactivate layers higher up in the "layer stack". -When working with layers, you may have several different key positions with bindings that enable/disable those layers. -To make it easier to refer to those layers in your key bindings, and to change which layers are where later, you can -add a set of `#define`s at the top of your keymap file, and use those layer in your keymap. - -For example, if you have three layers, you can add the following to the top of your keymap: - -```dts -#define DEFAULT 0 -#define LOWER 1 -#define RAISE 2 -``` - -This allows you to use those defines, e.g. `LOWER` later in your keymap. +Layer numbers start at 0 following the order they are defined in the keymap node, for example `&mo 3` would activate the 4th layer node defined in the keymap. +See [Layers](../index.mdx#layers) for more information. +::: ## Momentary Layer @@ -42,7 +29,7 @@ again. Example: ```dts -&mo LOWER +&mo 3 ``` ## Layer-Tap @@ -58,7 +45,7 @@ The "layer-tap" behavior enables a layer when a key is held, and outputs a [keyp Example: ```dts -< LOWER SPACE +< 3 SPACE ``` ### Configuration @@ -113,10 +100,30 @@ The "toggle layer" behavior enables a layer if it is currently disabled, or disa Example: ```dts -&tog LOWER +&tog 3 ``` ## Conditional Layers The "conditional layers" feature enables a particular layer when all layers in a specified set are active. For more information, see [conditional layers](../conditional-layers.md). + +## Defines to Refer to Layers + +When working with layers, you may have several different key positions with bindings that enable/disable those layers. +To make it easier to refer to those layers in your key bindings, and to change which layers are where later, you can +add a set of `#define`s at the top of your keymap file, and use those defines in your keymap. + +For example, if you have three layers, you can add the following to the top of your keymap: + +```dts +#define DEFAULT 0 +#define LOWER 1 +#define RAISE 2 +``` + +This allows you to use those defines, e.g. `LOWER` later in your keymap. + +```dts +&mo LOWER // equivalent to &mo 1 +``` -- cgit v1.2.3