• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim integration for the Elixir formatter.

vim-mix-format

Elixir 1.6 introduced the formatter: mix format. This plugin makes it easy to run the formatter asynchronously from within Vim 8 and Neovim.

demo

Installation

Use your favorite plugin manager, e.g. vim-plug:

Plug 'mhinz/vim-mix-format'

Commands

  • To format the current file, use :MixFormat. Use :verb MixFormat to see the exact shell command used.

  • The formatter is not perfect yet, so :MixFormatDiff will open a diff window that can be used for previewing the changes or picking only those that seem reasonable.

    dp pushes changes from the diff window to the source file. q closes the diff window. ]c and [c jump between the changes.

    If you're not used to Vim's diff mode, watch this screencast.

Options

  • Automatically format on saving.

    let g:mix_format_on_save = 1
  • Set options for the formatter. See mix help format in the shell.

    let g:mix_format_options = '--check-equivalent'
  • By default this plugin opens a window containing the stacktrace on errors. With this option enabled, there will be just a short message in the command-line bar. The stacktrace can still be looked up via :messages.

    let g:mix_format_silent_errors = 1
  • If you're not using Elixir 1.6 in your project, but want to use the formatter anyway, you can specify the bin directory of an alternative Elixir installation:

    let g:mix_format_elixir_bin_path = '~/repo/elixir/bin'

Customization

When using :MixFormatDiff, a new diff window will be opened and an user event is emitted. It can be used to set different settings or switch back to the source window:

autocmd User MixFormatDiff wincmd p

Feedback

If you like this plugin, star it! It helps me deciding which projects to spend more time on.

More Repositories

1

vim-galore

🎓 All things Vim!
Vim Script
16,758
star
2

vim-startify

🔗 The fancy start screen for Vim.
Vim Script
5,301
star
3

vim-signify

âž• Show a diff using Vim its sign column.
Vim Script
2,689
star
4

neovim-remote

👌 Support for --remote and friends.
Python
1,735
star
5

vim-grepper

👾 Helps you win at grep.
Vim Script
1,212
star
6

dotfiles

😈 Vim, git, zsh, tmux, and other goodies.
Shell
314
star
7

vim-sayonara

👺 Sane buffer/window deletion.
Vim Script
292
star
8

vim-janah

Vim colorscheme.
Vim Script
194
star
9

vim-rfc

📓 Query RFC database and download RFCs from within Vim.
Vim Script
108
star
10

vim-crates

Handle Cargo dependencies like a Rustavimean.
Vim Script
90
star
11

vim-lookup

Jump to the definition of variables or functions in VimL code.
Vim Script
58
star
12

vim-tree

🌲 Use tree(1) for quick navigation.
Vim Script
57
star
13

vim-hugefile

Speed up loading of large files.
Vim Script
55
star
14

vim-halo

😇 Visual highlight for your cursor.
Vim Script
49
star
15

vi-editor-history

Short history of editors.
46
star
16

vim-randomtag

💡 Jump to random Vim documentation.
Vim Script
42
star
17

spotlight-cli

 Command-line tool for Spotlight.
Shell
36
star
18

brew-go

Manage Go tools via Homebrew.
Ruby
28
star
19

node-thesaurus-com

Look up synonyms/antonyms on thesaurus.com.
JavaScript
17
star
20

flauschix

My new POSIX-like operating system.
C
6
star
21

let-me-work

Chrome extension that helps focusing.
JavaScript
5
star
22

c-corner

C
4
star
23

gomali

Simple Markdown linter.
Go
4
star
24

sweepy

A simple threaded ping sweeping tool.
C
2
star