vim-mix-format
vim-mix-format copied to clipboard
Allow :MixFormat command to run on eelixir filetype
Overview
With the heex formatter being added to LiveView it would be helpful to allow this plugin to run on those filetypes.
Connects #42
Notes
- Until the new version of LiveView is released with this plugin built in you'll need to manually add it to your Elixir project:
{:heex_formatter, github: "feliperenan/heex_formatter"} - If using the
vim-elixirplugin, the filetype for*.heexfiles (should) be set toeelixir. - This PR targets
eelixirfiles. I could also see adding support specifically forheexfiletype since that is the filetype that gets detected when not using thevim-elixirplugin.
Testing Instructions
- Update your
.formatter.exsto support.heexfiles - Open a
*.heextemplate in a new buffer - Ensure the
:MixFormatcommand is available and works as expected
Nothing to do with this PR, but I thought it might be useful for people who stranded here trying to get their .heex files formatted on save.
Ale has a fixer for (e)elixir. So I followed these steps: https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.HTMLFormatter.html and then in my vim config I added:
Plug 'dense-analysis/ale'
let g:ale_fixers = {
\ 'elixir': ['mix_format'],
\ 'eelixir': ['mix_format'],
\ 'scss': ['stylelint'],
\ 'css': ['stylelint'],
\ 'javascript': ['eslint'],
\ 'ruby': ['rubocop']
\}
let g:ale_fix_on_save = 1
Came here to make this exact PR. 👍