0: Most recent unnamed(")-yank, every yank goes to this register.
1-9: Most recent unnamed-and-not-small-delete-or-change(not-small = not-one-line)
If target motion is one of %()`/?nN{}, use this register regardless of content(for vi-compat).
For other targets and content is not small, this register is used.
On each save, register content shifts from newest(1) to oldest(9).
Spec:
2. Numbered registers "0 to "9
Vim fills these registers with text from yank and delete commands.
Numbered register 0 contains the text from the most recent yank command,
unless the command specified another register with ["x].
Numbered register 1 contains the text deleted by the most recent delete or
change command, unless the command specified another register or the text is
less than one line (the small delete register is used then). An exception is
made for the delete operator with these movement commands: |%|, |(|, |)|, |`|,
|/|, |?|, |n|, |N|, |{| and |}|. Register "1 is always used then (this is Vi
compatible). The "- register is used as well if the delete is within a line.
Note that these characters may be mapped. E.g. |%| is mapped by the matchit
plugin.
With each successive deletion or change, Vim shifts the previous contents
of register 1 into register 2, 2 into 3, and so forth, losing the previous
contents of register 9.
{Vi: numbered register contents are lost when changing files; register 0 does
not exist}
-: small deletion register
For: Most recent small delete-or-change(less-than-one-line), its used based on contents.
Spec
3. Small delete register "- *quote_-* *quote-*
This register contains text from commands that delete less than one line,
except when the command specifies a register with ["x].
{not in Vi}
Scenario based: what should be happens in operation
0
" a y y: doesn't save to 0 register, since a register specified.
" " y y: save to 0, since it's unnamed
y y: save to 0, since it's unnamed.
1-9
" a d d: doesn't save to 1 register, since a register specified.
" " d d: save to 1, since it's unnamed
d d: save to 1, since it's unnamed.
" a c c: doesn't save to 1 register, since a register specified.
" " c c: save to 1, since it's unnamed
c c: save to 1, since it's unnamed.
c l: does not save to 1, since it's small. it goes to - register.
d l: does not save to 1, since it's small. it goes to - register.
c %: goes always to 1, it's for vi-compatibility. and goes to - if small
d %: goes always to 1, it's for vi-compatibility. and goes to - if small
c n: goes always to 1, it's for vi-compatibility. and goes to - if small
d n: goes always to 1, it's for vi-compatibility. and goes to - if small
Related #293
0-9
: numbred registerFor:
0
: Most recent unnamed("
)-yank, every yank goes to this register.1-9
: Most recent unnamed-and-not-small-delete-or-change(not-small = not-one-line)%()`/?nN{}
, use this register regardless of content(for vi-compat).1
) to oldest(9
).Spec:
-
: small deletion registerFor: Most recent small delete-or-change(less-than-one-line), its used based on contents.
Spec
Scenario based: what should be happens in operation
0
" a y y
: doesn't save to0
register, sincea
register specified." " y y
: save to0
, since it's unnamedy y
: save to0
, since it's unnamed.1-9
" a d d
: doesn't save to1
register, sincea
register specified." " d d
: save to1
, since it's unnamedd d
: save to1
, since it's unnamed." a c c
: doesn't save to1
register, sincea
register specified." " c c
: save to1
, since it's unnamedc c
: save to1
, since it's unnamed.c l
: does not save to1
, since it's small. it goes to-
register.d l
: does not save to1
, since it's small. it goes to-
register.c %
: goes always to1
, it's for vi-compatibility. and goes to-
if smalld %
: goes always to1
, it's for vi-compatibility. and goes to-
if smallc n
: goes always to1
, it's for vi-compatibility. and goes to-
if smalld n
: goes always to1
, it's for vi-compatibility. and goes to-
if small