Learn Ten, Not Fifty

Long lists of shortcuts are easy to skim and hard to remember. The ones that save real time are the few you use dozens of times a day: opening files, commenting, moving and copying lines, adding cursors, and letting the editor write repetitive HTML for you. This reference covers those for the HCODX editor and VS Code, then browser DevTools, then autocomplete and Emmet.

We checked the HCODX shortcuts by pressing them in the editor itself; VS Code entries are its default key bindings. On a Mac, use Cmd where Ctrl is shown and Option for Alt, except where the table gives a separate Mac column.

The Shortcuts That Pay Off First

ActionHCODX editorVS Code (Windows, Linux)VS Code (macOS)
Open a file by nameCtrl+PCtrl+PCmd+P
Command paletteCtrl+Shift+PCtrl+Shift+PCmd+Shift+P
Toggle commentCtrl+/Ctrl+/Cmd+/
Move line up or downAlt+โ†‘ / โ†“Alt+โ†‘ / โ†“Option+โ†‘ / โ†“
Copy line downShift+Alt+โ†“Shift+Alt+โ†“Shift+Option+โ†“
Add a cursor on the line belowCtrl+Alt+โ†“Ctrl+Alt+โ†“Option+Cmd+โ†“
Go to lineCtrl+GCtrl+GCtrl+G
Find / replaceCtrl+F / Ctrl+HCtrl+F / Ctrl+HCmd+F / Option+Cmd+F
Show suggestionsCtrl+SpaceCtrl+SpaceCtrl+Space
Format the fileCtrl+Shift+F (opens format options)Shift+Alt+FShift+Option+F
Delete the current lineCtrl+DCtrl+Shift+KShift+Cmd+K

On Linux, VS Code formats with Ctrl+Shift+I instead. In the HCODX editor, Ctrl+Shift+F opens a Format Code dialog where you can pick a preset such as Standard, Compact or Expanded before applying it.

Shortcuts Specific to the HCODX Editor

These control the parts of HCODX that a plain code editor does not have: the preview, the project and the built-in tools.

ActionShortcut
Show or hide the live previewAlt+P
Split view: code and preview side by sideAlt+S
Show or hide the file explorerCtrl+B
Check the HTML (validation panel)Ctrl+Shift+V
Minify the fileCtrl+Shift+M
Export the projectCtrl+E
Editor settings (font, keymap, Emmet)F2
List every shortcutF1

Editor settings also offer Vim, Emacs and Sublime Text keymaps if your fingers already know one of those.

Differences That Trip People Up

Most shortcuts carry over between editors, which makes the few that do not more surprising.

  • Ctrl+D selects the next match of the current word in VS Code, a quick way to rename several things at once. In the HCODX editor it deletes the current line. If you lose a line by accident, Ctrl+Z brings it back.
  • Ctrl+Shift+F searches across all files in VS Code. In HCODX it formats the current file.
  • F2 renames a symbol in VS Code. In HCODX it opens editor settings.
  • Ctrl+Shift+K deletes a line in VS Code, but in Firefox, with focus outside an editor, it opens the web console.

Autocomplete: Let the Editor Finish the Tag

Both editors suggest completions as you type. In the HCODX editor, suggestions include tag names, words already used in the file and snippets; for example, typing a offers plain links as well as snippets such as a:mail for an email link. Press Tab or Enter to accept a suggestion, the arrow keys to choose another, and Esc to dismiss the list. Ctrl+Space opens it on demand.

VS Code adds HTML-aware suggestions for attributes and values, and closes tags for you as you type. Whichever editor you use, autocomplete is most useful for long attribute names and values you would otherwise mistype, such as autocomplete="current-password" or rel="noopener noreferrer".

Emmet: Write HTML in Shorthand

Emmet expands short CSS-like abbreviations into full markup. > means "inside", + means "next to", * repeats, . adds a class, # an id and square brackets add attributes. These are the actual expansions:

TypeYou get
ul>li*3A <ul> containing three empty <li> elements
nav>a[href=#]*3A <nav> with three <a href="#"> links
div.card>h2+p<div class="card"> containing an <h2> followed by a <p>
section#about.wrapper<section id="about" class="wrapper"></section>
img[alt]<img src="" alt="">
!A complete HTML5 page: doctype, lang, charset, viewport and title

For example, ul>li*3 becomes:

<ul>
    <li></li>
    <li></li>
    <li></li>
</ul>

In CSS files the same idea applies to properties: m10 becomes margin: 10px; and d:f becomes display: flex;.

In VS Code, Emmet is built in: type an abbreviation in an HTML file and press Tab or Enter when the Emmet suggestion appears. In the HCODX editor, Emmet is off by default. Open editor settings with F2, and under Productivity switch on Emmet; then Tab expands abbreviations in HTML and CSS files. The Emmet library loads the first time you switch it on, so do it while you are online.

Browser DevTools Shortcuts

Whatever editor you use, you will debug in the browser. These work in Chrome and Edge, with Firefox differences noted.

ActionWindows, LinuxmacOS
Open DevToolsF12 or Ctrl+Shift+ICmd+Option+I
Pick an element to inspectCtrl+Shift+CCmd+Shift+C
Open the console (Chrome, Edge)Ctrl+Shift+JCmd+Option+J
Open the console (Firefox)Ctrl+Shift+KCmd+Option+K
Device or responsive modeCtrl+Shift+MCmd+Shift+M (Firefox: Cmd+Option+M)
Reload, ignoring the cacheCtrl+Shift+RCmd+Shift+R

In Chrome and Edge, device mode works only while DevTools is open. The reload that ignores the cache is the one to use when a stylesheet change refuses to show up.

How to Make Shortcuts Stick

  • Add one or two a week. Pick the action you do most with the mouse and replace it.
  • Use the command palette as a cheat sheet. It lists commands with their shortcuts, so searching for an action also teaches you its keys.
  • Keep one keymap. If you switch between editors daily, choose matching bindings where you can, and learn the few differences above.

Conclusion

A dozen shortcuts, autocomplete and a handful of Emmet abbreviations cover most of the typing in front-end work. Learn the shared ones first, note the few that differ between editors, and let Emmet write the repetitive markup so you can spend your attention on structure and content.

Practice While You Read

Open the HCODX editor, press F1 for the full shortcut list, and try the Emmet abbreviations above.

Open the HCODX editor โ†’