# `MingaEditor.MacroRecorder`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/macro_recorder.ex#L1)

Records and replays named keystroke macros.

A pure functional module — no GenServer. The struct is embedded in
`MingaEditor.State` and threaded through the editor's key dispatch.

Macros are stored in named registers (`a`–`z`), separate from text
registers. Each register holds a list of key tuples that can be
replayed through the editor's `handle_key` pipeline.

# `key`

```elixir
@type key() :: {non_neg_integer(), non_neg_integer()}
```

A key event: `{codepoint, modifiers}`.

# `recording`

```elixir
@type recording() :: {String.t(), [key()]} | nil
```

Recording state: `{register_name, accumulated_keys}` or nil.

# `t`

```elixir
@type t() :: %MingaEditor.MacroRecorder{
  last_register: String.t() | nil,
  recording: recording(),
  registers: %{required(String.t()) =&gt; [key()]},
  replaying: boolean()
}
```

# `get_macro`

```elixir
@spec get_macro(t(), String.t()) :: [key()] | nil
```

Returns the stored key sequence for a register, or nil.

# `new`

```elixir
@spec new() :: t()
```

Returns a fresh macro recorder with no recorded macros.

# `record_key`

```elixir
@spec record_key(t(), key()) :: t()
```

Appends a key to the active recording. No-op if not recording.

# `recording?`

```elixir
@spec recording?(t()) :: {true, String.t()} | false
```

Returns `{true, register_name}` if recording, or `false`.

# `replaying?`

```elixir
@spec replaying?(t()) :: boolean()
```

Returns true if currently replaying a macro.

# `start_recording`

```elixir
@spec start_recording(t(), String.t()) :: t()
```

Begins recording into the named register.

# `start_replay`

```elixir
@spec start_replay(t()) :: t()
```

Sets the replaying flag.

# `stop_recording`

```elixir
@spec stop_recording(t()) :: t()
```

Finalizes the current recording, storing the key sequence in the register.

# `stop_replay`

```elixir
@spec stop_replay(t()) :: t()
```

Clears the replaying flag.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
