0

I have a permanent register "T and it's filled with something already. When I yank something else into it, it's appended to the register.

I'd like to clear out just that one register so I can yank something fresh to it without appending to it.

My command for yanking is "Ty...

I've already tried several things in ex mode like:

:call setreg('T', [])

let @T=''

And it doesn't go away....

  • 1
    But you know that register T is the same as register t, but lower case replaces, while upper case appends? You don't have to clear it, just use "ty or did I misunderstand you? – Philippos May 23 '17 at 20:49
  • No I didn't know that... :( all I knew is that if you use "Ty it will persist between closings vim. – leeand00 May 23 '17 at 20:55
2

As Philippos pointed out in the comments, if you use the lowercase register, i.e. "t, it will overwrite instead of append.

You were close with your ex commands to clear the register. However these ones should also be lowercase too. Either of these should work:

:call setreg('t', [])
:let @t=''

Although I would probably recommend doing

:call setreg('t', '') 

instead of [].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.