https://github.com/martuscellifaria/ahoicpp.nvim
A.H.O.I. Labs (Alex's Heavily Opinionated Interfaces) C++ Project plugin for Neovim
https://github.com/martuscellifaria/ahoicpp.nvim
bootstrapper build-tool cmake cplusplus cpp cross-platform lua neovim neovim-plugin project-management project-scaffolding
Last synced: 2 months ago
JSON representation
A.H.O.I. Labs (Alex's Heavily Opinionated Interfaces) C++ Project plugin for Neovim
- Host: GitHub
- URL: https://github.com/martuscellifaria/ahoicpp.nvim
- Owner: martuscellifaria
- License: mit
- Created: 2026-03-27T07:40:43.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-14T15:22:09.000Z (2 months ago)
- Last Synced: 2026-04-14T17:20:03.402Z (2 months ago)
- Topics: bootstrapper, build-tool, cmake, cplusplus, cpp, cross-platform, lua, neovim, neovim-plugin, project-management, project-scaffolding
- Language: Lua
- Homepage:
- Size: 1.48 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim-sorted - martuscellifaria/ahoicpp.nvim
- awesome-neovim - martuscellifaria/ahoicpp.nvim - Sets up C++ projects on a modular fashion and helps newcomers with the language heavy lifting. (Project / Assembly)
README
# AhoiCpp
[](https://opensource.org/licenses/MIT)
[](https://neovim.io/)
A.H.O.I. Labs (Alex's Heavily Opinionated Interfaces) presents you `AhoiCpp`.
AhoiCpp is an opinionated way to start cross platform C++ projects in Neovim.
AhoiCpp lets you create classes, libraries and your own app entrypoint with the respective build process.
## Dependencies
AhoiCpp assumes you have a C++ 23 capable compiler (I use g++ 14.3.0 on my development environment), `cmake`, `git` and `python` installed. If not, you should do it first.
Of course you have to have `Neovim` as well, version `0.11` or higher is recommended, since some `vim.api` and `vim.fn` functions are new.
## Installation
### Using [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
'martuscellifaria/ahoicpp.nvim',
config = function()
require('ahoicpp').setup()
end,
}
```
### Manual Installation
Clone the repository and add it to your Neovim runtime path:
```bash
git clone https://github.com/martuscellifaria/ahoicpp.nvim ~/.config/nvim/pack/plugins/start/ahoicpp.nvim
```
## Usage
### Default Keymaps
| Command | Description |
| ------------- | ---------------------------------------------------------------------------- |
| `cph` | Opens the about/help menu from AhoiCpp |
| `cpa` | Creates C++ application with respective CMake files and scripts |
| `cpm` | Creates C++ class within modules directory and add CMake files |
| `cpd` | Creates C++ class within custom named directory and add CMake files |
| `cpe` | Clones external Git repository to the externals directory of the C++ project |
| `cpt` | Toggles autocompilation at module and/or app creation (enabled by default) |
| `cpc` | Compiles the current C++ project |
### Configuration
AhoiCpp provides a configurable interface. The default follows:
```lua
{
autocompile_on_create = true,
enable_popups = true,
git_init = true,
keymaps = {
group_c = "c",
group_cp = "cp",
help = "cph",
create_app = "cpa",
create_module = "cpm",
create_module_dir = "cpd",
clone_external = "cpe",
toggle_autocompile = "cpt",
compile = "cpc",
},
}
```
You are also able to override the keymap bindings, for example:
```lua
{
'martuscellifaria/ahoicpp.nvim',
config = function()
require('ahoicpp').setup({keymaps = {compile = "cc"}})
end,
}
```
### Project structure
After running `cpa YourApp`:
```
YourApp/
├── .ahoicpp
├── .gitignore
├── .git/
├── CMakeLists.txt
├── AhoiCppProject.cmake
├── AhoiCppExternals.cmake
├── build.py
├── App/
│ ├── AhoiCppSubdirs.cmake
│ ├── CMakeLists.txt
│ ├── src/
│ │ └── YourApp.cpp
│ └── version.h.in (or version.rc.in)
├── Modules/ (created when you add modules)
└── externals/ (created for Git dependencies)
└── README.md
```
## Demo
### Creating and getting your first C++ app compiled

### Adding new classes to your project

### Adding external dependencies from git repositories

## Check Health
For health status of AhoiCpp, you can always run `:checkhealth ahoicpp` from the Neovim command line.
## Tests
### Running tests
AhoiCpp uses [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) for testing. To run the tests:
1. Ensure Plenary.nvim is installed.
2. Navigate to the plugin directory:
```bash
cd ~/.local/share/nvim/lazy/ahoicpp.nvim
```
3. Run the tests from the command line:
```bash
nvim --headless -c "lua require('plenary.test_harness').test_directory('tests/spec', { minimal_init = 'tests/minimal_init.lua' })" -c "qa"
```
You can of course run the tests from inside Neovim. Just navigate to the directory where ahoicpp is installed, open neovim and then run:
```vim
:lua require('plenary.test_harness').test_directory('tests/spec', { minimal_init = 'tests/minimal_init.lua' })
```
For single file testing, you can use:
```vim
:lua require('plenary.test_harness').test_file('tests/spec/utils_spec.lua', { minimal_init = 'tests/minimal_init.lua' })
```
### Test tree
The tests for AhoiCpp are structured as follows:
```
tests/
├── minimal_init.lua # Test environment setup
└── spec/
├── utils_spec.lua # Filesystem and validation tests
├── config_spec.lua # Configuration tests
├── templates_spec.lua # Template generation tests
├── project_spec.lua # Project creation tests
└── build_spec.lua # Build system tests
```
## Troubleshooting
| Error | Solution |
| ---------------------------- | -------------------------------------- |
| "AhoiCpp is not initialized" | Run `cpa` first |
| "Python not found" | Install Python and ensure it's in PATH |
| Compilation fails | Check `build/build.log` |
## License
MIT (see [LICENSE](LICENSE) for details)