# Keyboard shortcuts in VS Code and the terminal

Keyboard shortcuts help you work faster and give you a better overview of what your AI assistant is doing. This guide accompanies *Installing Visual Studio Code*.

## Start by remembering just one

**Ctrl+Shift+P

## Navigate

| What | Windows / Linux | Mac |
|---|---|---|
| Open file by name | Ctrl+P | Cmd+P |
| Go to line | Ctrl+G | Ctrl+G |
| Go to the definition | F12 | F12 |
| Search all files | Ctrl+Shift+F | Cmd+Shift+F |
| Search this file | Ctrl+F | Cmd+F |
| Sidebar on/off | Ctrl+B | Cmd+B |
| Terminal on/off | Ctrl+` | Ctrl+` |

## Edit

| What | Windows / Linux | Mac |
|---|---|---|
| Select the next matching word as well | Ctrl+D | Cmd+D |
| Extra cursor above/below | Ctrl+Alt+↑/↓ | Option+Cmd+↑/↓ |
| Additional cursor where you click | Alt+click | Option+click |
| Move line up/down | Alt+↑/↓ | Option+↑/↓ |
| Copy line up/down | Shift+Alt+↑/↓ | Shift+Option+↑/↓ |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Delete previous word | Ctrl+Backspace | Option+Backspace |
| Go to the start/end of the line | Home / End | Cmd+← / → |
| Show/hide comments | Ctrl+/ | Cmd+/ |
| Format document neatly | Shift+Alt+F | Shift+Option+F |
| Show suggestions | Ctrl+Space | Ctrl+Space |
| Save all | Ctrl+K, then S | Option+Cmd+S |

## Improve the code

| What | Windows / Linux | Mac |
|---|---|---|
| Quick fixes / actions (including ‘Extract method’) | Ctrl+. | Cmd+. |
| Change name everywhere | F2 | F2 |

## Debugging

| What | Test |
|---|---|
| Breakpoint on/off | F9 |
| Start / Continue | F5 |
| Skip | F10 |
| Step in | F11 |
| Exit | Shift+F11 |

## Customising keyboard shortcuts

Ctrl+K, Ctrl+S (Mac: Cmd+K, Cmd+S) opens the list of all keyboard shortcuts. Find a command, double-click it and enter your own shortcut combination.

## Inside the terminal

| What | Test |
|---|---|
| Stop running command | Ctrl+C |
| Clear screen | Ctrl+L |
| Search previous commands | Ctrl+R |
| Previous command | ↑ |

## Stuck in Vim?

Sometimes Git opens an editor called **Vim**, for example when you make a commit or perform a rebase. Here’s how to close it:

1. Press **Esc**.
2. Type `:wq`**

Would you like Git to use VS Code from now on?

```bash
git config --global core.editor "code --wait"
```

A few Vim shortcuts you might come across: `gg` (move up), `G` (move down), `dd` (delete line), `yy` (copy line), `p` (paste), `ciw` (replace word), `u` (undo).

## Tip for your AI assistant

With the **editor-shortcuts** skill, your assistant can provide you with the correct keyboard shortcut for your system, or set up a custom shortcut for you.

## Skills

- [Editor shortcuts (VS Code / Cursor and Vim)] (/nl/skills/editor-shortcuts)

