Skip to content
Vimputer
Esc
↑↓navigate↵open⌘Jpreview
On this page

Vim-style modes

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 with a fixed set of values.

In karabiner.ts

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

In Vimputer

Create the variable

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

Set it

Bind Switch mode → Vim → Set to normal. In this config, n in the Leader mode does that.

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

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