helix: Add my preferred formatting for rust
This commit is contained in:
parent
f3442c8d00
commit
99bf72b351
2
bashrc
2
bashrc
@ -155,7 +155,7 @@ if [ -f .rustfmt.nightly.toml]; then
|
|||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
# ok then just run my preferred format
|
# ok then just run my preferred format
|
||||||
cargo fmt -- --config imports_granularity=crate
|
cargo +nightly fmt -- --config imports_granularity=crate
|
||||||
}
|
}
|
||||||
|
|
||||||
function spurdo() {
|
function spurdo() {
|
||||||
|
22
bin/format-rs-from-helix
Normal file
22
bin/format-rs-from-helix
Normal file
@ -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
|
5
helix/languages.toml
Normal file
5
helix/languages.toml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[[language]]
|
||||||
|
name = "rust"
|
||||||
|
auto-format = true
|
||||||
|
formatter = { command = "~/.config/bin/format-rs-from-helix" }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user