Rust + vim + code completion

Step-by-step guide / macOS, M1, everything without sudo

Sorin
rust_sections

--

Today we’ll learn how one can use vim to build Rust apps and still benefit of the most common tools that other (“modern”) software development environments like Visual Studio [Code], Xcode, and so on, provide; such as language analysis and code completion, two that are, from my point of view, among the most important, if not the very top instead.

I’ll start with a small diagram showing the way we’d eventually have our system set up, with names for each “wheel” of the engine; then I’ll dig down a bit describing each piece (in short), with links for more details, and providing shell commands and config to use to have everything installed and running well.

Essentially we’ll go with these two “main” items and their dependencies:

  • rust.vim — “official” tool for [basic] things like Rust syntax highlighting, code formatting, and without completion support;
  • coc-rust-analyzer — code completion provider that relies on a few “third party” packages and (set up as a coc.nvim plugin) requires node too, but it is apparently recommended by the Rust team as well, as you can read in the rust-analyzer “adoption” blog post published earlier this year.

Rust

--

--

Sorin
rust_sections

Software Developer • Rust, Swift, WPF, Web • MacBook enthusiast • fashion design • EDM • absurdism • writing from Cluj