Skip to content

Instantly share code, notes, and snippets.

@Enteleform
Last active April 22, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Enteleform/22c5ba85ea7a44b391f4726b140a6050 to your computer and use it in GitHub Desktop.
Save Enteleform/22c5ba85ea7a44b391f4726b140a6050 to your computer and use it in GitHub Desktop.

Install:


Add this key-binding:

// delete surrounding spaces if they exist
{
	"keys": [ "shift+backspace" ],
	"command": "chain",
	"context": [
		{ "key": "preceding_text", "operator": "regex_match", "operand": ".*\\S " },
		{ "key": "following_text", "operator": "regex_match", "operand": " \\S.*" },
	],
	"args": { "commands": [
		[ "left_delete" ],
		[ "right_delete" ],
] } },

// otherwise do nothing
  // ( this is optional. I personally sometimes hold shift while I'm typing & deleting,
  //   so I prefer `shift+backspace` to function the same as `backspace`. )
{
	"keys": [ "shift+backspace" ],
	"command": "_____NULL_____",
	"context": [ { "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\S ", "match_all": true } ]
},
{
	"keys": [ "shift+backspace" ],
	"command": "_____NULL_____",
	"context": [ { "key": "following_text", "operator": "not_regex_match", "operand": " \\S.*", "match_all": true } ]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment