https://github.com/ericnantel/vim-cmake
Vim/Neovim plugin to build presets/workflow cmake projects
https://github.com/ericnantel/vim-cmake
build-tool cmake cmakelists cmakepresets cmakeworkflow neovim plugin vim vimscript
Last synced: 2 months ago
JSON representation
Vim/Neovim plugin to build presets/workflow cmake projects
- Host: GitHub
- URL: https://github.com/ericnantel/vim-cmake
- Owner: ericnantel
- License: bsd-3-clause
- Created: 2025-11-11T14:53:46.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-11-27T20:05:53.000Z (4 months ago)
- Last Synced: 2025-11-30T11:29:48.045Z (4 months ago)
- Topics: build-tool, cmake, cmakelists, cmakepresets, cmakeworkflow, neovim, plugin, vim, vimscript
- Language: Vim Script
- Homepage:
- Size: 1.45 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vim/Neovim Plugin for Presets/Workflow CMake Projects
*Written by Eric Nantel*

## From the author
I wrote this plugin (first one) using Vimscript so that I could run cmake commands within Vim/Neovim ecosystem.
I have not found another plugin that supported the 'New' way of creating cmake projects with presets and workflows.
So I make this. I am hoping you will find this useful in your workflow for building apps and frameworks with cmake.
One important aspect I wanted to focus on, was to be as less intruisive as possible, and that we can integrate it fast.
## Prerequisites
* cmake installed
* Projects must include both CMakePresets.json and CMakeFiles.txt files
## Installation
In Vim using vim-plug, place this repository within vim-plug begin/end calls:
```vim
call plug#begin('~/.vim/plugged')
Plug 'ericnantel/vim-cmake'
call plug#end()
```
In Neovim using lazy.nvim, place this repository along with other plugins:
```lua
require("lazy").setup({
spec = {
{
"ericnantel/vim-cmake",
},
},
})
```
## Features
* Supports CMake presets
* Supports CTest & GoogleTest presets
* Supports CMake Workflow presets
* Supports [Bear](https://github.com/rizsotto/Bear) if available
* (Coming soon) Supports Ease integration with LSP and DAP
* (Coming soon) Supports Switching presets or workflow presets
* (Coming soon) Supports Command Log Window customization
## Useful links
* [YouTube Tutorial](https://youtu.be/THgvJIJIHV4)
* [CMake Examples](https://github.com/ericnantel/cmake_examples)
## Known issues
## Commands and Global Variables
Available Commands:
* CMakeListPresets()
* CMakeListPresetVariables(preset)
* CMakePreset(preset)
* CMakeFreshPreset(preset)
* CMakeBuildPreset(preset)
* CMakeTestPreset(preset)
* CMakeWorkflowListPresets()
* CMakeWorkflowPreset(preset)
* CMakeWorkflowFreshPreset(preset)
* CMakeCloseCommandLogWindow()
For example, in Vim:
```vim
nnoremap CMakeListPresets
nnoremap CMakeFreshPreset default
nnoremap CMakeBuildPreset default
nnoremap CMakeWorkflowFreshPreset default
```
For example, in Neovim:
```lua
vim.keymap.set("n", "", "CMakeListPresets", { desc = "CMake List Presets" })
vim.keymap.set("n", "", "CMakeFreshPreset default", { desc = "CMake Fresh Preset 'default'" })
vim.keymap.set("n", "", "CMakeBuildPreset default", { desc = "CMake Build Preset 'default'" })
vim.keymap.set("n", "", "CMakeWorkflowFreshPreset default", { desc = "CMake Workflow Fresh Preset 'default'" })
```
Available Global Variables:
* g:cmake_bear_intercept (disabled by default)
For example, in Vim you can enable bear intercept (if installed):
```vim
let g:cmake_bear_intercept = 1
```
## Thank you
You made it this far ! Thank you !
We stronly encourage you to give this repository a GitHub :star: to boost organic growth.