It doesn’t matter if you’re using a simple editor or a full blown IDE, if you want to be more productive you have to spend time to learn some keyboard shortcuts. Here’s a few keyboard shortcuts I use frequently when I work with Atom.
Most of the time, I work on Windows. Sometimes I switch to a Mac. The shortcuts tend to stay the same, the only difference is that you use the Command key (⌘) instead of Ctrl. But, unfortunately, there are exceptions. When I’m not mentioning otherwise, Ctrl should be replaced by Command on a Mac.
- Open your settings (Ctrl + ,)
- Open Command Palette (Ctrl + Shift + P). I often find myself typing Ctrl + Shift + P and then “invisible” to find the command “Toggle invisibles”.
- Close active tab (Ctrl + W)
- Open file (Ctrl + O)
- Open folder (Ctrl + Shift + O)
I think these are the most useful ones, because they are the most frequently used when working on a project.
- Find file in project (Ctrl + P). Type Ctrl + P and then start typing the file name. Much faster than navigating using the tree. Every editor and IDE has this functionality these days.
- Find text in project (Ctrl + Shift + F).
- Go to next linter error (Alt + Shift + .). This one requires the linter plugin and you can use it to fix linter errors one by one.
- Select all occurrences of symbol (Alt + F3 on Windows, Ctrl + ⌘ + G on Mac). Poor man’s rename tool, it will select all occurrences of the selected symbol (e.g. variable name) within the active editor and as you start typing it will apply the new text everywhere.
- Reveal file in tree view (Ctrl + Shift + ). It will expand the tree view so that you can see the active file.
- Find modified file (Ctrl + Shift + B). This one is great. It works just like Ctrl + P but limits the search to the files you’ve modified (i.e. changed but not committed).
- Toggle blame (Ctrl + B on both Windows and Mac). Requires the blame plugin and basically shows on the gutter of the editor who’s to blame (or praise for that matter) for each line of code in the active file.
- Sort lines (F5). It requires the sort-lines plugin. Functionality I really missed in Atom but it’s provided out of the box in Sublime Text, it just sorts the lines in the active editor (or selection).
- Run mocha tests (Ctrl + Alt + M on both Windows and Mac). Using the mocha-test-runner plugin, you can run your mocha tests without leaving the editor. Tip: If the cursor is on a single unit test line, it will only run that test.
Hope this helps!