Is there a way to force Sublime to use a setting ONLY for a given file extension. In my specific case, I'd like to use Unix line endings on the .sh file extension.
Yes, there is, but the settings are by syntax, not file extension. First, open a .sh
file, and the syntax should automatically be set to Shell Script (Bash)
. Next, click on Preferences -> Settings-More -> Syntax Specific-User
and something like the following should appear:
{
"extensions":
[
"bash",
"zsh",
"sh",
"profile"
]
}
Change it to the following:
{
"extensions":
[
"bash",
"zsh",
"sh",
"profile"
],
"default_line_ending": "unix"
}
and save. You can follow this same general principle for any syntax, using any setting available in Preferences -> Settings-Default
.