Skip to content

some00/vimgcov

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License Codecov

VIMGCOV

VIMGCOV is a Vim plugin designed to display gcov coverage for C/C++ code.

Dependencies

  • Recent gcov command-line interface (with JSON output)
  • Boost (Process library)
  • pybind11
  • pkg-config
  • RapidJSON

Supported languages

  • C++
  • Rust

Installation

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 :PluginInstall

Next, 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 _build

This will create _vimgcov.<python-version>.so in the python folder. It’s a workaround, but it functions perfectly.

Usage C++

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 provider

Usage Rust

Compile and test your project with:

RUSTFLAGS="-C instrument-coverage" cargo test

The plugin will search for profraw files to visualize the coverage.

About

C/C++/Rust code coverage in vim buffer

Topics

Resources

License

Stars

Watchers

Forks