kakoune/doc/pages/registers.asciidoc

79 lines
2.1 KiB
Plaintext

= Registers
== Description
Registers are named lists of text -instead of simply text- in order to interact
well with multiselection. They are used for various purposes, like storing
the last yanked text, or the captured groups associated with the selections.
== Interacting
*<c-r><c>*::
when in insert mode or in a prompt, insert the value stored in the
*c* register (single character)
*"<c>*::
in normal mode, select the *<c>* register (single character)
== Alternate names
Non alphanumeric registers have an alternative name that can be used
in contexts where only alphanumeric identifiers are possible.
== Default registers
All normal-mode commands using a register default to a specific one if not specified:
*"* (dquote)::
default delete / copy / paste / replace register, used by:
*c*, *d*, *y*, *p*, *<a-p>*, *<P>*, *<a-P>*, *R* and *<a-R>*
*/* (slash)::
default search / regex register, used by:
*/*, *<a-/>*, *?*, *<a-?>*, *n*, *<a-n>*, *N*, *<a-N>*, ***, *<a-*>*,
*s*, *S*, *<a-k>* and *<a-K>*
*@* (arobase)::
default macro register, used by:
*q* and *Q*
*^* (caret)::
default mark register, used by:
*z*, *<a-z>*, *Z* and *<a-Z>*
*|* (pipe)::
default shell command register, used by commands that spawn a subshell:
*|*, *<a-|>*, *!* and *<a-!>*
== Special registers
Some registers are not general purposes, they cannot be written to, but they
contain some special data
*%* (percent)::
current buffer name
*.* (dot)::
current selection contents
*#* (hash)::
selection indices (first selection has 1, second has 2, ...)
*_* (underscore)::
null register, always empty
*:* (colon)::
last entered command
== Integer registers
Registers *1* to *9* hold the grouped sub-matches of the regular
expression used to make the last selection. Example: applying the
following regular expression to the date of the day would put the day of
the week in register *1*, the month in register *2*, and the day of the
month in register *3*, but select the entire date:
--------------------
(\w+) (\w+) (\d+) .+
--------------------