Re: YAML that folds right?
- On Mon, 22 Jul 2013 14:23:50 -0400
Benji Fisher <benji@...> wrote:
> How close doesClose enough, Benji. Thank you *very* much.
> :set fdm=indent
> get you? (Make sure that the 'shiftwidth' setting is right.)
> :help 'foldmethod'
> :help 'shiftwidth'
The problem, which I believe I can solve with one simple Python
program, is that nothing in the YAML specification states that subnodes
of different nodes or subnodes need be indented the same number of
spaces. Therefore, different YAML files will require different
shiftwidth settings, and even within a single YAML file, indent
widths may be different.
The practical effect of this is that you must set Vim's shiftwidth to a
number less than or equal to the smallest indent in the file. In doing
so, larger indents under some nodes might require multiple invocations
of zc to unfold. This is not a showstopper if left untreated, and can
be made even better if I write a Python program that parses a YAML file
into an in-memory object, then writes back that in-memory object to a
YAML file with consistent indentation.
For extra credit, I'll eventually need to adapt VimOutliner's code to
YAML so that folds don't show up *under* their parent, and so doing
zo on a parent, as opposed to its fold, opens it. But for the time
being, your answer scratched my itch, and I thank you for that.
After considering a switch from Xfce to OpenBox, my UMENU menu program
suddenly became much more important. Until now, UMENU was a deployment
nightmare. Menu system changes required a change to an EMDL file, EMDL
being a home-grown, fragile data file based on a tab indented outline.
Once that change was done, a special (and complicated and hard to
deploy) converter program converted the EMDL to .mnu files for each
individual menu. In practice, the deployment was so bad that probably
less than 100 people worldwide use UMENU, and it was so bad that it was
actually hard for me, the author, to copy UMENU to a new machine. And
even on my daily driver desktop, UMENU is always breaking because of
these deployment issues. That's just unacceptable.
The obvious choice, enabled by your Vim advice, is to author menu
systems in YAML, have a UMENU server that reads the YAML into a (huge)
in memory object tree, and handles queries from UMENU clients. This
should be easily deployable anywhere someone can type in an unused port
number. The YAML will also be much more readable than my kludgy EMDL.
And thanks to Vim's folding, modifications to huge (my main EMDL file
is over 2000 lines and at least 7 levels deep) YAML files will be easy
Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.