Skip to content

Instantly share code, notes, and snippets.

@DevWL
Last active August 2, 2020 22:01
Show Gist options
  • Save DevWL/d16ec89aefba7eb177889260b4ba4dc4 to your computer and use it in GitHub Desktop.
Save DevWL/d16ec89aefba7eb177889260b4ba4dc4 to your computer and use it in GitHub Desktop.
VS CODE - backup extensions and settings
// Grab settingss from:
// Windows %APPDATA%\Code\User\settings.json
// macOS $HOME/Library/Application Support/Code/User/settings.json
// Linux $HOME/.config/Code/User/settings.json
// now in terminal get list of extenssion (you might want to see verion too for that add "--show-versions" to the line below)
$ code --list-extensions
bmewburn.vscode-intelephense-client
calebporzio.better-phpunit
CoenraadS.bracket-pair-colorizer-2
damianbal.php-class-generator-composer-psr-4
danilopolani.yet-another-phpunit
dbaeumer.vscode-eslint
dsznajder.es7-react-js-snippets
emallin.phpunit
felixfbecker.php-debug
felixfbecker.php-pack
hakcorp.php-awesome-snippets
ms-azuretools.vscode-docker
naumovs.color-highlight
neilbrayfield.php-docblocker
onecentlin.phpunit-snippets
pranaygp.vscode-css-peek
remimarsal.prettier-now
ritwickdey.LiveServer
// install extension using
code --install-extension (<extension-id> | <extension-vsix-path>)
Installs an extension.
// Batch aproach
// You might also save list of extension to a separate file and make a bach install using something like:
You can now list all extensions installed so the way to install that list of extensions would be to:
code --list-extensions >> vs_code_extensions_list.txt
Transfer the newly created file to the machine that you want to install those extensions to. On that machine you would:
cat vs_code_extensions_list.txt | xargs -n 1 code --install-extension
Which will then go through each extension in that file and install the extension.
If you want a clean install (AKA remove all existing extensions on that machine) you could run this before you install the new extensions (otherwise you will remove those new extensions too). BE CAREFUL as this will remove all extensions in VS Code:
code --list-extensions | xargs -n 1 code --uninstall-extension
Tried, got this error message: "xargs : The term 'xargs' is not recognized as the name of a cmdlet, function, script file, or operable program." ? – Nicholas Petersen Jul 15 '19 at 18:44
2 That's for Linux. On windows: get-content c:\exportedlist.txt | % { code --install-extension $_ }
Just remember to also backup settings...
%APPDATA%\Code\User\settings.json >> vsc-settings.txt
and copy them to new settings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment