Home Download Buy Blog Forum Support

Key binding for 'Swap Case'...?

Key binding for 'Swap Case'...?

Postby willi297 on Tue Jan 19, 2010 2:58 pm

I would really like to add a key binding for swapping/changing the case of the selected text. I don't see an expose command to access this, even though it is in the edit menu.

Is there a long term plan to expose all or most of the menu items as commands for keybinding or possibly another method of accessing menu items as bindable actions?

Thanks,
Greg

P.S. Sublime rocks!
Greg Williams
Atomic Embedded, USA
http://atomicembedded.com
willi297
 
Posts: 121
Joined: Wed Nov 18, 2009 8:29 pm
Location: Grand Rapids, MI, USA

Re: Key binding for 'Swap Case'...?

Postby EJ12N on Tue Jan 19, 2010 5:51 pm

They are all there available to your disposal so you can abuse all the commands you want :D
Everything that there is in the MAIN MENU (top menu) are located in the Main.sublime-menu file

Location: %appdata%\sublime text\packages\default\Main.sublime-menu

and to answer the question just for the hell of it,

Code: Select all
<item caption="&amp;Swap Case" command="swapCase"/>


BONUS: if you want to add anything to the "right click" (context) menu then the file is: Context.sublime-menu same location above.
If you want to add anything to the TAB right click menu the file is Tab Context.sublime-menu

Just remember that any changes to these files will get lost when you upgrade, so if you do change it, whenever u update have that in mind :D
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Key binding for 'Swap Case'...?

Postby willi297 on Tue Jan 19, 2010 7:29 pm

Sweet! Guess I just needed to dig further...

Thanks!
Greg Williams
Atomic Embedded, USA
http://atomicembedded.com
willi297
 
Posts: 121
Joined: Wed Nov 18, 2009 8:29 pm
Location: Grand Rapids, MI, USA

Re: Key binding for 'Swap Case'...?

Postby willi297 on Tue Jan 19, 2010 7:55 pm

My new sweet context menu!

context_awesomeness.png
context_awesomeness.png (17.15 KiB) Viewed 1742 times
willi297
 
Posts: 121
Joined: Wed Nov 18, 2009 8:29 pm
Location: Grand Rapids, MI, USA

Re: Key binding for 'Swap Case'...?

Postby kachar on Wed Mar 20, 2013 12:45 pm

If somebody needs toggle case command here is a quick addon to Packages/Default/transform.py

Code: Select all
class ToggleCaseCommand(Transformer):
    transformer = lambda text: text.lower() if text[:1].istitle() else text.upper(),


The code checks if the first letter of the selected text is uppercase then it makes it all lowercase and the opposite.

Cheers
kachar
 
Posts: 1
Joined: Wed Mar 20, 2013 12:42 pm

Re: Key binding for 'Swap Case'...?

Postby ufologist on Wed May 08, 2013 10:00 am

You can try this

Code: Select all
{ "keys": ["ctrl+shift+x"], "command": "swap_case" }


thanks Gabe
Sublime Text Shortcuts for Writing
ufologist
 
Posts: 1
Joined: Wed May 08, 2013 9:55 am


Return to Technical Support

Who is online

Users browsing this forum: Alexa [Bot] and 33 guests