Running the new Elixir formatter

# install erlang with homebre
brew install erlang

# install asdf to manage Elixir versions
if [ -d "$HOME/asdf" ]; then
  git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf" --branch v0.4.0
fi

# don't forget to add following part to your shell config (e.g. .bashrc)
. "$HOME/.asdf/asdf.sh"

# install elixir plugin if missing
plugins=$(asdf plugin-list)
if grep -q -v elixir <<< "$plugins"; then
  asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
fi

# install with asdf as in .tool-versions
asdf install

# install master version
asdf install elixir ref:master

# run mix format with elixir master
ASDF_ELIXIR_VERSION=ref-master mix format

I have mix_format alias in my ~/.alias

alias mix_format="ASDF_ELIXIR_VERSION=ref-master mix format"
7 Likes