VIMGCOV is a Vim plugin designed to display gcov coverage for C/C++ code.
- Recent gcov command-line interface (with JSON output)
- Boost (Process library)
- pybind11
- pkg-config
- RapidJSON
- C++
- Rust
To install the plugin, use your preferred plugin manager and include this repository and its dependencies in your .vimrc:
" in .vimrc for Vundle
:Plugin 'google/vim-maktaba'
:Plugin 'google/vim-coverage'
:Plugin 'some00/vimgcov'
" then execute :PluginInstallNext, install the native Python module:
cd ~/.vim/bundle/vimgcov
cmake -S . _build \
-DENABLE_TESTS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build _buildThis will create _vimgcov.<python-version>.so in the python folder. It’s a workaround, but it functions perfectly.
The plugin searches for .gcno files recursively in the current working directory and assumes that gcov returns absolute paths for sources, which is typical for CMake-based projects. It works best when Vim is started from the root of the source tree with a build folder created there.
To use, open a source file and execute:
:CoverageToggle! " command from vim-coverage, for which this repo is a providerCompile and test your project with:
RUSTFLAGS="-C instrument-coverage" cargo testThe plugin will search for profraw files to visualize the coverage.