Quick Setup
This guide walks you through setting up Sync Folds and verifying that fold states sync across your devices.Install the plugin
Follow the installation guide to install Sync Folds via Community Plugins or manual installation.The plugin requires these files in your vault:
VaultFolder/.obsidian/plugins/sync-folds/main.jsVaultFolder/.obsidian/plugins/sync-folds/manifest.json
Enable Sync Folds
After installation, enable the plugin:
- Navigate to Settings → Community Plugins
- Find “Sync Folds” in the installed plugins list
- Toggle the switch to enable it
On first load, if the plugin finds no saved fold states but detects existing folds in
localStorage, it will automatically export them to data.json. This ensures you don’t lose any existing folds.Test your first fold
Let’s verify fold syncing is working:
- Open any note with multiple sections
- Fold a heading by clicking the collapse arrow next to it
- Wait 150ms (the debounce delay)
- Check that the fold was saved:
Verify sync across devices
Now test that folds sync to another device:On Device 1 (where you just folded content):
- Ensure your sync solution has uploaded the changes
- Check the modification time on
data.jsonto confirm it was updated
- Wait for your sync solution to download the updated
data.json - If Obsidian is already open, the plugin will automatically detect the change and update
localStorage - If Obsidian is closed, open it - the plugin will import fold states on load
- Open the same note and verify the fold state matches Device 1
Available Commands
Sync Folds provides two commands for manual control:Export Folds from Local Storage
Command ID:export-fold-states
Manually exports all current fold states from localStorage to the plugin’s data.json file.
- After making many fold changes and wanting to ensure they’re saved immediately
- Before switching devices or closing Obsidian
- When troubleshooting sync issues
Import Folds into Local Storage
Command ID:import-fold-states
Manually imports fold states from data.json into localStorage, overriding any local fold states.
- After sync completes on a new device
- When fold states appear out of sync
- After manually editing
data.json - To restore fold states after clearing browser data
How Automatic Sync Works
localStorage Interception
Sync Folds works by intercepting changes tolocalStorage:
Source: main.ts:140-148
- Obsidian writes to
localStoragewith key format:{appId}-note-fold-{filePath} - The plugin’s interceptor detects the write
- After 150ms of inactivity, the change is written to
data.json - Your sync solution propagates the file change
External Change Detection
Whendata.json changes externally (from sync):
Source: main.ts:73-107
- Compares cached fold states with newly loaded states
- Removes folds that were deleted on another device
- Updates or adds folds that changed
- Updates the cache for future comparisons
Sync Solution Compatibility
Sync Folds stores data indata.json, which syncs with any file syncing solution:
Obsidian Sync
Official Obsidian sync - fully compatible
iCloud
Apple’s cloud storage - syncs the entire
.obsidian folderDropbox
Popular file sync service - fully compatible
Git
Version control - commit
data.json along with your notesSyncthing
Open-source continuous sync - fully compatible
Other Solutions
Any solution that syncs the vault folder works
No special configuration is needed. As long as your sync solution includes the
.obsidian/plugins/sync-folds/ directory, fold states will sync automatically.Best Practices
Work in Progress
Sync Folds is actively developed. Current limitations:Troubleshooting
Folds not syncing between devices
Folds not syncing between devices
- Verify the plugin is installed and enabled on both devices
- Check that
data.jsonexists and is being updated when you fold/unfold - Confirm your sync solution is syncing the
.obsidian/plugins/sync-folds/folder - Try manually running “Export folds from local storage” on Device 1, then “Import folds into local storage” on Device 2
Fold states disappeared
Fold states disappeared
- Check if
data.jsonstill contains fold data - If the file is empty or missing, restore from a backup
- If
localStoragewas cleared (e.g., browser data cleared), run “Import folds into local storage” to restore fromdata.json
Sync is slow or delayed
Sync is slow or delayed
The plugin uses a 150ms debounce to avoid excessive writes. If your sync solution has additional delays, there may be a longer gap between folding and seeing the change on another device. This is normal and expected.
Plugin not loading
Plugin not loading
- Verify
main.jsandmanifest.jsonare in the correct folder - Check that the folder is named exactly
sync-folds(matching the ID in manifest.json) - Ensure Community Plugins are enabled in Settings → Community Plugins
- Try reloading Obsidian (Ctrl/Cmd + R or restart the app)
Next Steps
Sync Setup
Learn about plugin settings and sync configuration
How It Works
Understand the technical details and architecture
Troubleshooting
Solve common issues and debug sync problems
GitHub Repository
View source code, report issues, and contribute