Command to move line up or down in Atom Editor

Keyboard ShortcutsAtom Editor

Keyboard Shortcuts Problem Overview


I have used Sublime for years and am trying out Atom for the first time.

How can I move a single line or selected block up or down by one line? In sublime I could do this with ctrl+shift+Up, but that doesn't seem to work in Atom. Any ideas?

Keyboard Shortcuts Solutions


Solution 1 - Keyboard Shortcuts

In Atom you can just use Ctrl + Up.

You can find these options on Atom menu : Edit > Lines > Move Line Up

Solution 2 - Keyboard Shortcuts

Windows: Ctrl+Up/Down

Mac: Ctrl+Cmd+Up/Down

Don't have enough Rep to leave as a comment. But for @DanielM question.

To move several lines in Atom:

Select all the several lines you want move by mouse or by holding shift and moving up or down the lines you want, and then use either the commands for Windows Ctrl+Up/Down or Mac Ctrl+Cmd+Up/Down

Note: The whole line does not have to be selected as long as part of it is, it will move with the commands.

Solution 3 - Keyboard Shortcuts

I had the same problem, I solved editing keymap file and adding this:

'atom-workspace atom-text-editor':
  'alt-up': 'editor:move-line-up'
  'alt-down': 'editor:move-line-down'

So to move I use "alt+up" or "alt+down".

Solution 4 - Keyboard Shortcuts

'.editor':
  'alt-up': 'editor:move-line-up'
  'alt-down': 'editor:move-line-down'

Solution 5 - Keyboard Shortcuts

Depends on your OS:

Linux & Windows: Ctrl + Up/Down
Mac: Ctrl + Cmd + Up/Down

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionpeter-bView Question on Stackoverflow
Solution 1 - Keyboard ShortcutsalysonsmView Answer on Stackoverflow
Solution 2 - Keyboard ShortcutsdlchangView Answer on Stackoverflow
Solution 3 - Keyboard ShortcutsIsa SouzaView Answer on Stackoverflow
Solution 4 - Keyboard ShortcutsMarcelo C.View Answer on Stackoverflow
Solution 5 - Keyboard ShortcutsRimianView Answer on Stackoverflow