sublimetextspell-checking

Add file-specific words to Sublime Text spell checking


If I use a certain (made-up) word only in a particular file. Is there a way to add it to the dictionary of just that particular file with Sublime Text?


Solution

  • Updated 23 Jan 23

    Unfortunately not. You can use the added_words setting to include your special word in the dictionary:

    {
        // ...
        "added_words": [
            "Bandersnatch"
        ]
    }
    

    But this is an application-wide setting, and it's not consulted in the project or user setting scopes.

    But if you put that in your user settings, it will apply in all files. To be more precise, you can use Projects. Create a project file, then make sure you open your project using the Projects > Open Project… menu item. In there, you can put the added_words setting in the settings object:

    {
        "folders":
        [
            {
                "path": "."
            }
        ],
        "settings":
        {
            "added_words": ["Bandersnatch"]
        },
    }
    

    This will apply the setting to just a single window, but it will be all files in that window. You can tailor the project (using the folders key) so that it only displays the one file, but that may be too restrictive.

    Depending on the different file types you edit, it may be possible to tailor the spelling_selector to uniquely identify this one file. In fact, if you wrote a syntax which applied a scope (which you could inherit from the real scope) to any file with the exact name your file has, then you'd be able to apply spelling only to that file using spelling_selector. However, I think this would turn off spelling for all other files, which is probably not what you want either.