On 23/02/2012, at 06.12, Megan Nix Nissen wrote:
Ah, I was going to try the first method, but I could not find a button or menu option anywhere to create a new item, and did not know that ⌘N would do it. Am I missing the GUI element for this, or does it not exist?
Does not exist — bundle editor is provisional at best ;)
Indent-based folding would be ideal, and headers even better. I read the patch notes multiple times and did a great deal of searching, but never found anything that explained it in enough detail for me to do anything with it. Knowing where to look (Markdown -> Settings -> Folding) definitely helps, and hopefully more comprehensive, up to date TM2 & bundle documentation is coming so that I can RTFM rather than bugging the mailing list. :)
Here is the missing documentation (from the pre-public alpha release notes):
The folding system has been extended with two new patterns to allow indent-based foldings.
For C++ I have set these to:
{ foldingIndentedBlockStart = '^\s*(public|protected|private):\s*(//.*)?$|^\s*/[*](?!.*[*]/)'; foldingIndentedBlockIgnore = '^\s*#'; }
And for Markdown I use:
{ foldingIndentedBlockStart = '^#+\s+'; foldingIndentedBlockIgnore = '^(?!#+\s+)'; }
So the first pattern decides what starts a foldable block. Incase of C++ it is either a visibility keyword (`public`/`private`) or `/*`.
The latter is to make a block like the following foldable:
/* * t_foldings.cc * Avian * * Created by Allan Odgaard on 2011-09-30. * Copyright 2011 MacroMates. All rights reserved. */
The second pattern are lines to ignore. For C++ this would be preprocessor directives, e.g.:
class foldings_t { public: foldings_t (arguments); #if 0 virtual ~foldings_t (); #endif
private: /* data */ };
Here we can still fold from `public` and down to `private` despite the non-indented preprocessor directives.
The Markdown patterns are a bit more sneaky, we let a heading be a start marker and then we effectively ignore everything which is not a heading, causing those lines to be included in the foldable block, despite not being indented.
In any case, it seems that the best way to accomplish my goal is to convert all of my text files to markdown and my brace-delimited blocks into indented blocks […]
The default patterns for Markdown only fold headings, that is, lines starting with one or more pound signs (#) and the folding is down to the next section.
If this works for you, then converting to Markdown is probably a good idea as it’s becoming a de facto standard and you can benefit from many Markdown workflow tools.
But if you already have established your own convention for foldable blocks and use in many text files, I’d adjust the indent patterns to match these.