Sublime Text 3 and CFML

For the past few weeks I have been using Sublime Text 3 as my primary editor of choice for web development. Sublime is an excellent tool for quick and easy web development, and with an active community of plugin developers, the functionality of it is expanding all the time.

Sublime Text

One the main things I love about it is the light weight syntax highlighting in the editor, and the ease of adding new languages to it. ColdFusion being one of those languages. However ColdFusion is not a very popular language, and so the support for this language is dwindling quickly. In this case, the ColdFusion syntax plugin is no longer maintained and, in the case for Sublime Text 3 on Mac, is very broken in that it does not allow for you the close an angle bracketed tags <div>. IT does not matter if its HTML, ColdFusion, or even an operator in an "if" condition, the editor will not allow you to type a ">".

So until such time as someone does a pull request to fix this issue, here is how to fix it.

How to make things work again

For Mac / Unix, open terminal

# cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ColdFusion
# nano Default.sublime-keymap 

Comment out the lines

    { "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "selector", "operator": "equal", "operand": "meta.tag"},
            { "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all":$
        ]
    },
    // Auto-close ColdFusion block tags
    { "keys": [">"], "command": "close_cftag", "context":
        [
            // selectors aren't working as I expect, we'll just use general scopes here
            { "key": "selector", "operator": "equal", "operand": "text.html.cfm, source.cfscript.c$
            { "key": "following_text", "operator": "not_regex_contains", "operand": "^>", "match_a$
        ]
    },

Save the File.