Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Customize Visual Studio Code

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:

settings.json

{
    "editor.fontFamily": "'Source Code Pro',Consolas,monospace",
    "editor.fontLigatures": true,
    "editor.rulers": [80],
    "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 defaultsauto[]
[
    {
        "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"
    },
]

Workspace Settings - Python

Python workspace .vscode/settings.json:

{
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": false,
    "python.linting.mypyEnabled": true,
    "python.linting.mypyArgs": [
        "--ignore-missing-imports",
        "--follow-imports=silent",
        "--show-column-numbers",
        "--strict"
    ],
    "python.linting.pylintEnabled": false,
    "python.linting.pylintUseMinimalCheckers": false,
    "python.testing.pytestEnabled": false,
    "python.testing.unittestArgs": [
        "-v", "-s", "./src", "-p", "*_test.py"
    ],
    "python.testing.unittestEnabled": true
}

You can tell I like unittest and mypy, not pylint and pytest.