Mark Show, show the selections in the mark register

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 Z, z, <a-z> and <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?

The Z command 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.


Neat, thanks! Almost feels like this should be the default.

Completely agree. One of the nicest things that struck me migrating from vim to kakoune was how much visual feedback you get, which makes it much more intuitive to use.

I’ve installed this plugin for that reason, hoping to use marks more often now. Thanks @Screwtapello !