Keyboard Shortcuts in Playgrounds
Keyboard shortcuts let us reduce the amount of time we spend reaching for the trackpad or a mouse.
Learn the shortcuts below and gain one of the small but helpful "super powers" of experienced software developers.
Run Playground
Run the latest version of your code.
Shortcut: Command-R
Step Through My Code
Step through your code, showing what line is being run, one at a time, when the playground runs.
Shortcut: Shift-Command-R
Show or Hide Sidebar
Toggle the visibility of the navigation sidebar. Hiding the sidebar provides more space to view your code!
Shortcut: Option-Command-S
Increase Text Size
Increase the size of text in the code window.
Shortcut: Command + or Command =
Decrease Text Size
Decrease the size of text in the code window.
Shortcut: Command -
Select All Text
Select all the text in the code window.
Shortcut: Command-A
Re-Indent
For any code that is selected, it will be re-indented.
This is a great way to clean up your code to make it more readable!
It can also be a way to spot syntax errors, when opening or closing curly brackets for a code block are missing.
Shortcut: Control-I
Shift Right
For the line of code the cursor is on, or for a selected block of code, shift the code to the right.
Shortcut: Command-]
Shift Left
For the line of code the cursor is on, or for a selected block of text, shift the code to the left.
Shortcut: Command-[
Move to End of Current Line
Move the cursor to the end of the current line.
Shortcut: Command-→
Move to Start of Current Line
Move the cursor to the start of the current line.
Shortcut: Command-←
Select Entire Line
Select an entire line of code, either above or below the cursor.
Shortcut: Shift-↑ or Shift-↓
Block Comment
Toggle a selected block of code between being commented out or active.
Code that is commented out will not be run by the playground.
Shortcut: Command-/