Crates.io | cargo-nvim |
lib.rs | cargo-nvim |
version | |
source | src |
created_at | 2025-01-18 03:05:36.918549+00 |
updated_at | 2025-03-06 11:54:56.814063+00 |
description | A Neovim plugin for Rust Cargo commands |
homepage | |
repository | https://github.com/nwiizo/cargo.nvim |
max_upload_size | |
id | 1521324 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
๐ฆ A Neovim plugin that provides seamless integration with Rust's Cargo commands. Execute Cargo commands directly from Neovim with a floating window interface.
{
"nwiizo/cargo.nvim",
build = "cargo build --release",
config = function()
require("cargo").setup({
float_window = true,
window_width = 0.8,
window_height = 0.8,
border = "rounded",
auto_close = true,
close_timeout = 5000,
})
end,
ft = { "rust" },
cmd = {
"CargoBench",
"CargoBuild",
"CargoClean",
"CargoDoc",
"CargoNew",
"CargoRun",
"CargoTest",
"CargoUpdate"
}
}
use {
"nwiizo/cargo.nvim",
run = "cargo build --release",
config = function()
require("cargo").setup({
float_window = true,
window_width = 0.8,
window_height = 0.8,
border = "rounded",
auto_close = true,
close_timeout = 5000,
})
end,
}
libluajit-5.1-dev
(Install with sudo apt install libluajit-5.1-dev
)If you encounter build errors mentioning lluajit-5.1
during installation, you likely need to install the LuaJIT development package for your system.
:CargoBench
- Run benchmarks:CargoBuild
- Build the project:CargoClean
- Remove generated artifacts:CargoDoc
- Generate project documentation:CargoNew
- Create a new Cargo project:CargoRun
- Run the project:CargoTest
- Run tests:CargoUpdate
- Update dependencies:CargoAutodd
- Automatically manage dependenciesYou can customize cargo.nvim by passing options to the setup function:
require("cargo").setup({
-- Window settings
float_window = true, -- Use floating window
window_width = 0.8, -- Window width (80% of editor width)
window_height = 0.8, -- Window height (80% of editor height)
border = "rounded", -- Border style ("none", "single", "double", "rounded")
-- Auto-close settings
auto_close = true, -- Auto close window on success
close_timeout = 5000, -- Close window after 5000ms
-- Command settings
commands = {
bench = { nargs = "*" }, -- Command arguments configuration
build = { nargs = "*" },
clean = { nargs = "*" },
doc = { nargs = "*" },
new = { nargs = 1 },
run = { nargs = "*" },
test = { nargs = "*" },
update = { nargs = "*" },
}
})
In the floating window:
q
or <Esc>
- Close the window<C-c>
- Cancel the running command and close the windowContributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
This plugin is inspired by various Neovim plugins and the Rust community.