reddit / emacs

yaml-pro: a package adding parser-enhanced YAML editing capabilities

Prudent-Dimension554 · 2022-07-17 23:20
Prudent-Dimension554 · 2022-07-17 23:22
I wanted to share [yaml-pro](https://github.com/zkry/yaml-pro), a package I've been working on lately, which adds convenience functions when editing YAML. Features it has includes: moving a subtree up/down, subtree folding and killing, and editing a scalar value in a detached buffer. It leverages a YAML parser I wrote ([https://github.com/zkry/yaml.el](https://github.com/zkry/yaml.el)) which increases its accuracy for these operations.
Cycatz · 2022-07-18 02:55
Wow! That's so useful!
ispinfx · 2022-07-18 04:33
Editing `seed: 1234` yields seed: >- 1234 which might be overkilled.
flyin1501 · 2022-07-18 04:36
Finally there's a pure elisp yaml parser! Thank you!
zelphirkaltstahl · 2022-07-18 11:52
As much as I like Emacs and the shenanigans one can do with it, I don't want to put more logs to the dumpster fire, that is yaml.
snafuchs · 2022-07-18 12:30
Oh my, this is wonderful. I’ve often needed good subtree editing capabilities, and it looks like you got them right. Thank you!
Prudent-Dimension554 · 2022-07-18 14:07
That's a good point. I can add a heuristic to just add it as a plain scalar if it's short and one line.
jghobbies · 2022-07-18 15:11
On my list to try... anything that helps tame large yaml files ....
evlogii · 2022-07-24 21:21
I love colors tho. What is the name of this theme you use?
evlogii · 2022-07-24 21:50
I found your config. It's Zenburn right?
Prudent-Dimension554 · 2022-07-25 01:12
exactly, it's zenburn.
crundar · 2022-08-31 13:50
What do I get with this that I don't get with [yaml-mode](https://www.emacswiki.org/emacs/YamlMode)?
Prudent-Dimension554 · 2022-09-01 23:54
So yaml-pro is intended to be used alongside yaml-mode. Yaml-mode provides basic editing capabilities while yaml-pro provides parser enhanced tools. So for example, without a parser it would be hard to make out where certain structures begin and end. So some of the unique features that yaml-pro has is: folding YAML subtrees (even JSON maps), killing and moving yaml subtree, and editing a scalar in a separate buffer.
Phil-Hudson · 2022-10-02 15:40
Is `yaml-mode` a hard dependency? It isn't listed as such in the package description (Emacs 28.1).
Prudent-Dimension554 · 2022-10-02 16:50
I tried to write this so that it wouldn't need to depend on yaml-mode. That being said, yaml-mode is probably desirable to use alongside yaml-pro as it gives you the core features that are almost always used when editing yaml (syntax highlighting, indentation, etc.) which yaml-pro doesn't try re-implementing.