Forge your code without leaving Neovim — complete build, run, and debug workflow.
- Build System Integration - Seamless workflow for building and running projects
- Multi-Language Support - CMake (C/C++) and Cargo (Rust) with extensible architecture
- Debugger Support - Integrated debugging workflow with DAP
- Persistent Notifications - Real-time feedback with spinner animations for long-running operations
- Smart Project Detection - Automatically detects project type and configures available actions
- Test Integration - Discovery and execution of tests with test-specific debugging
- Module-Based Architecture - Extensible design supporting multiple build systems
Foundry works out of the box with no required dependencies. However, optional integrations enhance the experience:
Recommended:
- fidget.nvim - Beautiful notifications with spinner animations
- overseer.nvim - Enhanced task runner with UI
For CMake projects:
- CMake 3.19+ (for presets support)
- C/C++ compiler toolchain
For Cargo (Rust) projects:
- Rust toolchain (cargo, rustc)
- DAP adapter for Rust debugging (e.g., codelldb, lldb-vscode)
{
'bransay/foundry.nvim',
dependencies = {
'j-hui/fidget.nvim', -- Optional but recommended
'stevearc/overseer.nvim', -- Optional but recommended
},
config = function()
require('foundry').setup()
end,
}use {
'bransay/foundry.nvim',
config = function()
require('foundry').setup()
end,
}Plug 'bransay/foundry.nvim'
" In your init.vim or init.lua
lua require('foundry').setup()Minimal setup with defaults:
require('foundry').setup()All options are optional. Foundry provides sensible defaults.
require('foundry').setup({
-- Custom task runner (defaults to vim.system if overseer not available)
task = function(name, cmd, cwd)
-- Your custom task implementation
-- Return true on success, false on failure
end,
})Run :Foundry with no arguments to open the interactive menu:
:FoundryThe menu displays available actions based on your detected project type.
You can also run actions directly:
:Foundry Generate " Configure the project (CMake)
:Foundry Build " Build selected target
:Foundry Build All " Build all targets
:Foundry Check " Run cargo check (Cargo only)
:Foundry Clean " Clean build artifacts
:Foundry Run " Run the executable
:Foundry Debug " Debug the executable
:Foundry Test " Run tests
:Foundry Debug Test " Debug a specific test
:Foundry Options " Configure settingsTab completion is available for all subcommands.
| Action | CMake | Cargo | Description |
|---|---|---|---|
| Generate | ✓ | - | Configure project with presets |
| Build | ✓ | ✓ | Build selected target |
| Build All | ✓ | ✓ | Build all targets |
| Check | - | ✓ | Run cargo check |
| Clean | - | ✓ | Remove build artifacts |
| Run | ✓ | ✓ | Run the executable |
| Debug | ✓ | ✓ | Launch debugger |
| Test | ✓ | ✓ | Run tests |
| Debug Test | ✓ | ✓ | Debug a specific test |
| Options | ✓ | ✓ | Configure settings |
Foundry currently supports CMake projects out of the box. Here's a typical workflow:
Open any directory containing a CMakeLists.txt file. Foundry automatically detects it as a CMake project.
:Foundry GenerateSelect a preset when prompted. Foundry creates the build directory and configures the project.
:Foundry BuildSelect a target to build. Foundry shows a spinning notification during the build process.
:Foundry Run " Run the executable
:Foundry Debug " Launch the debugger:Foundry Test " Run a specific test
:Foundry Debug Test " Debug a test with full debuggerRun :Foundry Options to configure:
- Build Directory - Where build artifacts are stored (default:
build/<preset>) - Preset - CMake preset to use
- Target - Default build target
- Executable Path - Path to the built executable
- Executable Arguments - Command-line arguments for run/debug
- Debugger Language - Language for debugger (C++, C, etc.)
- Build Before Run - Automatically rebuild before running
When fidget.nvim is installed, Foundry uses it for all notifications:
- Persistent notifications - Long-running operations stay visible until completion, so you know immediately when a task is still running
- Grouped notifications - All Foundry messages are grouped together under the anvil icon (), keeping them separate from other plugin notifications
Without fidget, Foundry falls back to Neovim's built-in vim.notify().
When overseer.nvim is installed, Foundry uses it as the task runner for better task management and output handling.
Without overseer, Foundry uses a simple vim.system()-based runner.
Foundry is designed to support multiple build systems through project modules.
A project module must implement two functions:
local M = {}
-- Detect if this project type exists at the given root directory
function M.detect(root)
-- Return true if project detected, false otherwise
return vim.fn.filereadable(root .. '/CMakeLists.txt') == 1
end
-- Return list of available actions for this project type
function M.actions()
return {
{ name = 'Build', action = M.build },
{ name = 'Run', action = M.run },
-- ... more actions
}
end
return MAdd your module to the registry in lua/foundry/discover.lua:
local project_modules = {
['CMake'] = require('foundry.cmake'),
['MyBuildSystem'] = require('foundry.my_build_system'),
}When Foundry starts:
- Calls
detect(root)on all registered modules - If exactly one module detects → auto-activated
- If multiple modules detect → user selects from detected list
- Selected module's
actions()populate the:Foundrymenu
The action names (with spaces removed) become subcommands: :Foundry Build, :Foundry Run, etc.
GPL v3