Syntax Specific Key Bindings in Sublime Text

I wanted to remap one of the key bindings for selecting a paragraph / expanding the current selection – but just in the Ruby syntax. Here’s what I added to my `Default (OSX).sublime-keymap` file:

// when using ruby syntax, set cmd+shift+b to run “expand selection to indentation (or paragraph)”
{

“keys”: [“super+shift+b”],
“command”: “expand_selection”,
“context”: [ { “key”: “selector”, “operator”: “equal”, “operand”: “source.ruby” } ],
“args”: {“to”: “indentation”}
// “args”: {“to”: “paragraph”}

},

// when not using ruby, set that shortcut to “expand selection”
{

“keys”: [“super+shift+b”],
“command”: “expand_selection”,
“context”: [ { “key”: “selector”, “operator”: “not_equal”, “operand”: “source.ruby” } ],
“args”: {“to”: “scope”}

},

Related Posts:

  • No Related Posts
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *