EditorConfig

Yesterday, I lamented the limitations of BBEdit’s Dropbox sync:

I wish there was a way to sync language-specific settings for BBEdit via Dropbox.

Specifically, I wanted to sync my soft-wrap settings for Markdown files. My main need for this is in editing the text files that drive this blog1. Yes, this is a trivial problem; it’s one checkbox in BBEdit’s Preferences Pane. It would be easy to recreate on both of my computers. It would be easier still if the preference would sync.

@daiwei replied on Micro.blog with an interesting idea:

If you know where the settings you want to synchronise are stored, simply copy that file(s) to where you want them on Dropbox, and symlink it/them?

I haven’t tried this, and I’m afraid of what might happen if I were to have BBEdit open on both computers at the same time. Maybe I’d just end up with conflicted copy files from Dropbox, but BBEdit’s release notes specifically call this out as unsupported:

The system does not support relocation of the core preferences data file (~/Library/Preferences/com.barebones.bbedit.plist), so you won’t be able to synchronize preference settings.

The BBEdit support team replied to me on Twitter, and offered a solution I was completely unfamiliar with:

Apparently, BBEdit natively supports EditorConfig files. EditorConfig files are used to enforce consistent configurations across editors for a given project, and they’re fairly widely supported. While soft-wrap settings aren’t part of the core properties, BBEdit has defined BBEdit-specific keys, including x-soft-wrap-text, x-soft-wrap-mode, and x-soft-wrap-limit.

Based on this, I created an .editorconfig file in the root directory of the files for this blog, that only contains one key:

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Soft-wrap every markdown file (in BBEdit only)
[*.md]
x-soft-wrap-text: 1

Now, if I ever forget to enable soft-wrap as a language-specific setting in BBEdit on a new machine, this file will override the global setting and enable soft-wrapping. I’ll still have to deal with this for files in other directories, but this will cover 90% of my use cases.


  1. I’m still publishing this site using Dr. Drang’s WP-MD tools.