# Registers and macros This post brings information from a few places to provide a rundown of registers and macros in Vim. ## Registers - `"r` means register `r` - `"ryy` copies current line to `r` - `"Ryy` appends current line to `r` - `"rp` pastes `r` - `:reg` shows current registers There are a few special registers - `""` unnamed register, yank/delete target, default for paste without register specified - `"0` stores last yank (so `"0p` pastes last yank regardless of deletes) - `"1` to `"9` store history of deleted, the higher the older - `".` is the last inserted text, read-only - `"%` is the current file path, read-only - `":` is last command, read-only - `"+` is the primary clipboard - `"*` is the secondary clipboard - `"/` is last search (from any of `/`, `?`, `*`, `#`) Registers are persisted in the ShaDa file. We can ignore it by starting Neovim with `nvim -i NONE`. ## Macros Macros are recordings of keystrokes that we can replay. We can record a macro by pressing `q` in normal mode and specifying one letter to refer to our macro. For example, `qm` starts recording macro `m`. We can stop recording a macro by pressing `q` again. Now, we can run this macro by pressing `@m`. Why am I talking about macros? Macros are stored in Vim registers. Our macro is stored as text in register `"m`, We can `"mp` to paste. Edit it. Load back with `"myy"`. ## Moodboard -
-
-