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....

2
  • 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, 2017 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, 2017 at 20:55

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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