reddit / emacs

How do you yaml?

ilemming · 2022-09-02 22:47
Having to deal with YAML recently and it looks like there's no out-of the-box nice solution for efficient editing yaml files. Ideally, I want to edit yaml files like Org headings: - nice way to collapse/expand - `C-RET` to add a new item at the current level - imenu that takes into account nested items - jumping to prev/next item at the same level of nesting - changing the level of nesting (similar to `org-metaleft/right`) I've been looking through different packages, and I just can't find any good ones. I am almost tempted instead to work on figuring out how to convert YAML to Org and around. How do you deal with YAML?
ilemming · 2022-09-03 01:04
It looks like https://github.com/zkry/yaml-pro has some of the functionality I want. From the package description: > following commands are available: - `yaml-pro-move-subtree-up` and `yaml-pro-move-subtree-down` - `yaml-pro-next-subtree` and `yaml-pro-prev-subtree`, - `yaml-pro-kill-subtree` - `yaml-pro-up-level` - `yaml-pro-fold-at-point` and `yaml-pro-unfold-at-point`. - `yaml-pro-edit-scalar` - `yaml-pro-jump` or if consult exists `yaml-pro-consult-jump` I'll give it a try.
ilemming · 2022-09-03 01:35
Here's a Doom config snippet: packages.el ``` (package! yaml-pro :recipe (:host github :repo "zkry/yaml-pro")) ``` config.el ``` (use-package! yaml-pro :after yaml-mode :hook (yaml-mode . yaml-pro-mode) :config (map! :map yaml-pro-mode-map [remap imenu] #'yaml-pro-jump :n "zc" #'yaml-pro-fold-at-point :n "zo" #'yaml-pro-unfold-at-point :n "gk" #'yaml-pro-prev-subtree :n "gj" #'yaml-pro-next-subtree :n "gK" #'yaml-pro-up-level :n "M-k" #'yaml-pro-move-subtree-up :n "M-j" #'yaml-pro-move-subtree-down)) ```
deaddyfreddy · 2022-09-03 08:00
looks like `yaml-pro` could really make YAML editing less painful (still painful, though)