Sublime Forum

Macro: swapping case of the first letter

#1

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

see sublimetextwiki.com/pages/Macros.html

code:

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:

splitSelection singleSelection move characters +1 extend

so the macro will support multiple selection… any ideas?

0 Likes

#2

I extended Default/transform.py with the following class:

class CapitalizeCaseCommand (sublimeplugin.TextCommand):
	def run (self, view, args):
		transformSelectionText (string.capitalize, view)

	def isEnabled (self, view, args):
		return view.hasNonEmptySelectionRegion()
0 Likes