How to free some register in vim as well as viewing free registers?

171 Views Asked by At

If I yank some text into register a, b and c, They should have text stored in them. I can use :reg command to see the occupied registers as well as their content. But what if I want to see the registers that are not occupied?

This makes it easier if I'm trying to find a register with no content to yank into instead of yanking into a register with some content in it and lose its content accidentally. Instead of typing :reg and seeing the non-free registers and trying to figure out a free one, it'd be more convenient to let vim list the free ones.

Also how to free some register when not needing its content? If I don't free it, it won't show in the "free registers" list.

1

There are 1 best solutions below

0
Matt On

You're overthinkning things. The registers such as a-z are totally yours. And you can do with them pretty much anything you want. (Well, there could be some plugins installed which make use of some of them, but you should probaly know yourself if it's the case).

Considering "freeing" a register, there's no such option in Vim, but you can set it to empty string and it won't be saved to viminfo. And so next time running Vim you won't see it listed by :registers command.