How to convert a selection to lowercase or uppercase in Sublime Text

Sublimetext

Sublimetext Problem Overview


I have several strings selected in a file in Sublime Text and I want to convert them all to lowercase.

How can I convert them all to lowercase in Sublime Text?

Sublimetext Solutions


Solution 1 - Sublimetext

From the Sublime Text docs for Windows/Linux:

Keypress	        Command
Ctrl + K, Ctrl + U	Transform to Uppercase
Ctrl + K, Ctrl + L	Transform to Lowercase

and for Mac:

Keypress	Command
cmd + KU	Transform to Uppercase
cmd + KL	Transform to Lowercase

Also note that Ctrl + Shift + p in Windows (āŒ˜ + Shift + p in a Mac) brings up the Command Palette where you can search for these and other commands. It looks like this:

enter image description here

Solution 2 - Sublimetext

For Windows:

  • Ctrl+K,Ctrl+U for UPPERCASE.
  • Ctrl+K,Ctrl+L for lowercase.

Method 1 (Two keys pressed at a time)

  1. Press Ctrl and hold.
  2. Now press K, release K while holding Ctrl. (Do not release the Ctrl key)
  3. Immediately, press U (for uppercase) OR L (for lowercase) with Ctrl still being pressed, then release all pressed keys.

Method 2 (3 keys pressed at a time)

  1. Press Ctrl and hold.
  2. Now press K.
  3. Without releasing Ctrl and K, immediately press U (for uppercase) OR L (for lowercase) and release all pressed keys.

Please note: If you press and hold Ctrl+K for more than two seconds it will start deleting text so try to be quick with it.

I use the above shortcuts, and they work on my Windows system.

Solution 3 - Sublimetext

As a bonus for setting up a Title Case shortcut key Ctrl+kt (while holding Ctrl, press k and t), go to Preferences --> Keybindings-User

If you have a blank file open and close with the square brackets:

[  { "keys": ["ctrl+k", "ctrl+t"], "command": "title_case" } ]

Otherwise if you already have stuff in there, just make sure if it comes after another command to prepend a comma "," and add:

{ "keys": ["ctrl+k", "ctrl+t"], "command": "title_case" }

Solution 4 - Sublimetext

For Windows OS

For Uppercase CTRL + K + U

For Lowercase CTRL + K + L

Solution 5 - Sublimetext

For others needing a key binding:

{ "keys": ["ctrl+="], "command": "upper_case" },
{ "keys": ["ctrl+-"], "command": "lower_case" }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionarturompView Question on Stackoverflow
Solution 1 - SublimetextarturompView Answer on Stackoverflow
Solution 2 - SublimetextAnish NairView Answer on Stackoverflow
Solution 3 - Sublimetextuser3486945View Answer on Stackoverflow
Solution 4 - SublimetextNavneet KumarView Answer on Stackoverflow
Solution 5 - SublimetextwadeyView Answer on Stackoverflow