I\'d like to be able to sync my VS Code user settings (File > Preferences > User Settings) to the cloud somehow so I can easily share them between multiple installatio
Use workspace-settings instead of user-settings.
User Settings
There is currently no automatic synchronization for user settings available in Visual Studio Code.
On Windows the user settings are located in %APPDATA%\Code\User\settings.json
. You could save a copy of that file on OneDrive or Dropbox and move it on all your machines to the user settings folder. But this still includes manual steps on each machine every time you change the configuration.
You can suggest an automatic synchronization of settings here: https://visualstudio.uservoice.com/forums/293070-visual-studio-code
Workspace Settings
Add the .vscode
folder of your workspace to the version control system (Git/SVN etc). When you checkout the code from the repository you will automatically get the VS Code workspace settings.
Another way of doing it would be to soft link your files, which can also be stored in a repository on GitHub. For example, on Mac OS let's say you have a directory called ~/dev/dotfiles/vscode
. Let's say there are two files in there called settings.json
and keybindings.json
. You could soft link these files with:
ln -s ~/dev/dotfiles/vscode/keybindings.json ~/Library/Application\ Support/Code/User/keybindings.json
ln -s ~/dev/dotfiles/vscode/settings.json ~/Library/Application\ Support/Code/User/settings.json
If you are using Windows or Linux the path to the respective settings directories can be found at https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations
You can make a hard link from the directory containing user settings to your sync directory of applications such as Dropbox or OneDrive.
For example, on windows, the user settings are located in %APPDATA%\Code\User
, so you could type:
mklink /H /J X:\Your\Sync\Dir %APPDATA%\Code\User
on your computers with Visual Studio Code to achieve the synchronization.
Then, on another computer, you may delete the %APPDATA%\Code\User
folder, and type:
mklink /H /J %APPDATA%\Code\User X:\Your\Sync\Dir
to retrieve the synchronized settings.
I did this on my Mac by copying VS Code's settings.json
to my iCloud drive for automatic backup, and then creating a symbolic link.
settings.json
from VS code settings directory $HOME/Library/Application Support/Code/User/settings.json
to your backup locationsettings.json
by renaming to settings-old.json
cd
to VS code setting dir: cd ~/Library/Application\ Support/Code/User/
ln -sf path/to/backup/settings.json settings.json
. Since I backed mine up to iCloud and renamed the file to vscode.settings.json
, my command looked like this: ln -sf ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode.settings.json settings.json
To use the backup on a different Mac, just repeat steps 2-5.
I also did this for extensions...
cd ~/.vscode/
mkdir ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode/
cp -a extensions ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode
mv extensions extensions-old
ln -sf ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode/extensions extensions
This is finally a built-in feature: see Settings Sync in Visual Studio Code.