Home Download Buy Blog Forum Support

macro: swapping case of the first letter

macro: swapping case of the first letter

Postby vim on Thu Mar 19, 2009 8:09 am

new simple macro for swapping case of the first letter in word you mouse courser is on.

see http://www.sublimetextwiki.com/pages/Macros.html

code:
Code: Select all
expandSelectionTo word
splitSelection
singleSelection
move characters +1 extend
swapCase
expandSelectionTo word


still, i would like be able to jump to the start of the word without the trick:
Code: Select all
splitSelection
singleSelection
move characters +1 extend


so the macro will support multiple selection... any ideas?
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: macro: swapping case of the first letter

Postby tgkeul on Thu Mar 19, 2009 10:56 am

I extended Default/transform.py with the following class:
Code: Select all
class CapitalizeCaseCommand (sublimeplugin.TextCommand):
   def run (self, view, args):
      transformSelectionText (string.capitalize, view)

   def isEnabled (self, view, args):
      return view.hasNonEmptySelectionRegion()
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: Clams and 7 guests