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
| Action | HCODX editor | VS Code (Windows, Linux) | VS Code (macOS) |
|---|---|---|---|
| Open a file by name | Ctrl+P | Ctrl+P | Cmd+P |
| Command palette | Ctrl+Shift+P | Ctrl+Shift+P | Cmd+Shift+P |
| Toggle comment | Ctrl+/ | Ctrl+/ | Cmd+/ |
| Move line up or down | Alt+โ / โ | Alt+โ / โ | Option+โ / โ |
| Copy line down | Shift+Alt+โ | Shift+Alt+โ | Shift+Option+โ |
| Add a cursor on the line below | Ctrl+Alt+โ | Ctrl+Alt+โ | Option+Cmd+โ |
| Go to line | Ctrl+G | Ctrl+G | Ctrl+G |
| Find / replace | Ctrl+F / Ctrl+H | Ctrl+F / Ctrl+H | Cmd+F / Option+Cmd+F |
| Show suggestions | Ctrl+Space | Ctrl+Space | Ctrl+Space |
| Format the file | Ctrl+Shift+F (opens format options) | Shift+Alt+F | Shift+Option+F |
| Delete the current line | Ctrl+D | Ctrl+Shift+K | Shift+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.
| Action | Shortcut |
|---|---|
| Show or hide the live preview | Alt+P |
| Split view: code and preview side by side | Alt+S |
| Show or hide the file explorer | Ctrl+B |
| Check the HTML (validation panel) | Ctrl+Shift+V |
| Minify the file | Ctrl+Shift+M |
| Export the project | Ctrl+E |
| Editor settings (font, keymap, Emmet) | F2 |
| List every shortcut | F1 |
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:
| Type | You get |
|---|---|
ul>li*3 | A <ul> containing three empty <li> elements |
nav>a[href=#]*3 | A <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.
| Action | Windows, Linux | macOS |
|---|---|---|
| Open DevTools | F12 or Ctrl+Shift+I | Cmd+Option+I |
| Pick an element to inspect | Ctrl+Shift+C | Cmd+Shift+C |
| Open the console (Chrome, Edge) | Ctrl+Shift+J | Cmd+Option+J |
| Open the console (Firefox) | Ctrl+Shift+K | Cmd+Option+K |
| Device or responsive mode | Ctrl+Shift+M | Cmd+Shift+M (Firefox: Cmd+Option+M) |
| Reload, ignoring the cache | Ctrl+Shift+R | Cmd+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.
Related Articles
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 โ