[TxMt] Hard tabs, soft tabs, oh my

Skye Poier skye at f4.ca
Sun Jul 23 18:41:25 UTC 2006


Hello, I'm a recent TextMate convert (from vim...)

I don't seem to be able to set up TM to handle tabs the same way.
Here's the relevant snippet from my vimrc:

     set tabstop=8                   " Leave default for printing etc
     set softtabstop=4               " But use spaces between real tabs
     set shiftwidth=4
     set noexpandtab                 " Use 'real' tabs (^I) when  
possible

This works great, real tabs (^I) are left alone at the usual 8  
spaces, however I
like to indent my blocks by 4 at a time.  This tells vim to use a  
real tab if it
can, and "pad out" with spaces at the end if the current indent isn't  
a multiple
of 8.  Here's what it looks like in vim:

     <?php$
     $page = new PageController($
         'shop.tpl',-$
         array($
     >       'showAds'   => FALSE,$
     >       'icon'>     => 'shop'),$
         'Online Store');$
     $page->render();$
     ?>$

If I configure TM to use soft tabs at 4, then all my previous code  
looks wrong
because it sets hard tabs to 4 as well.  If I set it to 8, then my  
existing code
looks fine but I'm not getting my desired softtab indent of 4.

This is a pretty annoying problem for me because I have hundreds of  
thousands of
lines of code formatted this way :(  Kind of ironic since I did it  
this way to
maximize compatibility!

I guess what I'm looking for is the ability to set soft tab size  
independantly
of hard tab size - the former to 4, the latter to 8.  Is this possible??

(I suppose if there's no other option, I could convert all tabs to 8  
spaces in
all my files.  However I like using tabs because it cuts down on file  
sizes a
tiny bit.  )

Thanks,
Skye




More information about the textmate mailing list