Reputation: 15193
On this page: http://www.sublimetext.com/docs/key-bindings it says that the sublime-keymap files are XML files, and can be configured with that syntax. However, opening up the Default (OSX).sublime-keymap
file, I see only the following:
[
]
Which suggests that this is not XML, but in fact JSON. Furthermore, copying and pasting in the following lines from the above page:
<binding key="ctrl+t,u" command="upperCase"/>
<binding key="ctrl+t,l" command="lowerCase"/>
and then saving the file, I get an error:
Error trying to parse file: Unexpected trailing characters in ~/Library/Application Support/Sublime Text 2/Packages/User/Default (OSX).sublime-keymap:2:1
so I'm guessing that, in fact, the sublime-keymap settings are not XML but JSON. So maybe the docs are out of date? Anyway, how can I set up a command like the one I put in above? I want a command that converts all selected text to upper case.
Thanks!
Upvotes: 0
Views: 6703
Reputation: 1580
There's a built-in short cut in ST2 - Ctrl+K,Ctrl+U (hit Ctrl+K quickly followed by Ctrl+U), so you could save yourself the trouble of defining a new keymap. As @d_rail has pointed out, you could verify this by looking at Preferences->Key Bindings->Default
Upvotes: 1
Reputation: 437594
Yes, that page seems to be out of date. The unofficial documentation is much more informative (see also here):
[
{ "keys": ["ctrl+shift+n"], "command": "new_window" },
{ "keys": ["ctrl+o"], "command": "prompt_open_file" }
]
So it's obvious how to write what you need:
[
{ "keys": ["ctrl+t","u"], "command": "uppercase" },
{ "keys": ["ctrl+t","l"], "command": "lowercase" }
]
Upvotes: 1
Reputation: 4119
Open the default keymap to see the correct format for bindings: Preferences -> Key bindings - Default:
[
{ "keys": ["ctrl+t","u"], "command": "upper_case" },
{ "keys": ["ctrl+t","l"], "command": "lower_case" }
]
Upvotes: 1