https://github.com/nwiizo/cargo.nvim
A Neovim plugin that provides seamless integration with Rust's Cargo commands. Execute Cargo commands directly from Neovim with a floating window interface.
https://github.com/nwiizo/cargo.nvim
lua neovim neovim-plugin rust rust-lang
Last synced: 18 days ago
JSON representation
A Neovim plugin that provides seamless integration with Rust's Cargo commands. Execute Cargo commands directly from Neovim with a floating window interface.
- Host: GitHub
- URL: https://github.com/nwiizo/cargo.nvim
- Owner: nwiizo
- License: mit
- Created: 2025-01-14T01:26:21.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-06T11:55:03.000Z (about 2 months ago)
- Last Synced: 2025-04-06T03:58:28.481Z (19 days ago)
- Topics: lua, neovim, neovim-plugin, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 1.27 MB
- Stars: 73
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-rust - cargo.nvim - A Neovim plugin for seamless integration with Cargo commands. (Development tools / IDEs)
- awesome-rust - cargo.nvim - A Neovim plugin for seamless integration with Cargo commands. (Development tools / IDEs)
README
# ๐ cargo.nvim
[](https://github.com/nwiizo/cargo.nvim/actions/workflows/rust.yml)
[](https://github.com/nwiizo/cargo.nvim/actions/workflows/lua.yml)---
๐ฆ A Neovim plugin that provides seamless integration with Rust's Cargo commands. Execute Cargo commands directly from Neovim with a floating window interface.

## โจ Features
- ๐ง Execute Cargo commands directly from Neovim
- ๐ช Real-time output in floating windows
- ๐จ Syntax highlighting for Cargo output
- โก Asynchronous command execution
- ๐ Auto-closing windows on command completion
- โจ๏ธ Easy keyboard shortcuts for window management## contents
- [๐ cargo.nvim](#-cargonvim)
- [โจ Features](#-features)
- [๐ฅ Installation](#-installation)
- [Using lazy.nvim](#using-lazynvim)
- [Using packer.nvim](#using-packernvim)
- [๐ Requirements](#-requirements)
- [๐ ๏ธ Available Commands](#๏ธ-available-commands)
- [โ๏ธ Configuration](#๏ธ-configuration)
- [โจ๏ธ Key Mappings](#๏ธ-key-mappings)
- [๐ฅ Contributing](#-contributing)
- [๐ License](#-license)
- [๐ Acknowledgements](#-acknowledgements)## ๐ฅ Installation
### Using [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"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"
}
}
```### Using [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
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,
}
```## ๐ Requirements
- ๐ป Neovim >= 0.9.0
- ๐ฆ Rust and Cargo installed on your system
- ๐ Additional dependencies:
- **Ubuntu/Debian:** `libluajit-5.1-dev` (Install with `sudo apt install libluajit-5.1-dev`)
- For other Linux distributions, you may need to install an equivalent LuaJIT development packageIf you encounter build errors mentioning `lluajit-5.1` during installation, you likely need to install the LuaJIT development package for your system.
## ๐ ๏ธ Available Commands
- ๐ `: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 dependencies## โ๏ธ Configuration
You can customize cargo.nvim by passing options to the setup function:
```lua
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 = "*" },
}
})
```## โจ๏ธ Key Mappings
In the floating window:
- `q` or `` - Close the window
- `` - Cancel the running command and close the window## ๐ฅ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. ๐ด Fork the repository
2. ๐ฟ Create a feature branch
3. โ๏ธ Commit your changes
4. ๐ Push to the branch
5. ๐ซ Open a Pull Request## ๐ License
MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgements
This plugin is inspired by various Neovim plugins and the Rust community.
## ๐ Related Projects
- [cargo-autodd](https://github.com/nwiizo/cargo-autodd)