Skip to content

Commit

Permalink
book: Document default and special registers
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed May 6, 2023
1 parent 5d469a2 commit 6742baf
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,30 @@ If a register is selected before invoking a change or delete command, the select
- `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
- `"md` - Store the selection in register `m` and delete it.

### Special registers
### Default registers

Commands that use registers, like yank (`y`), use a default register if none is specified.
These registers are used as defaults:

| Register character | Contains |
| --- | --- |
| `/` | Last search |
| `:` | Last executed command |
| `"` | Last yanked text |
| `_` | Black hole |
| `@` | Last recorded macro |

### Special registers

The system clipboard is not directly supported by a special register. Instead, special commands and keybindings are provided. Refer to the
[key map](keymap.md#space-mode) for more details.
Some registers have special behavior when read from or written to:

The black hole register is a no-op register, meaning that no data will be read or written to it.
| Register character | Contains |
| --- | --- |
| `_` | Nothing: values written to the register are discarded and no values can be read |
| `#` | Index numbers of current selections |
| `.` | Contents of the current selections |
| `%` | Name of the current file |
| `*` | System clipboard |
| `+` | Primary clipboard |

## Surround

Expand Down

0 comments on commit 6742baf

Please sign in to comment.