Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Setting Up Visual Studio Code

Quick Tips

25 VS Code Productivity Tips and Speed Hacks

Font

I really like Source Code Pro by Adobe.

User Settings

Depending on the platform, the user settings are stored in settings.json in the following directory:

OS Path
Windows %APPDATA%\Code\User\, where %APPDATA% is usually C:\Users\_username_\AppData\Roaming
MacOS /Users/_username_/Library/Application Support/Code/User/
Linux ~/.config/Code/User/

settings.json

{
    "editor.fontFamily": "'Source Code Pro',Consolas,monospace",
    "editor.fontLigatures": true,
    "editor.rulers": [80],
    "editor.wordWrap": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "git.autofetch": true,
    "git.confirmSync": false,
    "git.enableSmartCommit": true,
    "security.workspace.trust.untrustedFiles": "newWindow",
    "terminal.integrated.scrollback": 10000,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    }
}

On Windows I also have:

    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Ubuntu-22.04 (WSL)": {
            "path": "C:\\WINDOWS\\System32\\wsl.exe",
            "args": [
                "-d",
                "Ubuntu-22.04"
            ]
        }
    },
    "terminal.integrated.defaultProfile.windows": "Ubuntu-22.04 (WSL)",

keybindings.json

On Windows:

// Place your key bindings in this file to override the defaults
[
    {
        "key": "ctrl+d",
        "command": "-editor.action.addSelectionToNextFindMatch",
        "when": "editorFocus"
    },
    {
        "key": "ctrl+d",
        "command": "deleteRight",
        "when": "editorFocus"
    }
]

On MacOS:

[
    { "key": "ctrl+z",       "command": "undo" },
    { "key": "ctrl+a",       "command": "editor.action.selectAll" },
    { "key": "ctrl+c",       "command": "execCopy" },
    { "key": "ctrl+x",       "command": "execCut" },
    { "key": "ctrl+v",       "command": "execPaste" },
    { "key": "alt+ctrl+s",   "command": "saveAll" },
    { "key": "ctrl+s",       "command": "workbench.action.files.save" },
    { "key": "shift+ctrl+s", "command": "workbench.action.files.saveAs" },
    { "key": "shift+ctrl+s", "command": "workbench.action.files.saveLocalFile",
      "when": "remoteFileDialogVisible" },
    { "key": "ctrl+f",
      "command": "actions.find",
      "when": "editorFocus || editorIsOpen"
    },
    {
      "key": "ctrl+left",
      "command": "cursorWordLeft",
      "when": "textInputFocus"
    },
    {
      "key": "ctrl+right",
      "command": "cursorWordRight",
      "when": "textInputFocus"
    },
    {
      "key": "ctrl+shift+left",
      "command": "cursorWordLeftSelect",
      "when": "textInputFocus"
    },
    {
      "key": "ctrl+shift+right",
      "command": "cursorWordRightSelect",
      "when": "textInputFocus"
    }
]

Standard Keyboard Bindings

Command Palette

Char Accelerator Description
  Ctrl+P Navigate to a file or symbol by name
> Ctrl+Shift+P Show and run commands
@ Ctrl+Shift+O Navigate to a specific symbol in a file
: Ctrl+G Goto a line in a file
? n/a Get help

Extensions

Using

VSCode Variables Reference