351

How is it possible to export all Visual Studio Code settings and plugins and import them to another machine?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
kagarlickij
  • 6,076
  • 4
  • 29
  • 58
  • 2
    For reference, Code offers a [portable mode](https://code.visualstudio.com/docs/editor/portable) so you can just move the installation folder. – Doruk Karınca Aug 18 '19 at 00:25
  • There is currently an open feature request issue that appears to be in the design proposal phase. I am going to wait for this official support. You can subscribe to the issue and get notifications on the progress. https://github.com/microsoft/vscode/issues/2743#issuecomment-560116420 – King Holly Dec 20 '19 at 19:46

11 Answers11

428

With the current version of Visual Studio Code as of this writing (1.22.1), you can find your settings in

  • ~/.config/Code/User on Linux (in my case, an, Ubuntu derivative)
  • %APPDATA%\Code\User (C:\Users\username\AppData\Roaming\Code\User) on Windows
  • ~/Library/Application Support/Code/User/ on Mac OS X (thank you, Christophe De Troyer)

The files are settings.json and keybindings.json. Simply copy them to the target machine.

Your extensions are in

  • ~/.vscode/extensions on Linux and Mac OS X
  • %USERPROFILE%\.vscode\extensions (C:\Users\username\.vscode\extensions) on Windows (i.e., essentially the same place as on Linux and Mac OS X)

Alternately, just go to the Extensions, show installed extensions, and install those on your target installation. For me, copying the extensions worked just fine, but it may be extension-specific, particularly if moving between platforms, depending on what the extension does.

T.J. Crowder
  • 959,406
  • 173
  • 1,780
  • 1,769
  • 14
    %APPDATA%\Code, %USERPROFILE%\.vscode\extensions – Mahn May 26 '20 at 00:46
  • @zerohedge I expect the workspace specific settings are in the `.workspace` file, or in the `.vscode/settings.json` – Maarten Fabré May 28 '20 at 08:14
  • Great answer! I'd create 2 folders: (1) ~/.vscode/extensions and (2) ~/.vscode/settings. Then I'd create symlinks to the paths in your answer according to the specific OS. Once it's done, I just put my ~/ folder under version control. Like this, I keep my dotfiles and vscode config all in one repo. – asa Nov 30 '20 at 19:08
  • Thanks a lot for your time and effort! – Ahmed Mahmoud Feb 19 '21 at 15:02
221

There is an extension for Visual Studio Code, called Settings Sync.

It synchronises your settings by gist (Gist by GitHub). It works the same as the Atom.io extension called settings-sync.

UPDATE:

This feature is now build in VS Code, it is worth to switch to official feature. (https://stackoverflow.com/a/64035356/2029818)

You can now sync all your settings across devices with VSCode's built-in Settings Sync. It's found under Code > Preferences > Turn on Settings Sync...

michalczukm
  • 9,247
  • 5
  • 37
  • 47
  • 50
    Is this really an export? I would export an export workflow to generate a file or set of files containing settings in some directory - not rely on third party services and underlying setup. – Élie Apr 05 '17 at 23:33
  • 1
    Of course you can do it. The external package isn't necessary, but it keeps your packages sync between more VSC instances (by instances I mean multiple instalations) – michalczukm Apr 06 '17 at 07:55
  • 4
    That extension did not work for me at all. It just gives "Error not found" when you try to import the settings to another computer, and I followed the instructions to the letter. Be careful if you decide to use this. – dcp Aug 09 '17 at 13:35
  • 1
    @dcp this is due to invalid gist id, you can open issue to let the author know – Shan Khan Aug 20 '17 at 20:46
  • can I copy settings without running the old version, just having the access to the disk where it was installed? – Kostanos May 13 '20 at 12:05
  • Just to point out the next reply is worth looking. More upvotes than the chosen one! :) – Paiusco Aug 08 '20 at 22:03
  • 2
    vscode now has settings sync built-in but just a PSA on this answer -- do not use this. your settings may contain secrets and gist is **public**. – Cory Mawhorter Nov 07 '20 at 17:37
  • As Cory mentioned this is built-in now. See Ole August Støle's answer below... – m.spyratos Nov 16 '20 at 15:45
  • Now I'm also using build in feature :) I've added update to my response. Thx for pointing that out! – michalczukm Nov 18 '20 at 12:17
57

Similar to the answer given by Big Rich you can do the following:

$ code --list-extensions | xargs -L 1 echo code --install-extension

This will list out your extensions with the command to install them so you can just copy and paste the entire output into your other machine:

Example:

code --install-extension EditorConfig.EditorConfig
code --install-extension aaron-bond.better-comments
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension CoenraadS.bracket-pair-colorizer

It is taken from the answer given here.

Note: Make sure you have added VS Code to your path beforehand. On mac you can do the following:

  1. Launch Visual Studio Code
  2. Open the Command Palette ( + + P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Daniel Douglas
  • 2,976
  • 1
  • 15
  • 16
  • 3
    For PS users: something like `code --list-extensions | %{"code --install-extension $($_)"}` – stijn Jul 07 '20 at 10:50
  • 1
    For a plain cmd use `code --list-extensions>extlist` on a source PC and `for /f %f in (extlist) do code --install-extension %f` on a target PC. Where `extlist` is a file with extensions' names. – montonero Aug 02 '20 at 14:37
  • 1
    For the rest of us (Linux and Windows), it is Shift + Ctrl + P for the Command Palette. – Peter Mortensen Aug 29 '20 at 01:59
48

For posterity, this post mentions,

in the latest release of Visual Studio Code (May 2016) it is now possible to list the installed extension in the command line

code --list-extensions

On Mac, execute something like:

"/Applications/Visual Studio Code.app//Contents/Resources/app/bin/code" --list-extensions

To install, use:

--install-extension <ext> //see 'code --help'
Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Big Rich
  • 5,657
  • 38
  • 61
39

You can now synchronise all your settings across devices with Visual Studio Code's built-in Settings Sync. It's found under menu FilePreferencesTurn on Settings Sync...

Read more about it in the official documentation here.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
11

Your user settings are in ~/Library/Application\ Support/Code/User.

If you're not concerned about synchronising and it's a one-time thing, you can just copy the files keybindings.json and settings.json to the corresponding folder on your new machine.

Your extensions are in the ~/.vscode folder. Most extensions aren't using any native bindings and they should be working properly when copied over. You can manually reinstall those who do not.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Kamagatos
  • 806
  • 9
  • 12
5

I'm preferred my own way to synchronize all Visual Studio Code extensions between laptops, using .dotfiles and small script to perform updates automatically. This way helps me every time when I want to install all extensions I have without any single mouse activity in Visual Studio Code after installing (via Homebrew).

So I just write each new added extension to .txt file stored at my .dotfiles folder. After that I pull master branch on another laptop to get up-to-date file with all extensions.

Using the script, which Big Rich had written before, with one more change, I can totally synchronise all extensions almost automatically.

Script

cat dart-extensions.txt | xargs -L 1 code --install-extension

And also there is one more way to automate that process. Here you can add a script which looks up a Visual Studio Code extension in realtime and each time when you take a diff between the code --list-extensions command and your .txt file in .dotfiles, you can easily update your file and push it to your remote repository.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
hamsternik
  • 1,296
  • 3
  • 17
  • 25
2

I've made a Python script for exporting Visual Studio Code settings into a single ZIP file:

https://gist.github.com/wonderbeyond/661c686b64cb0cabb77a43b49b16b26e

You can upload the ZIP file to external storage.

$ vsc-settings.py export
Exporting vsc settings:
created a temporary dump dir /tmp/tmpf88wo142
generating extensions list
copying /home/wonder/.config/Code/User/settings.json
copying /home/wonder/.config/Code/User/keybindings.json
copying /home/wonder/.config/Code/User/projects.json
copying /home/wonder/.config/Code/User/snippets
  adding: snippets/ (stored 0%)
  adding: snippets/go.json (deflated 56%)
  adding: projects.json (deflated 67%)
  adding: extensions.txt (deflated 40%)
  adding: keybindings.json (deflated 81%)
  adding: settings.json (deflated 59%)
VSC settings exported into /home/wonder/vsc-settings-2019-02-25-171337.zip

$ unzip -l /home/wonder/vsc-settings-2019-02-25-171337.zip
Archive:  /home/wonder/vsc-settings-2019-02-25-171337.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2019-02-25 17:13   snippets/
      942  2019-02-25 17:13   snippets/go.json
      519  2019-02-25 17:13   projects.json
      471  2019-02-25 17:13   extensions.txt
     2429  2019-02-25 17:13   keybindings.json
     2224  2019-02-25 17:13   settings.json
---------                     -------
     6585                     6 files

PS: You may implement the vsc-settings.py import subcommand for me.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
wonder
  • 481
  • 4
  • 10
2

Enable portable mode: Portable Mode

Summary:

Portable Mode instructs Visual Studio Code to store all its configuration and plugins in a specific directory (called data/ in Windows and Linux and code-portable-data in macOS).

At any time you could copy the data directory and copy it on another installation.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
0

Often there are questions about the Java settings in Visual Studio Code. This is a big question and can involve advanced user knowledge to accomplish. But there is simple way to get the existing Java settings from Visual Studio Code and copy these setting for use on another PC. This post is using recent versions of Visual Studio Code and JDK in mid-December 2020.

There are several screen shots (below) that accompany this post which should provide enough information for the visual learners.

First things first, open Visual Studio Code and either open an existing Java folder-file or create a new Java file in Visual Studio Code. Then look at the lower right corner of Visual Studio Code (on the blue command bar). The Visual Studio Code should be displaying an icon showing the version of the Java Standard Edition (Java SE) being used. The version being on this PC today is JavaSE-15. (link 1)

Click on that icon (JAVASE-15) which then opens a new window named "java.configuration.runtimes". There should be two tabs below this name: User and Workspace. Below these tabs is a link named, "Edit in settings.json". Click on that link. (Link 2)

Two json files should then open: Default settings and settings.json. This post only focuses on the "settings.json" file.

The settings.json file shows various settings used for coding different programming languages (Python, R, and Java). Near the bottom of the settings.json file shows the settings this User uses in Visual Studio Code for programming Java.

These Java settings are the settings that can be "backed up" - meaning these settings get copied and pasted to another PC for creating a Java programming environment similar to the Java programming environment on this PC. (Link 3)

Link 1

Link 2

Link 3

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Gray
  • 883
  • 8
  • 20
0

I did this (Linux)

$ code --list-extensions | xargs -L 1 echo code --install-extension > codeExtensions.sh

I then ran the script on the target machine.

leoplaw
  • 31
  • 6