[TxMt] Re: Indented soft-wrap
Anthony V. Pulido
anthony.pulido at gmail.com
Fri Aug 3 21:10:42 UTC 2012
Hello everyone,
Success! I've enabled soft wrap indenting (+1 extra tab)!
For the newbies, like me, out there looking for the same, I'll write out the steps here for LaTeX, but the method probably generalizes to other languages. As pointed out already, leaving the scope empty enables the feature for all languages, so it likely matters little where the preference resides.
Note: This applies only to TextMate 2.
1. On the menu bar, select Bundles > Edit Bundles.
2. Within the Bundle Editor display, select LaTeX > Settings. Once here, a list of preferences indicated by a white P on a gray circle is seen.
3. On the menu bar again, click on New or press command-N. From the Bundle Editor display, TM will prompt you to choose what to create: bundle, command, setting, grammar, etc.
4. Click setting. An untitled setting will appear in the Bundle Editor window.
5. Name the new setting. I used "Soft-wrap indent."
6. Select the new setting if not already selected.
7. In the text field, paste
{ indentedSoftWrap = {
format = '$0\t';
match = '\A[ \t]*';
};
}
This enables soft-wrap indent + 1 extra tab. For some reason, the following wouldn't work, which I think is supposed to be soft-wrap indent (without the + 1):
{ indentedSoftWrap = {
match = '\A\s*[-*]\s+';
format = '${0/\S/ /g}';
};
}
8. If you wish to restrict this to a certain scope, it can be done in the drawer next to "scope selector." Leaving it blank will enable soft-wrap indentation for any text file.
9. Save the setting by pressing command-S and close the Bundle Editor.
10. Make sure soft wrap is enabled. (View > Soft Wrap). It might be necessary to reload any open files for the setting to take effect.
Enjoy!
Anthony
References: If not already obvious, the settings code comes from Allan Odgaard, who posted it to the list on Dec 15-16, 2011.
On Aug 2, 2012, at 7:27 PM, Anthony V. Pulido wrote:
>
> Hello everyone,
>
> I've just installed TextMate 2 and have been trying to enable soft wrap
> indenting. I found this mailing list and I see that the setting
>
> { indentedSoftWrap = {
> match = '\A\s*[-*]\s+';
> format = '${0/\S/ /g}';
> };
> }
>
> is required to enable it globally, but I'm not quite sure where to put it.
> If I knew what "empty scope selector" meant, that would be a great help. As
> a start, I thought I might try to enable it just for LaTeX, but have been
> unsuccessful. I've opened the Bundle Editor and inserted the above into the
> Miscellaneous preference in the LaTeX bundle, but soft wrapping, which is
> enabled, has not changed. Would anyone know what I've missed?
>
> Anthony Pulido
>
>
> Allan Odgaard-4 wrote:
>>
>> On 16 Dec 2011, at 06:12, Trevor Harmon wrote:
>>
>>> That works great for the scopes where it's defined, but many of the
>>> scopes where I want soft wrap indentation (XML comments, Java source
>>> code) don't have it. As an alternative to inserting indentedSoftWrap in
>>> all the bundles I use, is it possible to specify a single global
>>> fall-back that performs a "dumb" soft wrap indentation (e.g., indenting
>>> to the same level as the previous line, or same level plus 1)? In other
>>> words, is there a way to tell TextMate that I want indented soft wrap
>>> *everywhere*? Thanks,
>>
>> The empty scope selector will match all scopes (and thus be the fallback).
>>
>> And “same indent as last line plus one” could e.g. be:
>>
>> { indentedSoftWrap = {
>> match = '\A[ \t]*';
>> format = '$0\t';
>> };
>> }
>>
>>
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
>>
>>
> --
> View this message in context: http://old.nabble.com/Indented-soft-wrap-tp32983136p34248591.html
> Sent from the textmate users mailing list archive at Nabble.com.
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
More information about the textmate
mailing list