Hi folks,
I work on several open-source projects (VTK, ParaView, CMake...) that follow a somewhat unusual indentation style. Instead of
if (foo) { bar(); } bar();
they require
if (foo) { bar; } bar()
Getting the first curly indent right was trivial but I can't figure out how to reduce the indentation _after_ the closing curly. When the pattern matches decreaseIndentPattern, the current line's indentation is reduced. What I need is for the following line to be unindented. Is there any way to do this?
Thanks, -berk
OK. I gave up on automatically decreasing of the indentation level. I really like TextMate so I am willing to live with manually doing that. However, there is another issue. After a close curly, I hit enter and then delete to decrease the indentation. But, when I end the line with a semi-colon, the line is indented to align with the previous line (because TextMate does not know the indentation changed). Is there any way of turning of re-adjustment of indentation when a semi-colon is typed? I am guessing this is part of the language grammar but I can't figure it out...
-berk
On Sat, Oct 25, 2008 at 2:23 PM, Allan Odgaard mailinglist@textmate.org wrote:
On 23 Oct 2008, at 03:21, Berk Geveci wrote:
[...] Getting the first curly indent right was trivial but I can't figure out how to reduce the indentation _after_ the closing curly. [...]
I'm afraid the indent pattern system cannot express your desired convention.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 25 Oct 2008, at 21:15, Berk Geveci wrote:
[...] Is there any way of turning of re-adjustment of indentation when a semi-colon is typed?
Yes, this is done by a macro in the C bundle bound to the semi-colon: Insert ; and Indent Line
You can delete the macro via the bundle editor (Bundles → Show Bundle Editor).
That's awesome. Thanks Allan.
-berk
On Sat, Oct 25, 2008 at 3:30 PM, Allan Odgaard mailinglist@textmate.org wrote:
On 25 Oct 2008, at 21:15, Berk Geveci wrote:
[...] Is there any way of turning of re-adjustment of indentation when a semi-colon is typed?
Yes, this is done by a macro in the C bundle bound to the semi-colon: Insert ; and Indent Line
You can delete the macro via the bundle editor (Bundles → Show Bundle Editor).
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
By the way, what is the process for requesting a new feature? I guess my problem could be solved with 2 new regular expressions:
decreaseIndentAfterPattern - decrease the indent in the line after this match increaseIndentHerePattern - increase the indent in the line that matches this pattern
or some option that changes the behavior of the existing regular expressions.
-berk
On Sat, Oct 25, 2008 at 2:23 PM, Allan Odgaard mailinglist@textmate.org wrote:
On 23 Oct 2008, at 03:21, Berk Geveci wrote:
[...] Getting the first curly indent right was trivial but I can't figure out how to reduce the indentation _after_ the closing curly. [...]
I'm afraid the indent pattern system cannot express your desired convention.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Oct 25, 2008, at 22:44, Berk Geveci wrote:
By the way, what is the process for requesting a new feature? I guess my problem could be solved with 2 new regular expressions:
decreaseIndentAfterPattern - decrease the indent in the line after this match increaseIndentHerePattern - increase the indent in the line that matches this pattern
or some option that changes the behavior of the existing regular expressions.
I'd also like to see this, as I think this would enable me to let this auto-indent:
class Foo def bar; end private def baz; end end
On 26 Oct 2008, at 02:48, Mikael Høilund wrote:
[...] I'd also like to see this, as I think this would enable me to let this auto-indent:
class Foo def bar; end private def baz; end end
I think that is already possible. You want to match ‘private’ in both the decrease and increase indent patterns. At least a similar construct in C++ indents as expected:
struct Foo { Foo (); private: void bar (); };
I'm having a bit of trouble balancing the the size of the print font with the size of the font visible on the screen. The print font is way too large to fit comfortably on a standard sheet of paper, but it appears that in order to reduce the printing font I also have to reduce the size of the font on the screen. Is there some way to decouple these two font sizes and types? I'd like the print font to be no more than 9 or 10 point, while the on screen font I'd like to keep at 13 or 14 point. I've got a 30" monitor and screen real estate is no problem. I have old eyes, but I don't like to waste paper or have ugly printouts.
Any suggestions on how to resolve this. I don't see anywhere to decouple these two fonts.
Thanks.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dr. Marc R. Feldesman Professor & Chairman Emeritus Anthropology Department Portland State University
please reply to: feldesmanm@pdx.edu my PERS blog: http://persinfo.blogspot.com SKYPE: mrfearless47
--- On Sat, 10/25/08, Allan Odgaard mailinglist@textmate.org wrote:
From: Allan Odgaard mailinglist@textmate.org Subject: [TxMt] Re: How do I vary the C indentation? To: "TextMate users" textmate@lists.macromates.com Date: Saturday, October 25, 2008, 8:04 PM On 26 Oct 2008, at 02:48, Mikael Høilund wrote:
[...] I'd also like to see this, as I think this would
enable me to let this
auto-indent:
class Foo def bar; end private def baz; end end
I think that is already possible. You want to match ‘private’ in both the decrease and increase indent patterns. At least a similar construct in C++ indents as expected:
struct Foo { Foo (); private: void bar (); };
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 01.11.2008, at 23:21, Marc Feldesman wrote:
I'm having a bit of trouble balancing the the size of the print font with the size of the font visible on the screen. The print font is way too large to fit comfortably on a standard sheet of paper, but it appears that in order to reduce the printing font I also have to reduce the size of the font on the screen. Is there some way to decouple these two font sizes and types? I'd like the print font to be no more than 9 or 10 point, while the on screen font I'd like to keep at 13 or 14 point. I've got a 30" monitor and screen real estate is no problem. I have old eyes, but I don't like to waste paper or have ugly printouts.
Any suggestions on how to resolve this. I don't see anywhere to decouple these two fonts.
As far as I know up to now the Print command will use only the document font size. But there are some workarounds.
1) - invoke the command "Create HTML From Document" or "Create HTML From Document With Line Numbers" in the TextMate bundle - you'll get a new doc containing an HTML representation of the your doc - here you can change the font-size/family manually (line 22 and 23) - press CTRL+OPT+APPLE+P to open the Web Preview - press CTRL+P for printing
This can also be automated: -open the Bundle Editor, select TextMate > "Create HTML From Document", and add e.g.:
.gsub(/font-size:.*/,'font-size: 9pt;')
to the line: print document_to_html( STDIN.read, :include_css => !ENV.has_key? ('TM_SELECTED_TEXT') )
to get
print document_to_html( STDIN.read, :include_css => !ENV.has_key? ('TM_SELECTED_TEXT') ).gsub(/font-size:.*/,'font-size: 9pt;')
-close the Bundle Editor -invoke that command -you get a new doc and press CTRL+OPT+APPLE+P -you'll see your doc in the Web Preview and press APPLE+P for printing
2) An other way is to use a2ps if installed: details: http://lists.macromates.com/textmate/2006-April/009412.html
--Hans
Brilliant Hans, this was just what I was looking for. Thanks!
On Nov 1, 2008, at 11:21 PM, Marc Feldesman wrote:
I'm having a bit of trouble balancing the the size of the print font with the size of the font visible on the screen. The print font is way too large to fit comfortably on a standard sheet of paper, but it appears that in order to reduce the printing font I also have to reduce the size of the font on the screen. Is there some way to decouple these two font sizes and types? I'd like the print font to be no more than 9 or 10 point, while the on screen font I'd like to keep at 13 or 14 point. I've got a 30" monitor and screen real estate is no problem. I have old eyes, but I don't like to waste paper or have ugly printouts.
Any suggestions on how to resolve this. I don't see anywhere to decouple these two fonts.
The best solution is to avoid using TextMate's print dialog. There is a command in the TextMate bundle to convert the current document to HTML, styled using the current theme. You can then print this document from safari, or convert it to RTF using textutil on the command line.
There is a “copy as rtf” command here: http://github.com/drnic/copy-as-rtf-tmbundle/tree/master
You'll get much better, more predictable results this way.
—Alex
On 3 Nov 2008, at 14:37, Alex Ross wrote:
[...] You can then print this document from safari, or convert it to RTF using textutil on the command line.
You can also print it directly from TM, either via the Web Preview (as Hans suggested) or by changing the command output, for step-by-step see: http://wiki.macromates.com/HowTo/PrintWithColors
Though as the original poster was only concerned about font size, one can hit ⌘- a few times before ⌘P to decrease the font size (for just that buffer) prior to printing.
On 25 Oct 2008, at 22:44, Berk Geveci wrote:
By the way, what is the process for requesting a new feature?
Using this list is fine, and generally when limitations come up here, I do tend to see them as implicit feature requests :) though specific proposals for solutions are of course welcome.
I guess my problem could be solved with 2 new regular expressions:
decreaseIndentAfterPattern - decrease the indent in the line after this match increaseIndentHerePattern - increase the indent in the line that matches this pattern
or some option that changes the behavior of the existing regular expressions.
I want to get away from these arcane patterns and instead rethink the system. My thoughts go toward having a list of rules with ‘pattern → action’ where action can affect 3 things: the indent of the current line, the general indent, and a carry. It can affect it by either increasing, decreasing, or setting an absolute value.
That said, even this system has many limitations compared to the indent conventions I have seen, so still not settled on anything concrete.