What do you use registers for?

I just realized: In my years of using kakoune, I have never used non-special registers (e.g. a, b, 1, 2, etc.).
I have considered using them in plugins and scripts, but options are better suited for that because, with registers, I’d have to manage conflicts with multiple scripts trying to use the same register.

So, I figured I’d ask: What do you use registers for? Are they a part of your daily workflow?

I sometimes use them to save multiple selections and move around them or have a “clip board” with multiple text entries, but not much else.

2 Likes

I’ll sometimes use registers to save multiple yanks to paste into another file. If I’m just pasting two things once, I won’t, but if I’m replacing two or more things in multiple places, especially in multiple files, then it’s useful.

But most often: I don’t like to “record” macros, because it makes them hard to change. So I’ll type them out in a scratch buffer, then select the line and "@y, then use q. Sometimes I’ll be making complicated changes and have two or three helper macros, which I’ll save in registers a, b, c, etc., then I’ll play them with "aq, "bq, etc.

1 Like

Registers can be used with to Z to act like marks in vim, allowing you to jump to a specific location. Although I find that as the text changes the selections get out of sync so there’s limited usefulness.

I’d like to have the foresight and some convenient keybindings to pre-emptively save my selection whenever I’m about to jump from somewhere I’ll want to return to shortly but I’ve never picked up the muscle memory for it.

With selection history you can now use <c-h> and <c-k> to go to and from previous selections.

2 Likes