Skip to content

Instantly share code, notes, and snippets.

Created November 12, 2014 00:14
Show Gist options
  • Save anonymous/43876e18f7d8c9e76f30 to your computer and use it in GitHub Desktop.
Save anonymous/43876e18f7d8c9e76f30 to your computer and use it in GitHub Desktop.
{
"folders":
[
{
"file_exclude_patterns":
[
"sftp-config.json"
],
"follow_symlinks": true,
"path": "/Users/Sean/Dropbox/Sites/Dev"
}
]
}
@reywood
Copy link

reywood commented Nov 12, 2014

You'll have to figure out the package name to use, but your project file should look like this.

{
    "folders":
    [
        {
            "file_exclude_patterns":
            [
                "sftp-config.json"
            ],
            "follow_symlinks": true,
            "path": "/Users/Sean/Dropbox/Sites/Dev"
        }
    ],

    "syntax_override": {
        "\\.html$": [ "PACKAGE NAME HERE", "HTML (Twig)" ]
    }
}

Try having a look in ~/Library/Application Support/Sublime Text 3/Installed Packages to figure out what the name of the package is. Or you could try running the following command.

$ find ~/Library/Application\ Support/Sublime\ Text\ 3 -name 'HTML (Twig).tmLanguage*'

Somewhere in the resulting output should be the package name.

@shornuk
Copy link

shornuk commented Nov 12, 2014

Ah, getting there! You were right, I'd missed a comma. However I'm still getting an issue. The package name is "Craft-Twig" (this is from the file Craft-Twig.sublime-package within the 'Installed Packages' folder as you mentioned. Then under Sublime Text 3/Cache/Craft-Twig/Syntaxes/ I found the file HTML (Twig).tmLanguage.cache so that's why I'm assuming the syntax name is HTML (Twig).

Now when I enter that and save the project file, I had an error message but I missed what it said. The syntax on the files in the project is indeed set to HTML Twig, but the syntax is not highlighted? So close!

**Update: Just to add to this, I've just tried it with a different (ExpressionEngine) syntax in a different project and it's working, so perhaps it's an issue with the Craft Twig one?

@shornuk
Copy link

shornuk commented Nov 12, 2014

OK, I've just managed to get the error message showing again, and it states:

Error loading syntax file "Packages/Craft-Twig/HTML (Twig).tmLanguage": Unable to open Packages/Craft-Twig/HTML (Twig).tmLanguage

I'm wondering if its down to the fact that the HTML (Twig).tmlanguage file is within a subfolder named Syntaxes within the Craft-Twig folder.

(again these folders are all within the Sublime Text 3>Cache folder.)

@reywood
Copy link

reywood commented Nov 12, 2014

Interesting. Try the following snippet in your project file.

{
    "syntax_override": {
        "\\.html$": [ "Craft-Twig", "Syntaxes", "HTML (Twig)" ]
    }
}

@shornuk
Copy link

shornuk commented Nov 17, 2014

I've only just seen your response, apologies!
Just tried this out and it works like a charm, thank you!

@ryansnowden
Copy link

Thanks for keeping this gist alive!

@tommymarshall
Copy link

I was getting an error with @reywood's snippet, this one worked for me:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "/Users/viget/Projects/ccusa"
        }
    ],
    "syntax_override":
    {
        "\\.html$": ["Craft-Twig", "Syntaxes", "Craft-Twig"]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment