Skip to content
Brian Mayo edited this page Oct 9, 2018 · 17 revisions

Since v3.2

VS Code Settings Sync supports per-os and per-host inline settings. Keywords: "@sync", "@sync-ignore", "os", "host", "env".

Per host settings

Apply settings only if it matches with the hostName

hostName must be set in syncLocalSettings.json. More info here

Usage:

  // @sync host=Laptop
  "window.zoomLevel": 1

Per OS settings

Suported OS values: linux, windows, mac. Usage:

  // @sync os=linux
  "window.zoomLevel": 1

ENV variables

Settings will apply if the env variable is defined in process.env. See more at node process. Usage:

  // @sync env=ENV_VAR
  "window.zoomLevel": 1

Ignore settings

You can disable upload/download of specific settings using @sync-ignore:

  // @sync-ignore
  "window.zoomLevel": 1 

Examples:

  // @sync os=linux host=Laptop
  "window.zoomLevel": 1,

  // @sync host=PC
  "window.zoomLevel": 2,

  // @sync os=linux host=Laptop env=ENV_CUSTOM
  "window.zoomLevel": 3,

  // @sync os=linux env=WORK
  "window.zoomLevel": 3,

  // @sync-ignore
  "editor.renderIndentGuides": false

How it works?

Before uploading your settings.json all the settings with inline pragmas are uncommented. Then, when your settings are synchronized, all the settings values with pragmas that don't match with your machine (OS, hostName or ENV variables) will be commented. Therefore VS Code won't apply them.