Atom Editor Keyboard Shortcut Cheat-Sheet

9 min. read

I'm trying out Atom after hearing so much about it. Before I have used other text editors like Vim, Sublime, gedit (text editor that comes out of the box with Ubuntu and has some nice plugins), NEdit, nano and some IDE's like IntelliJ, Eclipse or NetBeans.

I'm really liking Atom. You have a nice file tree, like in Sublime or Gedit, and Ctrl + p will search for a file by name as you can do if you install the ctrlp plugin in Vim. It also lets you see the git status of your files by using a colour code to show them. Like Vim, it allows you to split the window in as many panels as you want horizontally and vertically.

I don't find it slow as many people on the nets, but it might be because I run on an 8 cores / 3.5GHz / 8 Gb RAM machine </showoff>.

As I did in the past for Vim, I decided to make a cheat-sheet with all the shortcuts I learned so far. I will keep adding more as I learn them.

To see all the keyboard shortcuts your atom installation comes with, go to Edit > Preferences > Keybindings.

I am using Ubuntu 14.04 on a Mountain laptop.

  • Alt + or : Skip words.
  • Ctrl + or : Move lines.
  • Ctrl + k and then , , or : Split pane.
  • Ctrl + k and then Ctrl + , , or : Switch panes (also Alt + Number).
  • Ctrl + <: Toggle tree view.
  • Ctrl + g and then line number: Go to line.
  • Ctrl + /: Comment / uncomment.
  • Ctrl + o: Open file.
  • Ctrl + n: New file.
  • Ctrl + q: Close Atom.
  • Ctrl + w: Close current tab.
  • Ctrl + m: Go to matching bracket.
  • Ctrl + l: Select line (like Shift + v in Vim).
  • Ctrl + j: Move the next line to the end of this line (join lines).
  • Ctrl + d at the beginning of a word: Select the whole word. If you keep pressing d, it will find all occurrences of the word.
  • Ctrl + u un-select what was selected with Ctrl + d, one at a time.
  • Ctrl + left click: Select cursor position in separated lines.
  • Ctrl + Shift + k: Delete line. Keep pressing k to delete consecutive lines.
  • Ctrl + Shift + d: Duplicate current line below.
  • Ctrl + Shift + f: Search in project.
  • Ctrl + Shift + m: Markdown preview (I find this one AMAZEBALLS).
  • Shift + Alt + : Type in several consecutive lines at once (click to exit).
  • Shift + Alt + and then or : Select columns (like Ctrl click and drag in NEdit).

Also, you can add your own shortcuts. For example, I have a Spanish keyboard, so, to access the [ and] keys, I have to type Alt Gr + ` and Alt Gr + +. The Alt Gr or "Right Alt" is used in these keyboards to access the symbols to the right of a key (the icons at the top are accessed with Shift, and the symbols to the left just by pressing the key). But Atom doesn't know what a "Right Alt" is.

Because of this, I have problems with indentation: Indent is mapped to Ctrl + [ but I have to press Ctrl + `, and Outdent is mapped to Ctrl + ], but if I press Ctrl + + I zoom the text. So I have to select the line with Ctrl + l and press tab.

Auto-indent is funny, because it doesn't come mapped to any combination. So I had to add my own! How to do that? You have to add them to the keymap.cson file. You can find it in Edit > Keymap.... If you pay attention to the keybinding's Command column, you will find that only some of them start with "editor:". Find any of those, and click the "copy" icon to its left. Then go to the keymap.cson file and paste it there.

This will produce the right attribute, in this case 'atom-text-editor', so I just have to edit the key. I searched for Ctrl + i and it's not mapped to anything, so my keymap.cson file looks like this:


  'atom-text-editor':
  'ctrl-i': 'editor:auto-indent'

Now if I go to Edit > Lines > Auto indent, my shortcut "Ctrl+I" appears next to it.

Atom comes with a very handy vertical guide placed at 80 characters so that you can always write readable lines of code. However, when you are using it to write prose, as in a README file or blog post, you may want the lines to wrap automatically. You can do it per file, or, more conveniently, set it as the default behaviour for all files. To make this change permanent, you can open Atom's configuration file, config.cson, in Edit > config... and add softWrap: true inside editor:, like this:


  "*":
  core: {}
  editor:
    fontSize: 13
    invisibles: {}
    softWrap: true
  welcome:
    showOnStartup: false

I'm not opinionated about editors, nor I like to be imposed one, nor I impose others to use one... Although in some companies all developers are encouraged to use the same editor to make pairing easier. I think everybody should use whatever is more comfortable to them. For now on, I think I'll stick with atom. Feels like something in between a simple editor and an IDE, with the best of both worlds.

Comments