Format elixir on save VIM

To answer your original problem:

autocmd BufWritePre *.ex,*.exs execute "!mix format %"

I use coc-elixir along coc.nvim… which provides coc-settings.json that can be used to configure formatting options.

https://github.com/elixir-lsp/coc-elixir

https://github.com/neoclide/coc.nvim