---
title: Variables
description: Named values that bindings set and conditions read, such as a Vim mode.
---

A variable is a named Karabiner variable with a fixed type. Bindings set it, and
conditions read it, so one key can change what other keys do without entering a
layer. Vim's insert, normal, and visual modes are the classic case.

![The Variables page: a Vim variable with insert, normal, and visual values, set by N](/blume-assets/content/assets/screenshots/variables.png)

## Types

**New variable** on the Variables page offers:

| Type | Holds |
| --- | --- |
| Enum | One of a list of named values, such as `insert`, `normal`, `visual` |
| Boolean | On or off |
| Number | A number, such as a counter |
| String | Text |
| Custom | A raw Karabiner variable you name yourself |

A variable is stored in Karabiner as `vimputer.state.<id>`. The page shows each
variable's values and default, the bindings that set it, and the bindings and layers
it gates.

## Setting and reading

- To set one, bind **Switch mode** (under Layers & modes in the action picker):
  **Set to** a value, **Toggle** a boolean or two-value enum, or **Unset**.
- To read one, add a **State** condition to a binding's **Only when**, or to a
  layer's **Active when**.

Modal layers don't use variables. They share one register, `vimputer.layer`, which
the page lists separately. For variables that aren't Vimputer's, use **Set
variable** and the **Variable** condition under Advanced.
