Minga.Keymap.Defaults (Minga v0.1.0)

Copy Markdown View Source

Doom Emacs-style default leader keybindings for Minga.

All bindings are rooted at the SPC (space) leader key in Normal mode. Group prefix nodes are labelled with +group descriptions so that the which-key popup can display them meaningfully.

Key groups

PrefixGroup
SPC f+file
SPC b+buffer
SPC w+window
SPC s+search
SPC c+code
SPC g+git
SPC o+open
SPC a+ai
SPC t+toggle
SPC p+project
SPC q+quit
SPC h+help
SPC m+filetype

Summary

Functions

Returns all leader bindings as a flat list of {key_sequence, command, description} tuples.

Returns filetype-scoped bindings for the SPC m major mode prefix.

Returns group prefixes for filetype-scoped bindings.

Returns the leader key as a Minga.Keymap.Bindings.key/0 tuple (SPC = {32, 0}).

Returns a trie whose root is the SPC leader key's subtrie.

Returns a map of Normal mode key bindings: {codepoint, modifiers} => {command, description}.

Types

filetype_binding()

@type filetype_binding() ::
  {atom(), [Minga.Keymap.Bindings.key()], atom(), String.t()}

Functions

all_bindings()

@spec all_bindings() :: [{[Minga.Keymap.Bindings.key()], atom(), String.t()}]

Returns all leader bindings as a flat list of {key_sequence, command, description} tuples.

filetype_bindings()

@spec filetype_bindings() :: [filetype_binding()]

Returns filetype-scoped bindings for the SPC m major mode prefix.

Each entry is {filetype, key_sequence, command, description} where key_sequence is relative to the SPC m prefix.

These bindings are grouped by filetype and built into per-filetype tries at startup by Minga.Keymap.Active.

filetype_group_prefixes()

@spec filetype_group_prefixes() :: [{[Minga.Keymap.Bindings.key()], String.t()}]

Returns group prefixes for filetype-scoped bindings.

These add labels to intermediate keys so which-key shows them (e.g., t+test under SPC m).

leader_key()

@spec leader_key() :: Minga.Keymap.Bindings.key()

Returns the leader key as a Minga.Keymap.Bindings.key/0 tuple (SPC = {32, 0}).

leader_trie()

@spec leader_trie() :: Minga.Keymap.Bindings.node_t()

Returns a trie whose root is the SPC leader key's subtrie.

The returned node can be passed directly to Minga.Keymap.Bindings.lookup/2 for subsequent keys in the leader sequence.

normal_bindings()

@spec normal_bindings() :: %{
  required(Minga.Keymap.Bindings.key()) => {atom(), String.t()}
}

Returns a map of Normal mode key bindings: {codepoint, modifiers} => {command, description}.

These are the hardcoded bindings from Minga.Mode.Normal.handle_key/2, maintained as a static data structure for introspection (describe-key).