1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-12 20:41:16 +02:00

nvim: improved rust compiler to use cargo

This commit is contained in:
tiyn
2025-10-11 03:14:08 +02:00
parent 4cc268f424
commit 9734aa56ad

View File

@@ -42,6 +42,8 @@ case "$file" in
*\.lua) lua "$file" ;;
*\.sent) setsid sent "$file" 2>/dev/null & ;;
*\.r|*\.R) Rscript "$file" ;;
*\.rs) rustc "$file" && "$base" ;;
*\.rs) (cd "$dir" && cargo locate-project >/dev/null 2>&1) \
&& (cd "$(dirname "$(cd "$dir" && cargo locate-project --message-format plain)")" && cargo run) \
|| (rustc "$file" && "./$(basename "${file%.rs}")") ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac