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"} }
]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Are you maintaining your package on GitHub? That is, is there somewhere simple we can get all this magic with minimal effort.
# Posted By Geoff Bowers | 10/23/11 4:26 PM
I've added a Gist on GitHub for this config, I just didn't embed the Gist here because the embed looks terrible :)

https://gist.github.com/1306983
# Posted By Justin Carter | 10/23/11 5:08 PM



If you subscribe, any new posts to this thread will be sent to your email address.