Hacker News new | ask | show | jobs
by devnull3 926 days ago
I am a Vim guy. Can someone explain what exactly is broken?
5 comments

In Vim speak:

Imagine you create a bunch of recorded keyboard macros that store stuff in different registers. Now this change comes and instead of typing `"ay` you have to press `"a<Enter>y`. Indeed any time you store to a register (`"a`) you have to add an enter key. This breaks all of your keyboard macros and all of your muscle memory made over the past twenty years or more.

This is why people are upset.

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.

    "ayy - copy function signature

    "byy - copy return signature

    "ap "bp - paste either...

    :reg - show all registers

    "3p - paste 3rd "historical" register

    "_dd - delete into the /dev/null buffer (so you don't eat your `yy` register that you'd already yanked)
It's admittedly a bit of an advanced/esoteric feature, but being able to paste "this part" or "that part" being somewhat context dependent is useful.

Also useful in the context of macros... A, B, C being differing bits you might be "lifting", and then placing somewhere.

    i<c-r>" / i<c-r>a - recall (while in insert mode) the default, or the named register.
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:

     vwy - yank visible word into default register
     V"ay - yank whole line into register "a"
     I<c-r>"=<c-r>"+1 => `word = word + 1` (without having to exit insert mode!)
     "ap - paste the line from register "a"
...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.
Ah this is incredible, thank you. I didnt realize that about <c-r>... wow, that is crazy cool.

Next question, do you usually add stuff to buffers in alphabetical order... a,b,c or do you pick something easier within reach like a,s,d (or something else entirely)

Usually a/b/c but sometimes f/function, k/key, v/value... just a simple mnemonic.

To really blow your mind:

    i<c-r>%

    V:!ls<cr>
Then you start playing with marks a little bit with a similar concept (eg: ma, mb, mc, 'a, 'b, 'c), and the good friend `gi` (go back to previous insert position)...

It's again, esoteric, but as you use it more, it becomes less esoteric and more just another part of your vim vocabulary (:help search-offset, fellow traveler).

Usually I yank into like p or something when I want to not just paste later, but delete something and then paste. I hate it when I delete something to make room for what I paste and it gets rid of it. Then I fumble with the numbered registers and mess it up.

Or when I select something and then paste and I actually wanted to keep my paste buffer and not replace it

First thing I thought about: yank a line to a, yank another line to b; move somewhere into the file; paste from a, move two lines down, paste from b; repeat N times or create a macro for it. Basically it will be macro with two inputs, the contents of the a and b registers.
I do code in a gate around a few registers for macros and marks. I hate recording a macro and then accidentally overwriting it.
They did the Emacs equivalent of adding a confirmation dialog to an action which some people do very frequently (like tens of times per minute). I think it also fundamentally breaks some rarer use cases I would have trouble explaining to non-Emacs users, but do seem somewhat valuable.

It's not clear to me from the messages I read why this can't be worked around without a hard fork, although I do agree it's an obvious bad decision to begin with, and obvious to me even as someone who barely uses this feature.

Looking at the commit diff, I don't see anything that necessitates a hard fork. The changes are all in elisp, not compiled C code. It looks like just evaluating the old version of register.el (perhaps with a few compatibility changes) in an Emacs session would revert everything to the old behavior.
https://news.ycombinator.com/item?id=38591788

This person seems to explain it well

The Emacs development process

No, I'm not kidding

There is no focus, there's no objective, it seems the louder ideas win but there's no final idea of what Emacs should look like or what/how it should do or not

That's why such breaking changes get in without questioning (and even why they were using such functionality as registers in the first place)

yea seems right. tfa says that thierry didn't accept input at all from other maintainers. that's not good in my eyes.
It's explained in the article.
I could not understand and hence I asked the question. The thing I understood was that this broke some peoples flow.
I’m not an Emacs user and also failed to understand what went wrong. So they changed a default shortcut or something?
Imagine copying via Ctrl-C and having to hit enter to confirm a dialog "Did you want to copy this text". It's added, unavoidable friction for an action that some people use a lot.

Additionally, some actions on top of the original behavior (that depended on Ctrl-C completing automatically, to keep with the analogy), now are just broken.

While I appreciate the analogy, it's important to note that registers are a fairly advanced feature, not quite as ubiquitous as Ctrl-C. Standard Emacs copy-paste remains unchanged and functions just as expected.
I also don't really use emacs. But by the sounds of it, when you want to use a command that involves a register, you get a mini-popup where you input the register you want.

The downside is that you must push enter after you enter the register you want.