1

I'm trying to enable autoformatting of Elm code (I guess the problem would be the same for any language). In Elm the elm-format program can normally used to format the code.

I see that there's an option in ALE to set the path of elm-format so I guess elm-format is supported by ALE. However I have no idea how to activate the option of autoformatting.

I can only see an option to set the path of elm-format, but I already have elm-format in the default path.

How do I enable the autoformatting ? Or maybe there's a key I have to type so that the code gets formatted? What key is it?

3
  • 1
    Have you read the README?
    – 3N4N
    Commented Oct 13, 2022 at 2:08
  • I had skimmed through it and had searched for something about my problem, but having no idea this feature was called "fixing" (I thought it would be called formatting or autoformatting), I had missed that section entirely. Thanks for poiting me to the right paragraph. It's working now. What I was missing was the let g:ale_fix_on_save = 1 Commented Oct 13, 2022 at 11:39
  • 2
    If you want to add an answer to the topic, I will happily accept it. Commented Oct 13, 2022 at 11:39

1 Answer 1

4

You have to enable the feature of automatically formatting on save. This can be done by using :h autocmd, or with the global variable ale provides which enables it. The latter is much simpler and thus preferable.

let g:ale_fix_on_save = 1

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.