69
votes

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?

5

5 Answers

101
votes

In Atom you can just use Ctrl + Up.

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

43
votes

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.

14
votes

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".

4
votes
'.editor':
  'alt-up': 'editor:move-line-up'
  'alt-down': 'editor:move-line-down'
3
votes

Depends on your OS:

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