JorisE/yapfify

Having way to customize .style.yapf using only emacs configs.

Closed this issue · 3 comments

It should be great to having ability to configure yapfify using customize from emacs. Actually, I need to have settings to format yaml with 2 tabs as space and python code with 4 tabs. Why ? I use Ansible community recommendation.

Ty.

I'm not sure I understand what you mean. Yapf does not format yaml files.

For sure. But, I search a good Yaml fornatter for emacs and I tried autopep8. (It work well !) So, if I don't find good Yaml fornatter as base for emacs then I will explore if we can adapt python fornatter. There is lots of rules we can wrap up between bot fornatter. Proof (maybe) autopep8 for python and yaml.

I understand that we can prefer simplicity and just forking yapf for some behavior than taking risk to augment code complexity for out of initial scope feature (more thinking is required here).

I had no idea that autopep8 works on yaml files, but yapf definitely doesn't. Have you tried yaml-mode for emacs? It doesn't format existing files like yapf, but it will help you formatting yaml files as you type.

There is also an ansible layer for spacemacs https://github.com/syl20bnr/spacemacs/tree/master/layers/+tools/ansible. I have not tried it, but it looks like it does what you are looking for.