registers.asciidoc (3570B)
1 = Registers 2 3 == Description 4 5 Registers are named lists of text -instead of simply text- in order to interact 6 well with multiselection. They are used for various purposes, like storing 7 yanked text, the locations of selections in a buffer, or groups captured by a 8 regular expression. 9 10 == Interacting 11 12 *<c-r><c>*:: 13 when in insert mode or in a prompt, insert the value stored in the 14 *c* register (single character) 15 16 *"<c>*:: 17 in normal mode, select the *<c>* register (single character) 18 19 == Alternate names 20 21 Non alphanumeric registers have an alternative name that can be used 22 in contexts where only alphanumeric identifiers are possible. 23 24 == Default registers 25 26 All normal-mode commands using a register default to a specific one if not specified: 27 28 *"* (dquote):: 29 default delete / copy / paste / replace register, used by: 30 *c*, *d*, *y*, *p*, *<a-p>*, *<P>*, *<a-P>*, *R* and *<a-R>* 31 (see <<keys#changes, `:doc keys changes`>>) 32 33 */* (slash):: 34 default search / regex register, used by: 35 */*, *<a-/>*, *?*, *<a-?>*, *n*, *<a-n>*, *N*, *<a-N>*, ***, *<a-***>*, 36 *s*, *S*, *<a-k>* and *<a-K>* 37 (see <<keys#searching, `:doc keys searching`>>). 38 This is a prompt history register, holding the last 100 commands entered 39 at an interactive regex prompt. 40 41 *@* (arobase):: 42 default macro register, used by: 43 *q* and *Q* 44 (see <<keys#macros, `:doc keys macros`>>) 45 46 *^* (caret):: 47 default mark register, used by: 48 *z*, *<a-z>*, *Z* and *<a-Z>* 49 (see <<keys#marks, `:doc keys marks`>> 50 and <<registers#marks, `:doc registers marks`>>) 51 52 *|* (pipe):: 53 default shell command register, used by commands that spawn a subshell: 54 *|*, *<a-|>*, *!* and *<a-!>* 55 (see <<keys#changes-through-external-programs, `:doc keys changes-through-external-programs`>>). 56 This is a prompt history register, holding the last 100 commands entered 57 at interactive shell command prompts, except for commands starting with 58 a space. 59 60 == Special registers 61 62 Some registers are not general purposes, they cannot be written to, but they 63 contain some special data 64 65 *%* (percent):: 66 current buffer name 67 68 *.* (dot):: 69 current selection contents 70 71 *#* (hash):: 72 selection indices (first selection has 1, second has 2, ...) 73 74 *_* (underscore):: 75 null register, always empty 76 77 *:* (colon):: 78 prompt history register holding the last 100 commands entered at the 79 interactive prompt, except for commands starting with a space. 80 81 == Integer registers 82 83 Registers *1* to *9* hold the grouped sub-matches of the regular 84 expression used to make the last selection. Example: applying the 85 following regular expression to the date of the day would put the day of 86 the week in register *1*, the month in register *2*, and the day of the 87 month in register *3*, but select the entire date: 88 89 -------------------- 90 (\w+) (\w+) (\d+) .+ 91 -------------------- 92 93 == Marks 94 95 When a register is used to store a set of selections with the *Z* key (see 96 <<keys#marks, `:doc keys marks`>>), the selections are stored as a list of 97 spans, in a format similar to `%val{selections_desc}` (see 98 <<expansions#value-expansions, `:doc expansions value-expansions`>>). However, 99 the very first item of the list is of the form: 100 101 ------------------------------------------ 102 <buffer name>@<timestamp>@<main sel index> 103 ------------------------------------------ 104 105 with: 106 107 *buffer name*:: 108 `%val{buffile}` of the buffer selections relate to 109 110 *timestamp*:: 111 `%val{timestamp}` at which the selection applies to 112 113 *main sel index*:: 114 0-based index of the main selection