[TxMt] Newbee Q: Hard tabs vs. soft tabs

subtleGradient / Thomas Aylott oblivious at subtlegradient.com
Wed Jan 31 15:14:07 UTC 2007


On Jan 31, 2007, at 9:51 AM, Rob McBroom wrote:
> On Jan 31, 2007, at 12:50 AM, Garance A Drosehn wrote:
>> What I want is my tab-intent to be a soft-tab (using blanks) at 4
>> spaces, but I also want hard-tabs (using the actual tab character) to
>> be used for 8 spaces.  So, if I tab once I want four spaces, if I tab
>> twice then I want a single tab character, and with three tabs I  
>> want a
>> tab-character followed by four spaces.
>>
>
> Someone will correct me if I'm wrong, but I don't think you can  
> have TextMate do this for you just by altering settings.
>
> You could probably create a command that goes through your document  
> and replaces 8 spaces with a tab character. To get even fancier,  
> you could probably create a command that does this and saves the  
> document and bind this command to ⌘S, so when you save the file,  
> it gets formatted the way you want.
>
> I'm not sure if TextMate will let you use Tab as a key equivalent  
> for a command, but if so, you could make it even more automated  
> (probably what you want) by having it do a search/replace on the  
> current line every time you hit the Tab key. This might screw up  
> the cursor position though.
>
> ---
> Rob McBroom
> <http://www.skurfer.com/>
> I didn't "switch" to Apple... my OS did.

Ya. It's Tabs or spaces. no mixing.
Don't bother trying to write a tmCommand for this since you'd break  
snippet placer stuff and open up a whole can of trouble and pain for  
yourself.
I recommend using tabs at 4 and just using two of them in some places.

If you already have documents that assume 4spaces + 8wide tabs, you  
can switch to using all tbs by setting it to use 8wide soft tabs 
(spaces), use the convert tabs to spaces action o convert all your 8  
wide tabs to 8spaces,
then switch to hard tabs at 4width and convert spaces to tabs.

thomas Aylott — design42 — subtleGradient — CrazyEgg


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070131/3eeafa17/attachment.html>


More information about the textmate mailing list