Home VS Code Shortcuts for mac
Post
Cancel

VS Code Shortcuts for mac

Here are some neat tricks and shortcuts for working with HTML, CSS, and general productivity in VS Code:

## Emmet Abbreviations (HTML & CSS)

div*5 → Creates 5 divs.

ul>li*3 → Creates a list with 3 items.

.class → Creates <div class="class"></div>

img:src → Creates an <img src=""> tag.

table>tr*2>td*3 → Creates a table with 2 rows, 3 columns.

## Multi-Cursor Editing

Cmd+D → Select next occurrence of word.

Cmd+Shift+L → Select all occurrences of word.

Cmd+Option+Down/Up → Add cursors to multiple lines.

## Quick File Navigation

Cmd+Shift+O → Go to symbol in file (e.g., functions, classes).

Cmd+P → Quick open files by name.

Command Palette

Cmd+Shift+P → Access all commands.

## Formatting

Option+Shift+F → Format document.

## Commenting

Cmd+/ → Toggle line comment.

Option+Cmd+/ → Toggle block comment.

## Duplicate Line

Shift+Option+Down/Up → Duplicate line.

## Move Line

Option+Up/Down → Move line up/down.

## Wrapping with Tag (Emmet)

Select text, type div and press Cmd+Shift+A to wrap selection in a <div>

## Rename Symbol

F2 → Rename variable, class, etc.

## Extensions for Productivity

Prettier: Auto-format code.

Live Server: Auto-refresh browser on save.

Lorem Ipsum: Insert placeholder text.

Auto Rename Tag: Renames paired HTML tags

This post is licensed under CC BY 4.0 by the author.