Re: YAML Help - Storing hotkey bindings

William Spitzak <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>

Joe Larson wrote:
> My employer has decided that he wants to store his hotkey binding is 
> YAML since there are 3^rd party utilities that can convert YAML into the 
> industry’s golden child XML, otherwise we’d just use an ini. So I’ve 
> been taking a crash course in YAML and I think I get the idea now, but I 
> need some refinement so I need your experience.
> 
>  
> 
> Some actions could have multiple bindings, so at first I tried doing 
> something like this:
> 
> Action : {ctrl+alt+key1, ctrl+alt+key2}
> 
> But discovered that didn’t exactly work because it was reading the 
> binding as a key and wanted a value for it. (Well, it worked, but not 
> cleanly.

Use square brackets so it is a list rather than a map:

Action: [ctrl+alt+key1, ctrl+alt+key2]

This is equivalent to your first solution below

  So now I’m thinking something like this:
> 
> Action :
>  - ctrl+alt+key1
>  - ctrl+alt+key2
> 
> Which looks okay.
> 
> I’m also considering:
> 
> Action :
> 
> - Key: key1
>    Modifier: ctrl+alt
> - Key: key2
>    Modifier: ctrl+alt
> 
> I’m not sure which would be better, particularly in light of the 
> conversion to XML that my employer wants to happen. So what’s your 
> experienced opinion on this? How should YAML store key bindings?

It has nothing to do with YAML but I would strongly suggest the first 
version as being better. It is silly to separate the modifiers from the 
key, especially because you are not separating the modifiers from each 
other. Also it is a lot more obvious how to add more than 1 modifier and 
how to have zero modifiers with the first syntax.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.