You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS Code Trix - Bash Script (Windows) to Save Settings (Settings, Keybindings, Extensions List)
Path to the VS Code settings directory π
VSCODE_SETTINGS_DIR="$APPDATA/Code/User"
Create backup directory if it doesn't exist π
BACKUP_DIR="$HOME/vscode_settings_backup"
if [ ! -d "$BACKUP_DIR" ]; then
mkdir "$BACKUP_DIR"
fi
Save β¨ extensions list to a file
EXTENSIONS_FILE="$BACKUP_DIR/extensions.txt"
code --list-extensions > "$EXTENSIONS_FILE"
echo "Extensions list saved to $EXTENSIONS_FILE"
Save π‘ settings JSON to a file
SETTINGS_FILE="$BACKUP_DIR/settings.json"
if [ -f "$VSCODE_SETTINGS_DIR/settings.json" ]; then
cp "$VSCODE_SETTINGS_DIR/settings.json" "$SETTINGS_FILE"
echo "Settings JSON saved to $SETTINGS_FILE"
else
echo "Error: Could not find settings.json in $VSCODE_SETTINGS_DIR"
ERRORS=true
fi
Save π keybindings JSON to a file
KEYBINDINGS_FILE="$BACKUP_DIR/keybindings.json"
if [ -f "$VSCODE_SETTINGS_DIR/keybindings.json" ]; then
cp "$VSCODE_SETTINGS_DIR/keybindings.json" "$KEYBINDINGS_FILE"
echo "Keybindings JSON saved to $KEYBINDINGS_FILE"
else
echo "Error: Could not find keybindings.json in $VSCODE_SETTINGS_DIR"
ERRORS=true
fi
Print final message if no errors occurred β
if [ "$ERRORS" = true ]; then
echo "Some errors occurred during the backup process."
else
echo "VS Code settings saved!"
fi
Note: Bash comments should look like this:
# Sorry about the markdown formatting lol
π€ SJRXD