48

Is there any way in Atom to replicate the feature in Sublime Text where you can hold down the alt key and move the mouse up or down to select and create a cursor at the end of multiple line so you can edit multiple lines simultaneously?

AstroCB
  • 12,337
  • 20
  • 57
  • 73
pyCthon
  • 11,746
  • 20
  • 73
  • 135
  • 1
    Are you asking if Atom has this feature? Or are you asking if it can be added via an extension? – Lee Sep 01 '14 at 03:06

9 Answers9

52

If I understand your question correctly, you want to select multiple lines and create a cursor at the end of each line. There are a couple ways you can achieve this:

  1. Using Split Into Lines
    1. Highlight multiple lines however you like.
    2. Use the Selection|Split Into Lines command (Cmd+Shift+L on OS X or press Cmd/Ctrl+Shift+P and type Split Into Lines) to split the multiline selection into a selection for each line.
    3. Press the right arrow by itself to reveal the cursor at the end of the selections.
  2. Using Add Selection Below
    1. Position the cursor on the line above the first line you want to select
    2. Use Selection|Add Selection Below to add as many lines with cursors as you want
    3. Use normal cursor positioning commands to place the cursors where you want
Parker
  • 8,539
  • 10
  • 69
  • 98
Lee
  • 18,529
  • 6
  • 58
  • 60
  • Works great, except that I can't select the beginning of every line if there are empty lines in the set. For example, I'd like to take multiple paragraphs of text, some of which has double-CR endings between paragraphs, and at a '> ' to each line. When I try to do this I get a strange selection that me the beginning of each paragraph, and the end of the last sentence of the previous-to-a-double-CR paragraph selection. – pedstrom Jun 03 '15 at 22:08
22

I am big fan of Sublime Text 3, Atom is really nice but can't beat Sublime :)

Well, you can give a try to make "Your Favorite Sublime Key 'CTRL+SHIFT+L'" within ATOM to get Multi Line Selection with multi cursor:

File > Keymap...

Paste below code and smile :)

'atom-text-editor':
    'ctrl-shift-l': 'editor:split-selections-into-lines'

Save and Close Tab. Open any file and Press "CTRL+SHIFT+L". Now magic :D, Press Arrow key and You will see Multiple Cusor on Selected Lines.

Nono
  • 6,986
  • 4
  • 39
  • 39
  • Exactly what I was looking for, couldn't set it from the settings panel, and the shorcut key was associated with selecting the programming language for the current file – opensas Sep 05 '17 at 07:12
15

For Ubuntu you can use shift-alt-up/down

Supertracer
  • 462
  • 6
  • 17
7

For Windows users,
the default keybindings Ctrl+Shift+Up/Down seems to work.

For Mac users,
add the following custom keybinding code to the
/user/<yourName>/.atom/keymap.cson file

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# change the keybinding for ADD SELECTION ABOVE / BELOW
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  'shift-alt-up': 'editor:add-selection-above'
#  'shift-alt-down': 'editor:add-selection`-below'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then place the cursor where you want to start and press and hold Shift+Alt and press Up or Down repeatedly to extend the cursor to as many lines as needed.

+1 to @Lee's solution above. This is same as option 2 above but using keybindings

Parker
  • 8,539
  • 10
  • 69
  • 98
Pankil Shah
  • 1,090
  • 12
  • 9
  • 1
    For Mac users the keyboard shortcut is the same (`ctrl + shift + up / down`), but those shortcuts also launch Mission Control. If you want to remove the Mission Control shortcut, just change or deselect it in Keyboards System Preference. – Tristan Reid Aug 14 '15 at 15:34
  • Yes, @TristanReid, you are correct. If one were to remove the Mission Control shortcuts from the Keyboard System Preference, they don't need to add the above code and simply use the default keybindings. – Pankil Shah Aug 19 '15 at 03:35
  • for linux users shift+alt+down/up seems to be the default. – Gaunt Nov 21 '16 at 16:19
6

This package will let you select multiple lines by holding down "alt" key https://atom.io/packages/sublime-style-column-selection

knguyen
  • 519
  • 6
  • 13
3

And it's ALT + SHIFT + UP/DOWN arrows on Arch (manjaro/i3).

bezoris
  • 31
  • 2
3

Came here because it's 2019 and I'm still a big fan of atom. CTRL + ALT + Left Click on each line you want to edit works for me.

Callat
  • 2,928
  • 5
  • 30
  • 47
2

Recently I was searching a way to highlight and show the cursor on every line in Atom editor.

Atom has a pattern match selection. Say like you want to highlight and select a pattern _(underscore) in every line:

  1. Select a first occurrence of the pattern
  2. Then press CTRL + D (In Windows).

Atom editor will run through all the lines and highlight the same pattern.

BUT if you want to select and highlight a cursor on every line without any pattern.

You can try this shortkey CTRL + ALT + UP/DOWN

My Atom editor version is 1.22.1

Hope this might help.

ArtisanBay
  • 1,001
  • 11
  • 16
0

I was searching for multi-line selection and multilines to single line conversion packages and found these wonderful packages.

Ash
  • 1,180
  • 3
  • 22
  • 36