Skip to content

VS Code - Visual Studio Code

Visual Studio Code - Code Editing. Redefined (code.visualstudio.com)

Pages

Usage

Handy commands

Open something in a new window: code -n foobar Add folder to workspace: code --add . Diff from last save: Ctrl-K-D

Install

Configure

File locations:

  • ~/.config/Code/User
  • ~/.config/Code/Workspaces
  • ~/.vscode
    • argv.json : pass permanent command line arguments to VS Code.
    • extensions: your extensions live here

View the default values in the Settings editor or see a read-only version of the defaultSettings.json via Preferences: Open Default Settings (JSON)

My preferred settings:

Setting ID Value Comment
git.rebaseWhenSync true Always use rebase instead of merge when running.
files.insertFinalNewline true Insert final newline into file when saving

Terminal settings

Keyboard Shortcuts - Default

CTRL-m: View: Toggle Maximised Panel

Annoyance: Tab Key Moves Focus

This breaks shell completion in terminal if it's enabled

Terminal › Integrated: Allow Chords

  • Make things like `CTRL-L`` work.

Whether or not to allow chord keybindings in the terminal. Note that when this is true and the keystroke results in a chord it will bypass Terminal › Integrated: Commands To Skip Shell, setting this to false is particularly useful when you want ctrl+k to go to your shell (not VS Code).

shebang

"shellcheck.arguments": [
    "--format=gcc",
    "--severity=warning",
    "--shell=bash",
    "--external-sources",
    "--enable=all",
    "--shebang=#!/usr/bin/env bash"
],

Shortcuts

Ctrl-p-p: Go back to previous file
CTRL+ALT+-: Go back

GUI

Open two terminals with horizontal split:

  • Open a first terminal
  • Open a second one
  • Right click a terminal and select "move to editor area"

Troubleshooting

.gitignore from different folders respected

File watchers

Check your watcher limits, current usage and how to increase the limits for inotify

Maybe exclude some from vscode watchers:
```json
"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true
  }

See also