2017-11-02 03:03:24 +01:00
|
|
|
= Registers
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Description
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
Registers are named lists of text -instead of simply text- in order to interact
|
2017-05-11 20:42:09 +02:00
|
|
|
well with multiselection. They are used for various purposes, like storing
|
2019-12-06 10:00:05 +01:00
|
|
|
yanked text, the locations of selections in a buffer, or groups captured by a
|
|
|
|
regular expression.
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Interacting
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
*<c-r><c>*::
|
2017-11-02 10:37:39 +01:00
|
|
|
when in insert mode or in a prompt, insert the value stored in the
|
|
|
|
*c* register (single character)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*"<c>*::
|
2017-11-02 10:37:39 +01:00
|
|
|
in normal mode, select the *<c>* register (single character)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Alternate names
|
2016-10-09 22:32:36 +02:00
|
|
|
|
2017-04-21 12:32:47 +02:00
|
|
|
Non alphanumeric registers have an alternative name that can be used
|
2016-10-09 22:32:36 +02:00
|
|
|
in contexts where only alphanumeric identifiers are possible.
|
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Default registers
|
|
|
|
|
2018-10-27 17:01:15 +02:00
|
|
|
All normal-mode commands using a register default to a specific one if not specified:
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*"* (dquote)::
|
2018-10-27 17:01:15 +02:00
|
|
|
default delete / copy / paste / replace register, used by:
|
|
|
|
*c*, *d*, *y*, *p*, *<a-p>*, *<P>*, *<a-P>*, *R* and *<a-R>*
|
2019-12-06 08:41:27 +01:00
|
|
|
(see <<keys#changes, `:doc keys changes`>>)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*/* (slash)::
|
2018-10-27 17:01:15 +02:00
|
|
|
default search / regex register, used by:
|
2022-07-30 19:50:57 +02:00
|
|
|
*/*, *<a-/>*, *?*, *<a-?>*, *n*, *<a-n>*, *N*, *<a-N>*, ***, *<a-***>*,
|
2018-10-27 17:01:15 +02:00
|
|
|
*s*, *S*, *<a-k>* and *<a-K>*
|
2022-07-29 21:04:23 +02:00
|
|
|
(see <<keys#searching, `:doc keys searching`>>).
|
|
|
|
This is a prompt history register, holding the last 100 commands entered
|
|
|
|
at an interactive regex prompt.
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*@* (arobase)::
|
2018-10-27 17:01:15 +02:00
|
|
|
default macro register, used by:
|
|
|
|
*q* and *Q*
|
2019-12-06 08:41:27 +01:00
|
|
|
(see <<keys#macros, `:doc keys macros`>>)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*^* (caret)::
|
2018-10-27 17:01:15 +02:00
|
|
|
default mark register, used by:
|
|
|
|
*z*, *<a-z>*, *Z* and *<a-Z>*
|
2019-12-06 10:01:30 +01:00
|
|
|
(see <<keys#marks, `:doc keys marks`>>
|
|
|
|
and <<registers#marks, `:doc registers marks`>>)
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*|* (pipe)::
|
2018-10-27 17:01:15 +02:00
|
|
|
default shell command register, used by commands that spawn a subshell:
|
|
|
|
*|*, *<a-|>*, *!* and *<a-!>*
|
2022-07-29 21:04:23 +02:00
|
|
|
(see <<keys#changes-through-external-programs, `:doc keys changes-through-external-programs`>>).
|
|
|
|
This is a prompt history register, holding the last 100 commands entered
|
|
|
|
at interactive shell command prompts, except for commands starting with
|
|
|
|
a space.
|
2016-02-18 13:57:23 +01:00
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Special registers
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
Some registers are not general purposes, they cannot be written to, but they
|
|
|
|
contain some special data
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*%* (percent)::
|
2017-11-02 10:37:39 +01:00
|
|
|
current buffer name
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*.* (dot)::
|
2017-11-02 10:37:39 +01:00
|
|
|
current selection contents
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-10-11 00:19:23 +02:00
|
|
|
*#* (hash)::
|
2017-11-02 10:37:39 +01:00
|
|
|
selection indices (first selection has 1, second has 2, ...)
|
2016-03-16 13:29:43 +01:00
|
|
|
|
2016-10-09 22:32:36 +02:00
|
|
|
*_* (underscore)::
|
2017-11-02 10:37:39 +01:00
|
|
|
null register, always empty
|
2016-03-31 10:19:33 +02:00
|
|
|
|
2017-07-10 22:05:21 +02:00
|
|
|
*:* (colon)::
|
2022-07-29 21:04:23 +02:00
|
|
|
prompt history register holding the last 100 commands entered at the
|
|
|
|
interactive prompt, except for commands starting with a space.
|
2017-07-10 22:05:21 +02:00
|
|
|
|
2017-11-02 03:03:24 +01:00
|
|
|
== Integer registers
|
|
|
|
|
2016-03-16 13:29:43 +01:00
|
|
|
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+) .+
|
|
|
|
--------------------
|
2019-12-06 10:01:30 +01:00
|
|
|
|
|
|
|
== Marks
|
|
|
|
|
|
|
|
When a register is used to store a set of selections with the *Z* key (see
|
|
|
|
<<keys#marks, `:doc keys marks`>>), the selections are stored as a list of
|
|
|
|
spans, in a format similar to `%val{selections_desc}` (see
|
2020-04-12 14:26:14 +02:00
|
|
|
<<expansions#value-expansions, `:doc expansions value-expansions`>>). However,
|
2019-12-06 10:01:30 +01:00
|
|
|
the very first item of the list is of the form:
|
|
|
|
|
2019-12-10 11:14:03 +01:00
|
|
|
------------------------------------------
|
|
|
|
<buffer name>@<timestamp>@<main sel index>
|
|
|
|
------------------------------------------
|
2019-12-06 10:01:30 +01:00
|
|
|
|
2019-12-10 11:14:03 +01:00
|
|
|
with:
|
2019-12-06 10:01:30 +01:00
|
|
|
|
2019-12-10 11:14:03 +01:00
|
|
|
*buffer name*::
|
|
|
|
`%val{buffile}` of the buffer selections relate to
|
2019-12-06 10:01:30 +01:00
|
|
|
|
2019-12-10 11:14:03 +01:00
|
|
|
*timestamp*::
|
2020-05-28 18:37:26 +02:00
|
|
|
`%val{timestamp}` at which the selection applies to
|
2019-12-06 10:01:30 +01:00
|
|
|
|
2019-12-10 11:14:03 +01:00
|
|
|
*main sel index*::
|
|
|
|
0-based index of the main selection
|