diff --git a/.local/bin/etc/nvim/compiler b/.local/bin/etc/nvim/compiler index 0ac7429..b53dc30 100755 --- a/.local/bin/etc/nvim/compiler +++ b/.local/bin/etc/nvim/compiler @@ -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