Multi caret copy/paste - wrong behavior


Copying and pasting multiple selections is not working properly. All selected fragments are concatenated first and then the result is pasted under each cursor. I believe Atom should follow Sublime’s approach instead.

I can’t upload images here (as a new user), so you’ll need to paste the following links to the browser to see what I’m talking about.

This is what it should look like:

This is Atom’s behavior:

BTW - Cmd+D is not working under Atom (I can’t remember if it’s been working before or not)

Multiple Selections

This is by now the only reason I have to open Sublime sometimes…


The same approach (as in sublime) is also used in TextMate and in the Emacs multiple-cursors mode. So, Atom does indeed behave weird compared to everything else.


I didn’t realise how often I was copy-pasting when in multiple carets mode until I started using atom and now it works very differently to textmate/sublime text.


I use copy and paste in multiple line selections a lot – and it doesn’t work right, it’s pasting a full copy of all the lines into each single selection

It needs to paste (when the number of lines on the clipboard are the same as the number of selections) one line per selection.

please fix this !!


Hello there,

I somehow play the necromancer here as I have implemented the ST multi-cursors paste in Atom as a package.

__ IMPORTANT: This package is mostly experimental and meant to be a proof of concept, it hacks into Atom in a quite dirty way and may break with an update.__
It monkey patches the Editor::pasteText and Selection::copy methods to provides support for pasting multiple-cursors selections, given that the number of cursors is the same, otherwise it behaves as done actually.

Multiple Cursors Clipboard package

@ProbablyCorey, @kevinsawicki and @nathansobo (and any other person working on Atom for GitHub): I don’t know if you already have this feature/fix in your roadmap, but if not I’ll be pleased if you could give a look at this to tell me if you see any issue and if it can makes its way to the core code.

So now, how does it works:

Looking at the atom sources, I found that copying from multiple selections was already handled with a special case, the selection.copy method was called with the maintainClipboard set to true. In that case, each selection is concatenated to the previous clipboard, and no metadata is provided.
All I did there was to store an array containing each selection text in the metadata.
Then, in the Editor::pasteText method, I check for the presence of the metadata array, if it exists and if the current selections count is the same, then I mutate each selection with the corresponding entry from the clipboard and return from the function (preventing the default behavior). Otherwise it just go with the default behavior, where I only changed the test for the presence of metadata? to test the presence of metadata?.indentBasis?.


Atom is now open source, mind opening this up as an issue there to continue this discussion?


This is great news, I’ll be able to write proper tests for that and submit a PR \o/


This is fixed in 0.95.
In case you have trouble updating from 0.94, this link is helpful:


is it fixed/ is there a workaround for this issue?
possible exact duplicate of this issue Multi Line copy and paste


If you look at the post just before yours, you’ll see that this has been fixed for over two years now. I also just tested and could not reproduce the original behavior.


Sorry for necrobumping this post. I didn’t realize that you had to have copied from a multicursor source to be able to paste as expected.


That isn’t the case at all. I just tried it by:

  1. Select some text with a single cursor
  2. Press Cmd+C to copy it to the clipboard
  3. Click somewhere else to clear the selection
  4. Cmd+Click two other places to create multiple cursors
  5. Press Cmd+V three times to paste in the copied text three times

It worked exactly as I think people would expect … the copied text was inserted three times at each of the three cursor locations. No more, no less.

If you have other experiences, please describe what you do, what you expect to happen and what actually happens.