Command to move line up or down in Atom Editor

29.8k Views Asked by At

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

There are 5 best solutions below

4
On BEST ANSWER

In Atom you can just use Ctrl + Up.

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

0
On

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.

0
On
'.editor':
  'alt-up': 'editor:move-line-up'
  'alt-down': 'editor:move-line-down'
1
On

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

0
On

Depends on your OS:

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