暫存器
In Helix, registers are storage locations for text and other data, such as the result of a search. Registers can be used to cut, copy, and paste text, similar to the clipboard in other text editors. Usage is similar to Vim, with " being used to select a register.
使用者定義的暫存器
Helix allows you to create your own named registers for storing text, for example:
"ay- Yank the current selection to registera."op- Paste the text in registeroafter the selection.
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:
"hc- Store the selection in registerhand then change it (delete and enter insert mode)."md- Store the selection in registermand delete it.
預設暫存器
Commands that use registers, like yank (y), use a default register if none is specified. These registers are used as defaults:
| 暫存器字元 | Contains |
|---|---|
/ | 最後一次搜尋 |
: | 最後一次執行的命令 |
" | Last yanked text |
@ | 最後一次錄製的巨集 |
特殊暫存器
Some registers have special behavior when read from and written to.
| 暫存器字元 | When read | When written |
|---|---|---|
_ | No values are returned | All values are discarded |
# | Selection indices (first selection is 1, second is 2, etc.) | This register is not writable |
. | Contents of the current selections | This register is not writable |
% | 當前檔案的名稱 | This register is not writable |
+ | 從系統剪貼簿讀出 | Joins and yanks to the system clipboard |
* | 從主要剪貼簿讀出 | Joins and yanks to the primary clipboard |
When yanking multiple selections to the clipboard registers, the selections are joined with newlines. Pasting from these registers will paste multiple selections if the clipboard was last yanked to by the Helix session. Otherwise the clipboard contents are pasted as one selection.