[TxMt] replacing tabs with spaces in selected area
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Mon Jan 24 15:37:54 UTC 2011
Hello,
I'm looking for a trick that would help me replace tabs by spaces in
selected area. I have source code that looks approximately like this:
<tab><tab>short<tab><tab><tab><tab>a;
<tab><tab>unsigned long<tab>b;
<tab><tab>int<tab><tab><tab><tab><tab>c;
which is only aligned when some specific size of tab is chosen. I
would like to keep the first two tabs (to preserve nice alignment),
but replace the tabs between "short" and "a", so that the text would
be aligned under any tabulator width setting.
I cannot use just "Search & Replace" because the first tab has
variable width (depending on its starting position).
If there is no out-of-the-box solution, I know some ruby, so I could
write a program that would perform the task for me, but I'm not sure
how to pass the following information from TextMate to my script:
- at which column does my selection start (I would like to "alt"-select a "box")
- how wide is the current tab
But I hope that there exists an easier solution.
Thank you very much for any hint ...
Mojca
More information about the textmate
mailing list