Is it possible to convert a selection to proper case? i.e. First letters of each word to uppercase? Thanks!
Proper case?
If you get the PowerUser plugin then it is
by default the binding I have for it is alt+k,t but u can change it to whatever you want. Edit the *Default.sublime-keymap *file in the PowerUser folder
If you don’t feel like downloading the whole plugin and use all of its goodies then here’s the code for that command only
[code]class TitleCaseCommand(sublimeplugin.TextCommand):
def run(self, view, args):
self.transformSelectionText(string.capwords, view)
def isEnabled(self, view, args):
return view.hasNonEmptySelectionRegion()
def transformSelectionText(self, f, v):
for s in v.sel():
if not s.empty():
txt = f(v.substr(s))
v.replace(s, txt)[/code]
Awesome, thanks a lot! That was the only thing keeping me from using Sublime Text.
On more quick question. I’m new with Sublime, so forgive my stupid questions. You have the default keymap as alt+k,t…how does that translate into what I press? Alt k, then release and press t or something different. I can’t seem to figure that side of things out.
Nevermind…I just answered my own question. Alt + k, then release and press t is exactly it. I the action I wrote in the last post was the only action I didn’t actually try yet. Thanks a lot for your quick help on this and for that great plugin!!
I was lazy, I just added this class in Packages/Default/Transform.py
class CapitalizeCaseCommand (sublimeplugin.TextCommand):
def run (self, view, args):
transformSelectionText (string.capwords, view)