Right way to set up Rust using Vim

2.8k views Asked by At

I've finally started to dive into Rust and want to clarify some issues when it comes to setting up everything nicely.

I'm using vim on Linux and found a nice plugin for syntax highlighting. Autocompletion is somewhat troublesome though, using phildawes/racer.

The plugin needs the src location for Rust which is in fact not that big of a deal, if I would know where said directory was (I only found the binaries and libs when using the suggested curl <...> | sh install). The sources are downloadable separately, although I didn't find an install for Rust that sets up the sources in let's say e.g. /usr/local/src/rust only the binaries and libs.

Second I've looked through the Cargo docs and and didn't find anything to where the extern dependencies are cloned into (wouldn't this be the source directory?)

Also should the Rust sources be updated setting up everything manually is kind of lame?

Is the quintessence to clone the Rust repository and build it yourself?

1

There are 1 answers

3
tilpner On BEST ANSWER

The plugin needs setting up the src location for rust which is in fact not that big of a deal, if I would know where said directory was

I couldn't find the sources either. If you just want the sources without all the history:

For 1.0.0,

git clone --depth=1 --branch 1.0.0 --single-branch https://github.com/rust-lang/rust/

or for nightly

git clone --depth=1 --single-branch https://github.com/rust-lang/rust/

Second I've looked through the cargo docs and and didn't find anything to where the extern dependencies are cloned into (wouldn't this be the source directory?)

In the standard installation, there's a directory .cargo in your home directory, which contains git/checkouts for the cloned crates.

You should probably try multirust though, which allows you to easily manage multiple Rust installations in ~/.multirust.

With multirust, your crate checkouts might be in e.g. ~/.multirust/toolchains/nightly/cargo/git/checkouts, not ~/.cargo/git/checkout.

Is the quint essence to clone the rust repository and build it yourself?

No, that's luckily not necessary anymore, unless you're working on the compiler/stdlibs, or trying to cross-compile. With multirust, updating is reduced to multirust update or multirust update nightly, etc.