Skip to main content
For Students: Keyboard Shortcuts

Helpful keyboard shortcuts in the CodeHS Code Editor

Lea Sloan avatar
Written by Lea Sloan
Updated over a week ago

Our Code Editor has some built-in keyboard shortcuts that can make writing programs on CodeHS a bit easier. Here are some helpful shortcuts you can try while writing code:

General Shortcuts

Action

Windows / Chromebook

Mac OS

Indent

Tab

Tab

Outdent

Shift-Tab

Shift-Tab

Undo

Ctrl-Z

Command-Z

Redo

Ctrl-Y

Command-Y

Toggle comment

Ctrl- /

Command- /

Go to line

Ctrl-L

Command-L

Demo of toggle comment to quickly comment out lines of code:

Gif showing toggle comment shortcut

Demo of Autoformatting code in JavaScript programs:

Animated .gif showing the Code Editor's autoformatting feature

Multi-cursor

Instead of having just one cursor, you can create a multi-cursor to allow you to make edits (such as indenting) to multiple lines of code at the same time.

Action

Windows / Chromebook

Mac OS

Add multi-cursor above

Ctrl-Alt-Up

Ctrl-Option-Up

Add multi-cursor below

Ctrl-Alt-Down

Ctrl-Option-Down

Demo of creating a multi-cursor to quickly indent multiple lines:

Gif showing multi-cursor keyboard shortcut

Selecting Text

These shortcuts can help you easily select text in your code to copy or cut:

Action

Windows / Chromebook

Mac OS

Select All

Ctrl-A

Command-A

Select Line Up / Down

Shift-(Up/Down)

Shift-(Up/Down)

Select Word Left / Right

Ctrl-Shift-(Left/Right)

Option-Shift-(Left/Right)

Find / Replace

This can be useful if you want to change the name of a variable or element and want to edit all instances of that variable in your program at the same time.

Action

Windows / Chromebook

Mac OS

Find

Ctrl-F

Command-F

Replace

Ctrl-H

Command-Option-F

Find Next

Ctrl-K

Command-G

Find Previous

Ctrl-Shift-K

Command-Shift-G

Demo of Replace to change the name of a function and all the times it appears:

Gif of using Replace shortcut to change all occurrences of a function at once


Still have questions about keyboard shortcuts? Ask your teacher!

Did this answer your question?