Skip to content

Handle Cargo dependencies like a Rustavimean.

License

Notifications You must be signed in to change notification settings

mhinz/vim-crates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vim-crates

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 WarningMsg

    Use :verb CratesToggle to 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

About

Handle Cargo dependencies like a Rustavimean.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published