Nvim Cargo Add banner
nwiizo nwiizo

Nvim Cargo Add

Development community

Description

A Neovim plugin written in Rust that provides commands for managing Cargo dependencies directly from your editor.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

nvim-cargo-add

A Neovim plugin for managing Cargo dependencies with auto-completion and floating window preview. This plugin provides a seamless interface for adding, removing, and managing Rust dependencies directly from Neovim.

Features

  • Add dependencies with auto-completion from crates.io
  • Add development dependencies
  • Remove dependencies with auto-completion from current project
  • List current dependencies in a floating window
  • Auto-format Cargo.toml after changes
  • Floating window preview for crate information
  • Tab completion for crate names and versions

Prerequisites

Installation

Using [lazy.nvim](https://github.com/folke/lazy.nvim):

{
    "nwiizo/nvim-cargo-add",
    dependencies = { "saecki/crates.nvim" },
    build = function()
        vim.notify("Building nvim-cargo-add...", vim.log.levels.INFO)
        local result = vim.fn.system("cargo build --release")
        vim.notify("Build result: " .. result, vim.log.levels.INFO)
    end,
    config = function()
        require("nvim_cargo_add").setup({
            auto_format = true,    -- Enable automatic formatting
            float_preview = true,  -- Enable floating window preview
        })
    end,
    ft = { "toml" },  -- Load when editing Cargo.toml
    cmd = {
        "CargoAdd",
        "CargoAddDev",
        "CargoRemove",
        "CargoDeps"
    }
}

Usage

Commands

  • `:CargoAdd [version]` - Add a new dependency

    • Example: :CargoAdd serde 1.0
    • Use Tab for auto-completion and preview
  • `:CargoAddDev [version]` - Add a new development dependency

    • Example: :CargoAddDev pretty_assertions
    • Use Tab for auto-completion and preview
  • `:CargoRemove ` - Remove a dependency

    • Example: :CargoRemove serde
    • Auto-completes with current project dependencies
  • `:CargoDeps` - List all current dependencies in a floating win