---
title: Vim-style modes
description: Model insert, normal, and visual modes with a variable, and gate bindings on it.
---

A mode that outlives a single layer, like Vim's insert, normal, and visual, is a
[variable](/docs/authoring/variables) with a fixed set of values.

## In karabiner.ts

```ts index.ts
rule('to vim modes', vimMode.off).manipulators([
  mapSimultaneous(['a', ';']).to(vimMode.changeTo('normal')),
  mapSimultaneous(['v', ';']).to(vimMode.changeTo('visual')),
])
```

## In Vimputer

1. **Create the variable**

    On the Variables page, add an Enum named Vim with the values `insert`,
    `normal`, and `visual`, defaulting to `insert`.

2. **Set it**

    Bind **Switch mode** → Vim → **Set to** `normal`. In this config,
    <kbd>n</kbd> in the Leader mode does that.

3. **Read it**

    Give a group the **Active when** condition State: Vim is `normal`. Its
    bindings only fire in normal mode.

The Variables page lists each variable's values and the bindings that set it:

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

**Toggle** flips a Boolean, or an Enum with two values. Cycling through three or
more values isn't built yet.
