Solved Dealing with YAML

Hi there,

Recently I played with a terminal emulator called x11/alacritty, as I already tried it years ago I have an old config file that I used instead of starting from scratch, but of course at some point I found out some new features were missing.
So no other option than making a new config file from the one given by the package itself located in /usr/local/share/examples/alacritty/alacritty.yml, basically a simple cp command cp /usr/local/share/examples/alacritty/alacritty.yml ~/.config/alacritty/.

And then that annoying feeling arrived ...
After every modification, alacritty complained about yaml syntax, even when uncommenting one line implies an error.
I installed py39-yamllint which helps to identify errors with yalm files, well it showed countless errors on a file that I barely touched yet (I did one change):
Bash:
~ % yamllint ~/.config/alacritty/alacritty.yml | grep error | wc -l
102
~ % yamllint ~/.config/alacritty/alacritty.yml | grep warning | wc -l
222

Most errors are:
line too long (93 > 80 characters)
Most warnings are:
missing starting space in comment

I get these errors even with the file from the git repo

?!!? now I remember why I didn't want to switch to alacritty at that time, it was mostly because of that language yaml, a wrong indentation, space can introduce an error, years ago I had to rewrite/modify the whole config file (today it's almost 900 lines, lot of comments though) by hand to avoid the warnings, I don't know if my patience will be that effective this time ...
I found one parser online but is it really the only way to edit correctly this kind of file ?
How do you guys deal with yaml files? is there any trick to make it easier to use? or is it just about pain!
 
There is no 80 line-length limit in yaml. Even the yamllint page says it checks for “cosmetic problems like line-length”! I’d rather avoid such tools and just understand the spec @ https://yaml.org/spec/1.2.2/

The main thing is to only use leading spaces and not tabs for indentation. You can use the expand program to get rid of tabs.
 
You can use simple and minimal config. Here is example:

YAML:
font:
  normal:
    family: JetBrainsMono Nerd Font
    style: Regular

  bold:
    family: JetBrainsMono Nerd Font
    style: Bold

  italic:
    family: JetBrainsMono Nerd Font
    style: Italic

  bold_italic:
    family: JetBrainsMono Nerd Font
    style: Bold Italic

  size: 12

    # Colors (One Dark)
colors:
  # Default colors
  primary:
    background: '0x1e2127'
    foreground: '0xabb2bf'

  # Normal colors
  normal:
    black:   '0x1e2127'
    red:     '0xe06c75'
    green:   '0x98c379'
    yellow:  '0xd19a66'
    blue:    '0x61afef'
    magenta: '0xc678dd'
    cyan:    '0x56b6c2'
    white:   '0xabb2bf'

  # Bright colors
  bright:
    black:   '0x5c6370'
    red:     '0xe06c75'
    green:   '0x98c379'
    yellow:  '0xd19a66'
    blue:    '0x61afef'
    magenta: '0xc678dd'
    cyan:    '0x56b6c2'
    white:   '0xffffff'
 
There is no 80 line-length limit in yaml. Even the yamllint page says it checks for “cosmetic problems like line-length”! I’d rather avoid such tools and just understand the spec @ https://yaml.org/spec/1.2.2/
Well I didn't know that, it's unfortunate but noted, thanks.
The main thing is to only use leading spaces and not tabs for indentation.
That's what I noticed too, I tried various things and I would say it prefers when everything is not aligned on the same column, apparently it doesn't care if it's a tab or a space, it looks like it works with both from what I tried or may be I am lucky. Anyway you lead me in the right direction, thanks.

You can use simple and minimal config.
I could indeed but there is many features that have been added since last time I tried alacritty, I have to try some of them so for now I really need all the comments to help me through.
But I agree, once you know what options you need and the ones you don't, having a slim config file is way better.


Thank you to both of you Ogis and bakul, I think it's okay now with your help I manage to make it work almost as I want, still needs few changes here and there but for the most part it is fine. Definitively not the most convenient format this yaml for a terminal, a text would be way enough but it is what it is.
Again thank you :)
 
Back
Top