The other day I came across PR#2461 to add a highlighter that shows the selections stored in a particular register. Let me quote from the PR description:
In my daily workflow, I found the
<a-Z>are great commands but can be unfortunately neglected because once selections have been stored in a register, it is hard to remember their precise range after a few minutes of doing something else.
I’ve definitely saved selections with Z and then forgotten about it later, but why isn’t this a plugin?
Zcommand saves selections in the form of
buffer_name@timestamp@main_sel_index list_of_ranges. The two formats are somehow similar but different enough that converting from one to another involved doing cumbersome string parsing/formatting in a shell context. Also this dance needs to be performed each time the targeted register is updated with hooks that do not exist yet.
Well, since this PR was made the
RegisterModified hook was added, so I wondered if it would be easier to write a plugin today. Turns out it was, so I figured I’d post about it in case it helped other people.