13

Is there a way to capitalize a selection in Sublime? For example, if I have some text like word, I'd like the output to be Word.

I know that there is already an option to convert case into lower case or upper case, but those would result in word and WORD respectively. Is there a way to only capitalize the first letter?

Saad
  • 49,729
  • 21
  • 73
  • 112
  • 1
    Use menu _Edit>Convert Case>Title Case – sergioFC Jun 23 '15 at 16:31
  • Thanks a lot! I guess I didn't realize it existed because there was no default key mapping set for the command. – Saad Jun 23 '15 at 18:46
  • That happens many times :) You're welcome. – sergioFC Jun 23 '15 at 18:47
  • @sergioFC Post this as an answer so it can be accepted and canonized, get some rep for yourself, too. – gfullam Jun 23 '15 at 19:17
  • 1
    Possible duplicate of [Convert selection to lowercase (or uppercase) in Sublime Text?](http://stackoverflow.com/questions/18773886/convert-selection-to-lowercase-or-uppercase-in-sublime-text) – br3nt Jul 07 '16 at 06:14
  • This isn't a duplicate of that question, doing the uppercase or lowercase command will affect every single letter, not just the first one. – Saad Jul 07 '16 at 06:45

2 Answers2

18

You can do it using the menu Edit>Convert Case>Title Case.

In case you want to set a keybinding the name of the associated command is title_case.

sergioFC
  • 5,926
  • 3
  • 40
  • 54
2

Add keybinding under the preferences as follows:

[
// for uppercase:
  { "keys": ["ctrl+u"], "command": "upper_case" },

// for lowercase:
  { "keys": ["ctrl+l"], "command": "lower_case" },

// for titlecase:
  { "keys": ["ctrl+t"], "command": "title_case" },
]
  • 1
    There are already other shortcuts for upper and lower case, see https://stackoverflow.com/a/18773887/379841 and https://stackoverflow.com/a/18922666/379841 – rdela Jun 22 '19 at 00:36