vi keeps a number of buffers including the current one.
y | Yank to buffer |
p | Pull from buffer to after cursor |
P | Pull from buffer to before cursor |
Any of those commands can be prefixed with "id
Where the ID specifies a particular
buffer. Pulling from a buffer does not empty it - you can pull multiple times to copy something.
Deletion actually copies to one of the numbered buffers. Last deleted block goes to buffer 1, one before that buffer 2 etc.
"1p | Recover the last deleted block |
"1p.... | Repeat the pull - special case on number buffered, goes back to previous ones |
A series of buffers for your own use exist labelled a-z. Useful tricks include:
"aY :e anotherfile "apTo copy between files.
Buffers are also where good deep vi macros are built using the @buffer id command.
Copyright Dr. David Alan Gilbert 2001. vitalk @ treblig.org - Hacked together with dsh