Download the inspect-registers.vim
file from this gist. Open the file in Vim, launching with no vimrc:
vim -Nu NONE inspect-registers.vim
Source the file:
:source %
Insert text on line one:
:0put='Word by word, line by line'
Then run :w
to save the buffer.
for {OPERATION}
in [yw
, yy
, "ayw
, "ayy
, dw
, dd
, "adw
, "add
]
QQ
to clear the registersgg
to place the cursor at the start of line one{OPERATION}
QW
to inspect the registers:e!
to revert any changes to the document
When {OPERATION}
is yw
:
:RegInspect
--- Registers ---
"" Word
"0 Word
"1
"a
"-
When {OPERATION}
is yy
:
:RegInspect
--- Registers ---
"" Word by word, line by line^J
"0 Word by word, line by line^J
"1
"a
"-
When {OPERATION}
is "ayw
:
:RegInspect
--- Registers ---
"" Word
"0
"1
"a Word
"-
When {OPERATION}
is "ayy
:
:RegInspect
--- Registers ---
"" Word by word, line by line^J
"0
"1
"a Word by word, line by line^J
"-
When {OPERATION}
is dw
:
:RegInspect
--- Registers ---
"" Word
"0
"1
"a
"- Word
When {OPERATION}
is dd
:
:RegInspect
--- Registers ---
"" Word by word, line by line^J
"0
"1 Word by word, line by line^J
"a
"-
When {OPERATION}
is "adw
:
:RegInspect
--- Registers ---
"" Word
"0
"1 Word
"a Word
"-
When {OPERATION}
is "add
:
:RegInspect
--- Registers ---
"" Word by word, line by line^J
"0
"1 Word by word, line by line^J
"a Word by word, line by line^J
"-
This table summarizes the results:
{OPERATION} |
"" (default) |
"0 (yank) |
"1 (numbered) |
"a (named) |
"- (small delete) |
---|---|---|---|---|---|
yw |
X | X | - | - | - |
yy |
X | X | - | - | - |
"ayw |
X | - | - | X | - |
"ayy |
X | - | - | X | - |
dw |
X | - | - | - | X |
dd |
X | - | X | - | - |
"adw |
X | - | X | X | - |
"add |
X | - | X | X | - |
Great work, Drew! Doing this exercise helped a great deal in terms of grokking and visualizing what's going on.