[TxMt] Replace spaces with tabs at beginning of line

Anthony V. Pulido anthony.pulido at gmail.com
Sat Dec 1 19:53:01 UTC 2012


Hi Adam,

Thank you very much for this. I followed the instructions as well as I could over the last couple of days, and I think I've reached 2 successfully.

I've set Tab size to 1 and tried other numbers, but each time I try step 3, I receive the same result. When I try Bundle > Source > Convert Spaces to Tabs, a couple of lines where the leading spaces have been selected from step 2 are left untouched, and another line's leading spaces are simply deleted and no tabs replace them. In case, I've made sure that the leading spaces are indeed spaces, and not tabs with a size of one space.

Specifically, two lines with one leading space are left untouched, and a line with two leading spaces had its spaces deleted.

I looked in the bundle editor and I see that "Convert Spaces to Tabs" relies on the unexpand command. I've tried running this in the terminal and on a different linux system, without luck.

This might be out of the scope of this list, since we are venturing away from TM, but I hope we can make a small exception in this case...

Just to remind, the goal is to convert leading spaces to tabs. 1 space -> 1 tab. test3.txt is the input file. I've tried

unexpand -t1 test3.txt

unexpand -t1 test3.txt t3.txt

(where t3.txt would be the output file)

with no luck. Would you or someone else be able to tell me what I'm doing wrong? or tell me what in TM I'm doing wrong?

Thanks again!

Anthony


On Nov 28, 2012, at 6:01 PM, Adam Sharp <adsharp at me.com> wrote:

> Hi Anthony,
> 
> 1. Perform a search for this regex: '^ +' (minus quotes)
> 2. Close the search, place the caret anywhere in the file, and type Opt-Cmd-F
> 3. Bundle > Source > Convert Spaces to Tabs (make sure to set up your spaces per tab correctly first, so TM converts to the correct number of tabs)
> 
> Regards,
> 
> Adam
> 
> On 29/11/2012, at 9:48 AM, Anthony V. Pulido <anthony.pulido at gmail.com> wrote:
> 
>> Hello everyone,
>> 
>> I have a text file that is indented properly, but instead of tabs, the indentation has been done with spaces. Is it possible to replace the spaces with tabs only at the beginning of the line?
>> 
>> In this case, 1 space -> 1 tab.
>> 
>> Thanks!
>> 
>> Anthony
>> 
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
> 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate



More information about the textmate mailing list