I've got an item on the todo list to allow regex matches for contexts, which would do what you want for autocomplete, something like:
- Code: Select all
<binding key="tab" command="insertAndDecode \t">
<context name="matchPreceeding" value="(^|[\t ])$"/>
</binding>
<binding key="tab" command="autoComplete"/>
There's no support for defining contexts in plugins, but I'll add it to the list.
re: disabled commands, currently no, that'll still eat the key sequence.
Sublime actually has some pretty cool key binding functionality I've been meaning to blog about. Character sequence bindings, for example, work quite nicely, if you bind:
- Code: Select all
<binding key="q,q" command="expandSelectionTo line"/>
Then the key sequence q, q will then do the same job as Ctrl+L, but without as much need to move your fingers. The nice part is that it wont bother you when you're trying to type, say, 'quickly', as the typing is predicted, and then rolled back if the second q comes along. It's worth have a play with anyway.
You can bind to regular expressions too, which is used in the HTML snippets (take a look at Packages/HTML/Default.sublime-keymap).
To extend the example above:
- Code: Select all
<binding key="/([0-9]+)/,q,q" command="times $1 expandSelectionTo line"/>
Now typing 3,q,q will select three lines.