I'm writing a simple Sublime Text plugin to trim extra, unnecessary, spaces between words but without touching the leading spaces not to mess up Python formatting.
I have:
[spaces*******are********here]if****not***regions***and**default_to_all:
and want to get:
[spaces***are***still****here]if not regions and default_to_all:
Thinking about
regions = view.find_all('\w\s{2,}\w')
view.erase(edit, region)
but it cuts out the first and the last letter too.