Debian Codegraph @

book/src/registers.md

raw symbols SCIP
1 ## Registers
2
3 - [User-defined registers](#user-defined-registers)
4 - [Default registers](#default-registers)
5 - [Special registers](#special-registers)
6
7 In Helix, registers are storage locations for text and other data, such as the
8 result of a search. Registers can be used to cut, copy, and paste text, similar
9 to the clipboard in other text editors. Usage is similar to Vim, with `"` being
10 used to select a register.
11
12 ### User-defined registers
13
14 Helix allows you to create your own named registers for storing text, for
15 example:
16
17 - `"ay` - Yank the current selection to register `a`.
18 - `"op` - Paste the text in register `o` after the selection.
19
20 If a register is selected before invoking a change or delete command, the selection will be stored in the register and the action will be carried out:
21
22 - `"hc` - Store the selection in register `h` and then change it (delete and enter insert mode).
23 - `"md` - Store the selection in register `m` and delete it.
24
25 ### Default registers
26
27 Commands that use registers, like yank (`y`), use a default register if none is specified.
28 These registers are used as defaults:
29
30 | Register character | Contains |
31 | --- | --- |
32 | `/` | Last search |
33 | `:` | Last executed command |
34 | `"` | Last yanked text |
35 | `@` | Last recorded macro |
36
37 ### Special registers
38
39 Some registers have special behavior when read from and written to.
40
41 | Register character | When read | When written |
42 | --- | --- | --- |
43 | `_` | No values are returned | All values are discarded |
44 | `#` | Selection indices (first selection is `1`, second is `2`, etc.) | This register is not writable |
45 | `.` | Contents of the current selections | This register is not writable |
46 | `%` | Name of the current file | This register is not writable |
47 | `+` | Reads from the system clipboard | Joins and yanks to the system clipboard |
48 | `*` | Reads from the primary clipboard | Joins and yanks to the primary clipboard |
49
50 When yanking multiple selections to the clipboard registers, the selections
51 are joined with newlines. Pasting from these registers will paste multiple
52 selections if the clipboard was last yanked to by the Helix session. Otherwise
53 the clipboard contents are pasted as one selection.
54