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

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:

Multicursor

Instead of having just one cursor, you can create a Multicursor 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 multicursor to quickly indent multiple lines:

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:

Still have questions about keyboard shortcuts? Ask your teacher!

Did this answer your question?