|
|
|
|
|
by Exuma
926 days ago
|
|
Ive used vim for 10+ years, and I have known about yanking to different registers, but usually I only use the main register 99.9999% of the time. can you explain your use cases for using multiple registers? I should start doing this perhaps, but I can't think of many times I want to copy more than one thing at once, maybe once a month? But I also could be not thinking of the right examples. |
|
Also useful in the context of macros... A, B, C being differing bits you might be "lifting", and then placing somewhere.
Imagine that your converting `function do_something() { ... }` to: `arr["do_something"] = function() { ... }`You could delete the function name into "A", the function body into "B", then go back to your marked spot, and pull out the "A" into the hash key, and put "B" as the key value.
It's reeeally awkward and complicated until you use it and it becomes a natural part of your way of thinking. Then it becomes "simply" two extra characters to type when working with _any_ copy/paste task and then you have a super-power of 26 choices of holding things off to the side.
`<c-r>$REG` is honestly one of the best "beginner" uses of registers. It lets you "inline type" what you've just lifted/cut. eg:
...it's a small thing, but an important aspect of "vim as a live text-based programming language", having a few "hot" named variables / text strings, and being able to see them and manipulate them. It's literally just the double-quote key and ":reg" that gives you access to it.