How do I do multi-line editing in Atom editor?

50

14

I've been reading all over and I can't find anything on how to do this in Atom on Windows? And by multi-line editing, I mean being able to expand your cursor across multiple-lines, and being able to type, and that whatever you have typed replicates over all lines you have selected

Tiwaz89

Posted 2015-08-14T13:55:30.480

Reputation: 705

Answers

47

IIRC, it is the same as it is with Sublime Text. Ctrl+Alt and then use the arrow keys to select additional rows. If using the mouse, then just the Ctrl key is used; the selected locations can be as required, the wouldn't need to be in any particular order.

Atom have a "flight manual" (user manual) with some more detail of the block editing here.


On a Mac when using the mouse, it would be the Cmd / ⌘ key instead of the Ctrl as on Windows.


Note:

On Windows, the Ctrl+Alt could be already mapped by the OS or the screen card drivers/utility to change the screen orientation, for example: CTRL + ALT + WINDOWS KEY + Up / Down

The same would apply on the Mac, e.g.: the Ctrl + Shift (as used in Sublime) is often mapped by the OS, so the functionality there takes preference.

In both cases the keybindings can be changed to something else to accommodate both (or turn off the OS, screen card short cuts).

Niall

Posted 2015-08-14T13:55:30.480

Reputation: 1 944

1True. I find in general though that the short cuts using Ctrl only map to the Cmd key on a Mac. – Niall – 2015-08-20T19:46:57.130

3While the mouse way works, doing Ctrl + Alt and arrows actually turns my screen upside down on Windows.. – Tiwaz89 – 2015-08-21T09:11:40.540

1@Dean. Thats sounds like you have then shortcut mapped somewhere else then, probably the screen card. You could then remove the shortcut from the screen card driver utility, or create another key mapping for Atom. – Niall – 2015-08-21T09:16:09.757

2Ctrl+Windows+Alt+arrow keys worked for me in Windows. – Patrick McElhaney – 2017-07-03T16:20:14.737

if you use the mouse you still need to use ctrl + alt not just ctrl – Aequitas – 2017-10-27T02:11:36.043

@Aequitas. Interesting, what platform are you on? – Niall – 2017-10-27T06:42:39.273

@Niall windows 10 not sure atom version can report on Monday if you're interested – Aequitas – 2017-10-27T06:47:13.677

@Aequitas. Sure, lets see if this is something new. – Niall – 2017-10-27T06:50:12.357

@Niall Atom Version 1.21.1 – Aequitas – 2017-10-29T23:09:50.457

@Aequitas. That version on Win10 still works for me as described in the answer. Maybe there is a plugin or such (possible even system shortcut) that causes the change. – Niall – 2017-10-30T08:13:50.177

I know the question is about Windows, but for the record, on Linux the <kbd>Ctrl</kbd>+<kdb>Alt</kdb>+arrow combinations are taken by the DE for workspace management. – Luís de Sousa – 2018-10-04T06:17:30.977

20

For mac users, I found 3 ways:

  1. You have a plugin to add support for alt + rectangular mouse selection, called sublime-style-column-selection.
  2. With + mouse click in multiple places to create multiple cursors.
  3. Or without the mouse, there is control+shift+ and control+shift+, but you have to disable the same shortcuts from System Preference -> Keyboard -> Shortcuts used by Mission Control: look for ^ ↑ (ie. control+) and ^ ↓ (ie. control+).

    enter image description here

SeF

Posted 2015-08-14T13:55:30.480

Reputation: 301

2Thanks for providing the 3rd solution a bit more straight forward than it is in the first answer. – SimonSimCity – 2017-05-31T10:36:36.227

4

Install a plugin,

https://atom.io/packages/multi-cursor

NOTE: multi-cursor plugin does not show up in Packages menu like some other plugins.

Pressing the following key combo will give you multi line edit,

Windows: alt up arrow

Linux: alt shift up arrow

James Schiiller

Posted 2015-08-14T13:55:30.480

Reputation: 41

3

Today I found a package in Atom named "column-select". So far it works perfectly fine. The way it works is very close to the implementation of Block selection of Rstudio and Kate.

It does not add space to fill the gap. It literally let you select vertically if there is anything there (skips empty lines and lines that does not have enough length).

The following gif from their Github shows how it works:

enter image description here

Mehrad Mahmoudian

Posted 2015-08-14T13:55:30.480

Reputation: 187