[Solved] Vim/neovim + rust: how to run "cargo check"

#1
  1. I have a working neovim/rls/rust setup. Warnings/errors are displayed inline in the vim buffers in yellow/red.

  2. I’d still like to be able to run “cargo check” and then go to next error via :cn (for example, when the file I’m editing has no errors, but I know other files has errors.)

  3. I also know about :RustTest – but it requires the cursor to be over the test I want to run. Is there something like “run last test”? (This way, when developing, I can call :RustTest once on the test I want to run, then continuously spam “;rr” after every edit [even when cursor is not over the last test]).

0 Likes

#2

Run :compiler cargo (I do so in after/ftplugin/rust), then you can do all of :make c, :make b, :make t, aka :make check, :make build, :make test) and populate the quickfix list with it. Also works with :make clippy. Not sure about your last one, I simply run :make t testname if need be, and if it’s too much to type, I use q:.

1 Like

#3

:make c is awesome. thanks!

0 Likes