[TxMt] Re: Display vertical rule but also wrap text to window
Graham P Heath
graham.p.heath at gmail.com
Thu Jan 15 17:55:10 UTC 2015
I add subtle fold guides to TextMate using a relatively simple Bundle -> Language Grammar rule and It occurred to me that it might be possible to do the same for your request. Adding a grammar that matches only the characters after 80 number of characters, and highlight it as going past your limit.
Below is partially successful. It seems to me that my results are corrupted by some existing scopes. Once I disabled my Fold Guide Grammar the regexp results were dramatically improved. It’s still rubbish as far as commented lines go though. So, from that, I take it that it doesn’t play nice with other scopes, which will surely affect your milage. I tested on various different languages in TextMate and had good success with “Properties”, as it didn’t seem to add many scopes to my document.
{ patterns = ( { include = '#eightyCharacters'; } );
repository = {
eightyCharacters = {
begin = '[\S\s\/\\\D\d\x\O]{80}';
end = '$';
patterns = (
{ match = '(.+)';
captures = { 1 = { name = 'invalid.warning'; }; };
},
);
};
};
}
Images (all taken with the 80 in the above code changed to 10 for dramatic effect)
JS with the language set to Properties (no/few extra scopes): https://drive.google.com/file/d/0B-4RIorGTGCMRHA5UWg0V3FkRWc/view?usp=sharing
JS with fold guides enabled (extra scopes): https://drive.google.com/file/d/0B-4RIorGTGCMZGVVaXFFNHg1T1U/view?usp=sharing
JS without fold guides (standard JS scopes): https://drive.google.com/file/d/0B-4RIorGTGCMaHFSblp5aGNKTGs/view?usp=sharing
Screen shot of bundle editor on “Wrap Column Alert” (so you can see all the settings): https://drive.google.com/file/d/0B-4RIorGTGCMWksyU2FVbXc3dEU/view?usp=sharing
But now Im damned curious as to if there’s a way to do this better.
For the curious my fold guides patterns are;
{ patterns = (
{ include = '#leading-spaces'; },
{ name = 'meta.leading-tabs';
begin = '^(?=\\t)';
end = '(?=[^\\t])';
patterns = (
{ match = '(\\t)(\\t)?';
captures = {
1 = { name = 'meta.odd-tab'; };
2 = { name = 'meta.even-tab'; };
};
},
);
},
);
repository = {
leading-spaces = {
begin = '^(?=\s\s)';
end = '(?=[^\s\s|\\t])';
patterns = (
{ match = '(\s\s)(\s\s)?';
captures = {
1 = { name = 'meta.odd-tab'; };
2 = { name = 'meta.even-tab'; };
};
},
);
};
};
}
On January 15, 2015 at 7:42:13 AM, Joseph Dan (josephdan at writeme.com) wrote:
I like to use Soft Wrap. I also like to Use Window Frame as the Wrap Column. In other words, I like to wrap the text to the window.
How can we, completely independent of this, display a vertical line at a given column?
I can't do this with "Show Wrap Column" because it is connected to my Wrap Column setting. If I set that to 80, my Use Window Frame goes away.
_______________________________________________
textmate mailing list
textmate at lists.macromates.com
http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20150115/d5c51e5e/attachment-0001.html>
More information about the textmate
mailing list