Justin Carter's madfellas.com

Sublime Text 2 key bindings for CFML Developers

One of the first things I did when I started using Sumblime Text 2 was to set up some key bindings to emulate functionality that I was used to using in CFEclipse / CFBuilder 1. These were the usual keyboard shortcuts for inserting or wrapping selections in code like CFDUMP, CFOUTPUT, hashes, comments, etc.

To set up your own user key bindings, choose Preferences -> Key bindings - User from the menu. The configuration is an array of JSON objects, so remember to put your comma's in the right places :)

Here's my current ColdFusion / CFML related key bindings which you might find useful.

 

[
// cf tags
//
	// cfabort
	{ "keys": ["ctrl+shift+a"], "command": "insert_snippet", "args": {"contents": "<cfabort>" } },
	// cfdump
	{ "keys": ["ctrl+shift+d"], "command": "insert_snippet", "args": {"contents": "<cfdump var="#${0:$SELECTION}#">" } },
	// cfoutput
	{ "keys": ["ctrl+shift+o"], "command": "insert_snippet", "args": {"contents": "<cfoutput>${0:$SELECTION}</cfoutput>" } },
// wrappers
//
	// hash
	{ "keys": ["ctrl+shift+h"], "command": "insert_snippet", "args": {"contents": "#${0:$SELECTION}#" } },
	// single line comment
	{ "keys": ["ctrl+shift+m"], "command": "insert_snippet", "args": {"contents": "<!--- ${0:$SELECTION} --->" }, "context": 
		[
			{ "key": "text", "operator": "not_regex_contains", "operand": "
" }
		]
	},
	// multi line comment
	{ "keys": ["ctrl+shift+m"], "command": "insert_snippet", "args": {"contents": "<!--- 
${0:$SELECTION} --->
" }, "context": 
		[
			{ "key": "text", "operator": "regex_contains", "operand": "
" }
		]
	},
// remap sublime text defaults
//
	{ "keys": ["ctrl+alt+d"], "command": "duplicate_line" },
	{ "keys": ["ctrl+alt+m"], "command": "expand_selection", "args": {"to": "brackets"} }
]