Skip to content

Latest commit

 

History

History
172 lines (140 loc) · 6.2 KB

File metadata and controls

172 lines (140 loc) · 6.2 KB
layout lesson
title Using your code editor
desc A quick overview of how to use the Atom code editor—though many of these techniques apply to Sublime Text and many others.
hide_show_for_marks true
hide_markbot true
playlist PLWjCJDeWfDdf1QyKEPjutjx3lBLdpRWKP
extra_tutorials
title url highlight
Keyboard shortcut cheat sheet
keyboard-shortcut-cheat-sheet
true
title url
Code editors
code-editors
title url highlight
Snippets cheat sheet
snippets-cheat-sheet
true
title url
Code character cheat sheet
code-character-cheat-sheet
steps
title before notes
Opening projects
The best way to open code in Atom is to drag a whole folder from finder right to the Atom icon in your dock. ![](drag-to-dock.jpg) **The best part about this is that all the files within the folder will then be listed on the right hand side for easy access.** ![](sidebar.jpg) ### Opening multiple projects Same idea applies here: drag the folder to the dock icon. This will open a completely new Atom window which is significantly help you keep all the code files organized.
label text
Shortcut
If you don’t have Atom in your dock, put it there right now—you’ll be needing it a lot.
label text
Shortcut
Use ``⌘` `` to switch between multiple project windows in Atom.
title before notes
Previewing & opening files
**Single clicking** on a file within the Atom sidebar will preview that document in the Atom window. *You can tell it’s being previewed because a tab doesn’t get created or the name on the tab doesn’t change.* **Double clicking** on a files will open that document into a new tab in Atom that you can then edit. ### Using only the keyboard Atom has a super useful keyboard shortcut: `⌘P`—it will pop open a little dialog listing all the files in the current project. Start typing to search through the files and hit enter when you’ve highlighted the one you want. ![](command-p.jpg) *Just start typing to select the file you want.* ![](command-p-fuzzy.jpg) *You don’t even have to type all the letters—it will “fuzzy match” the name and find the one that’s closest to what you want.*
label text
Shortcut
Pressing `⌘P`—then you can search through all the files and open one without taking your hands off the keyboard.
title before
Making a new file
In Atom, since we installed a package, there’s a shortcut key that will make a new file and save it directly into the folder we have open. ![](advanced-open-file.jpg) 1. Press `⌘⌥O` to trigger a new dialog. 2. Type the name of the file, including the extension. 3. Hit `Return`—the file is saved into the folder you opened.
title before shortcuts after
Navigating between tabs
Using a mouse is slow and cumbersome—that’s why keyboard shortcuts are amazing. ![](tab-numbers.gif) To navigate between tabs you can use the `⌘` key and numbers:
keys text
`⌘1`
Will go to the first tab.
keys text
`⌘2`
Will go to the second tab.
keys text
`⌘3`
Will go to the third tab.
keys text
*etc.*
Or you can use `⌘⇧[` and `⌘⇧]` to go backwards and forwards through the tabs.
title before shortcuts after
Navigating code
Navigating code in Atom is the same as any text field in MacOS—all the same shortcuts apply. *It’s a really good idea to get a handle on these shortcuts because they will greatly increase your efficiency.*
keys text
`⌘C`
Copy the selected text.
keys text
`⌘X`
Cut the selected text.
keys text
`⌘V`
Paste the previously copied item.
keys text
`⌘Z`
Undo the recent change.
keys text
`⌘⇧Z`
Redo the recent undo.
keys text
`⌘F`
Find within this file.
keys text
`⌘G`
Find next matching item.
keys text
`⌘⇧G`
Find previous matching item.
keys text
`⌘➔`
Move to the end of the line.
keys text
`⌘←`
Move to the start of the line.
keys text
`⌥➔`
Move to the next word.
keys text
`⌥←`
Move to the previous word.
keys text
`⌘↑`
Move to the top of the file.
keys text
`⌘↓`
Move to the bottom of the file.
keys text
`Shift Arrows`
- Highlight text. - Can be combined with `⌘` & `⌥`
### Manipulating multiple lines of code ![](multi-line.gif) By pressing the `⌘` key and clicking on multiple lines you can change code on many lines at once. **The great thing is that all the keyboard shortcuts you use for one line will now apply to all of those lines too!**
title before shortcuts
Other important keyboard shortcuts
Here are a few other important keyboard shortcuts you should remember to help you get more efficient:
keys text
`⌘⇧P`
Open the command palette to search everything the code editor can do.
keys text
`⌘/`
Toggle comments on/off for code, knowing the correct language.
keys text
`⌘]`, `Tab`
Indent a line of code or multiple lines of code.
keys text
`⌘[`, `Shift Tab`
Outdent a line of code or multiple lines of code.
keys text
`⌘⌥F`
Find and replace within this file.
keys text
`⌘⇧F`
Find and replace within this folder.
keys text
`⌘R`
Filter & find by keyword in this file.
keys text
`⌃⌘↑`
Move a line up.
keys text
`⌃⌘↓`
Move a line down.
keys text
`⌘J`
Join the line below with this line.
keys text
`⌘⇧D`
Duplicate this line.
keys text
`⌃⇧K`
Delete this line.