vim-crates
November 11, 2019 ยท View on GitHub
When maintaining Rust projects, this plugin helps with updating the dependencies
in Cargo.toml files. It uses the crates.io API to get all
available versions of a crate and caches them.
curl needs to be installed.
-
Insert completion
If the cursor is on a version requirement and in insert mode, use
<c-x><c-u>(hold Ctrl and hit x then u) to open a completion menu with all available versions (see:h i_CTRL-X_CTRL-U). -
:CratesUp
Update the current dependency to the latest non-prerelease version.
-
:CratesToggle
For each dependency that is out-of-date, indicate the latest version as virtual text after the end of the line. Use it again to remove all indicators. This is a Nvim-only feature.
Customize the colors of the indicators like this:
highlight Crates ctermfg=green ctermbg=NONE cterm=NONE " or link it to another highlight group highlight link Crates WarningMsgUse
:verb CratesToggleto see debug messages.
Inspired by serayuzgur/crates.
Happy ๐ฆ everyone!
Configuration
Automatically run :CratesToggle when opening a Cargo.toml file:
if has('nvim')
autocmd BufRead Cargo.toml call crates#toggle()
endif
Demo
