reddit / emacs

Editing YAML in Emacs

nanounanue · 2022-06-06 03:15
Hi everyone! Could someone point me or share with me to a nice configuration for editing YAML files in Emacs? Mainly I am looking for navigation between sections and folding (maybe with `hideshow-mode`?) Thanks in advance
onetom · 2022-06-06 03:26
good question... I'd be interested to know too. Currently I'm using IntelliJ to edit AWS CloudFormation files, because there's a plugin, which recognizes its YAML extensions (function invocations and references) and also provides help and links to the external CF documentation about the various resource types.
redguardtoo · 2022-06-06 04:30
https://github.com/redguardtoo/emacs.d imenu setup, ``` (with-eval-after-load 'yaml-mode (setq yaml-imenu-generic-expression '((nil "^\\(:?[0-9a-zA-Z_-]+\\):" 1)))) ``` Jump between section beginning&end, supported by `evil-matchit` linter, install `yamllint` by `pip install --user yamllint`, it's already set up as part of flymake.
zupatol · 2022-06-06 10:02
This [lsp-mode](https://emacs-lsp.github.io/lsp-mode/page/lsp-yaml/) has folding
dzecniv · 2022-06-07 23:01
I wrote and use this package: https://github.com/vindarel/indent-tools It allows to navigate by indentation unit: go one child down, one parent up, go to the next element of the same level, go to the end of the current indentation… and we can somewhat act on indentation levels: comment indentation blocks, indent or un-indent, kill, copy, fold… It has a hydra for easy use. But see its open issues. It isn't very clean, it needs more love. It's still useful :) *(if other solutions are better plz let me know!)*