diff --git a/bashrc b/bashrc index 916adfd..5750f0c 100755 --- a/bashrc +++ b/bashrc @@ -155,7 +155,7 @@ if [ -f .rustfmt.nightly.toml]; then exit $? fi # ok then just run my preferred format -cargo fmt -- --config imports_granularity=crate +cargo +nightly fmt -- --config imports_granularity=crate } function spurdo() { diff --git a/bin/format-rs-from-helix b/bin/format-rs-from-helix new file mode 100644 index 0000000..5251878 --- /dev/null +++ b/bin/format-rs-from-helix @@ -0,0 +1,22 @@ +!/bin/bash + +args="--emit stdout --edition 2021 --color never" + +if [ -f rustfmt.toml]; then + rustfmt $args --config-path rustfmt.toml + exit $? +fi +if [ -f .rustfmt.toml]; then + rustfmt $args --config-path .rustfmt.toml + exit $? +fi +if [ -f rustfmt.nightly.toml]; then + rustfmt +nightly $args --config-path rustfmt.nightly.toml + exit $? +fi +if [ -f .rustfmt.nightly.toml]; then + rustfmt +nightly $args --config-path .rustfm.nightly.toml + exit $? +fi +# ok then just run my preferred format +rustfmt +nightly $args --config imports_granularity=crate diff --git a/helix/languages.toml b/helix/languages.toml new file mode 100644 index 0000000..c047134 --- /dev/null +++ b/helix/languages.toml @@ -0,0 +1,5 @@ +[[language]] +name = "rust" +auto-format = true +formatter = { command = "~/.config/bin/format-rs-from-helix" } +