/y A did this trick for me.I guess "Ap is the command to pas" /> /y A did this trick for me.I guess "Ap is the command to pas" /> /y A did this trick for me.I guess "Ap is the command to pas"/>

Clear vim register, but still able to paste

1.4k Views Asked by At

I wanted to yank all matching lines of a buffer in a give register. I choose "A

:g/<match>/y A

did this trick for me.I guess

"Ap

is the command to paste A's content, I got my matching lines plus older lines as well, tried clearing A using

:let @A=''

but still able to paste using "Ap .What am I doing wrong?

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 16 2013 20:39:23)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-52
2

There are 2 best solutions below

2
zzapper On BEST ANSWER
:let @a=''

a is the real name of the register

A is just a way of appending to a

:let @A=''

appends nothing to register a i.e. has no effect (this explanation added later)

:let @A='fred'      appends fred to a
:let @A=@b          appends register b to register a
0
Kent On

you should do

 let @a=''

usually when I need clear a reg, I do qaq, I feel it is easier to type.