0

I'm using breakindent to make long lines wraparound to the same indentation level as the start of the line. Unfortunately, with this setting on system copy and paste (in this case, out of the macOS Terminal) includes a bunch of extra spaces. When I paste into another window, the result looks like

We distinguish between training AI systems to identify what humans consider good and           identifying actions that are "good" in some more universal sense, even if humans do not consider them so.  Whether     there are actions that are good in this sense is controversial.  Regardless of      what position one takes on this philosophical question, general good is not yet available as a target for AI           training.

Is there a way to fix copy and paste when breakindent is on?

Clarification: I am copy and pasting by selecting with the mouse and hitting Cmd-C, in order to get text into a different application.

  • 1
    I’ve edited the post to use proper SO code formatting; it’s all on one line atm. Feel free to add any newlines that should be present (though i expect there are none) – D. Ben Knoble Dec 11 '18 at 18:07
  • 1
    ^ That's a reasonable edit, though unfortunately it means you can't see the problem that is the point of the question unless you scroll a ways to the right. – Geoffrey Irving Dec 11 '18 at 22:04
  • Can you use the * register? If so, "*yy should do it – D. Ben Knoble Dec 12 '18 at 1:54
  • Please describe how you are copying. – Christian Brabandt Dec 12 '18 at 7:03
2

Clarification: I am copy and pasting by selecting with the mouse and hitting Cmd-C, in order to get text into a different application.

Okay, so you are basically copying the visual representation on your terminal. Since there is whitespace added, it will be copied as well. There is no way around that (it will also copy e.g. line numbers, signs or concealed characters, since those are visual representation of the text on the screen, but does not really exists inside the buffer/file).

If you don't want this, use e.g. the yank commands, e.g. like :y + to copy the current cursor line into the clipboard (this needs a vim with system clipboard support, e.g. with +clipboard in the :version output). Or use the normal mode yank command, e.g. "+yy

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.