Since I work in the middle of an ongoing indentation war (you know, tabs vs. spaces) I have a need for auto-detecting the indentation mode when opening …
I'm not even sure if it's possible to hook a script into opening files, no matter how a file was opened.
On Oct 12, 2016, at 10:15, Johan Sölve <johan...@gmail.com> wrote:
Since I work in the middle of an ongoing indentation war (you know, tabs vs. spaces) I have a need for auto-detecting the indentation mode when opening …I'm not even sure if it's possible to hook a script into opening files, no matter how a file was opened.Hey Johan,Look for “Document attachment points” in the BBEdit manual and “documentDidOpen”.
[...]
I've done stuff like this before and don't really recommend it as an automated process. I've had too many instances where something fairly critical got changed unexpectedly.
I work on different projects with their own conventions, so I face similar challeneges. One thing that has helped has been convincing people to use EditorConfig, which BBEdit and most IDEs and editors support. It allows you to configure indentation formats for different languages, so they can use two-space indenting for YAML and 4 spaces for JavaScript. So you can leave your global defaults set to your own preferences and still comply with the arbitrary and often hare-brained demands of the people you sometimes have to work with.