Convert selection to lowercase (or uppercase) in S

2019-01-20 21:39发布

问题:

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?

回答1:

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:



回答2:

For Windows,

ctrl + KU for Uppercase
ctrl + KL for Lowercase

METHOD 1
Press ctrl and hold.
Now press K, release K while holding ctrl (do not release ctrl key)
Now press U or L (ctrl key is still pressed) and release all keys.

OR

METHOD 2
Press ctrl and hold.
Now press K
Without releasing ctrl and K, immediately press U(or L) And release all keys.

Please note: If you press and hold ctrl + K for more than 2 secs it will start deleting text. So try to be quick with it.

I use the above shortcuts, and it works on my Windows system.



回答3:

As a bonus for setting up 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" }


回答4:

For Windows OS

For Uppercase CTRL + K + U

For Lowercase CTRL + K + L



回答5:

For others needing a key binding:

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


标签: sublimetext