4

I have recently started using ansible, and yaml-mode seemed the logical choice for editing playbooks. However, the indentation does not quite work correctly. For example, I might start a task definition like so:

- name: install packages

Adding the next line, it needs to be indented as follows:

- name: install packages
  apt: name=emacs24 state=present

However, what yaml-mode wants to do is:

- name: install packages
    apt: name=emacs24 state=present

If I tab again:

- name: install packages
apt: name=emacs24 state=present

In other words, in order to get the correct indentation, I need to manually enter the correct number of spaces instead of using the tab key. Is there a mode where I can get the correct behavior, or a way to configure yaml-mode to do what I want? Thank you!

4
  • I cannot reproduce this in the latest yaml-mode version. Please try upgrading your version and if the error still persists, hand in a bug.
    – wasamasa
    Commented Apr 7, 2016 at 18:31
  • @wasamasa I am on the most recent version through MELPA. Which version are you on (for me, yaml-mode-version returns 0.0.12)?
    – elethan
    Commented Apr 7, 2016 at 18:37
  • 0.0.12 is the latest tag, however there have been several commits since that. MELPA unstable should have a build incorporating them, are you possibly on MELPA stable?
    – wasamasa
    Commented Apr 7, 2016 at 18:49
  • @wasamasa Argggg...I am on unstable, but I just tried starting Emacs with -Q and I have the desired behavior...This has been happening a lot to me recently. I always tell people to try -Q, but rarely think to try it myself before asking a question...I guess I will get to bisecting my init once again, haha
    – elethan
    Commented Apr 7, 2016 at 19:43

1 Answer 1

3

https://github.com/k1LoW/emacs-ansible

will highlight keywords.

https://github.com/DarthFennec/highlight-indent-guides

promises to highlight indent levels, even shows a nice video of it, but I had trouble getting it working

3
  • Welcome to TeX - LaTeX! Does this help with entering indentation/reindenting? Could you perhaps post a screen shot? Commented Dec 18, 2018 at 13:13
  • If you visit that 2nd URL, there's a nice video showing what is supposed to happen - vertical lines should appear that show the current indentation level, and one dynamically highlights as you move the point, to show the current indent level. For me, even though the h-i-g minor mode is active, it seems to have no effect. Commented Dec 20, 2018 at 0:15
  • Yes, but external links tend to die. Including something directly in the answer will make it more useful in the future. Commented Dec 20, 2018 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.