diff --git a/after/ftplugin/rust.vim b/after/ftplugin/rust.vim new file mode 100644 index 0000000..e95015a --- /dev/null +++ b/after/ftplugin/rust.vim @@ -0,0 +1,12 @@ +"" Settings for Rust + +"" Fix a Rust file: auto-format with ``rustfmt`` +function! AutofixRust() + echom "Correcting Rust file" + if executable("rustfmt") + execute ":silent %!rustfmt" + endif + :w +endfunction + +map :call AutofixRust()