wbond / sublime_alignment

Easy alignment of multiple selections and multi-line selections
http://wbond.net/sublime_packages/alignment
522 stars 110 forks source link

YAML : Aligment should align values instead of keys #29

Open gdlx opened 12 years ago

gdlx commented 12 years ago

Hi,

When using alignment on a yaml file, it aligns keys. Exemple :

On this block :

en:
  errors:
    messages:
      blank: "This should not be blank"
      invalid: "There's invalid characters"

Alignment does this :

      en:
      errors:
      messages:
      blank: "This should not be blank"
      invalid: "There's invalid characters"

I think it should do this :

en:
  errors:
    messages:
      blank:   "This should not be blank"
      invalid: "There's invalid characters"
leifcr commented 12 years ago

You can achieve this by creating a file YAML.sublime-settings in the alignment package folder. Content:

{
    "alignment_chars": ["\"", "'"],
    "alignment_space_chars": ["\"", "'"]
}

However, this won't work for YAML where you don't have either ' or " For instance this yaml won't align properly with the above settings, as the number won't get recognized.

cow:
  number: 5
  name: "donkey"