A powerful Neovim plugin that lets you compile and run C++ code with a single keypress, featuring dedicated input/output panes for a seamless development experience.
- Single-key execution - Press
F5to instantly compile and run your C++ code - Dedicated I/O panels - Separate panes for inputs and outputs
- Fully customizable - Configure window layout, key bindings, and compilation flags
- Performance optimized - Minimal overhead for quick testing iterations
Using packer.nvim
use {
'ankit02327/neovim-cpp-runner',
config = function()
require('neovim-cpp-runner').setup()
end
}Using lazy.nvim
{
'ankit02327/neovim-cpp-runner',
config = true,
lazy = false,
}Using vim-plug
Plug 'ankit02327/neovim-cpp-runner'
" In your init.vim, after plug#end():
lua require('neovim-cpp-runner').setup()- Open a
.cppfile in Neovim - Edit
input.txt(left panel) with your test cases - Press
F5to:- Compile your code
- Run with the provided input
- Display output in
output.txt(bottom panel)
- Type the following to exit at once:
:qa
The plugin works out of the box with sensible defaults, but you can customize it to suit your needs:
require('neovim-cpp-runner').setup({
-- Window layout options
code_width = 0.8, -- 80% width for code
input_height = 0.3, -- 30% height for input
output_height = 0.3, -- 30% height for output
-- File options
input_file = "input.txt",
output_file = "output.txt",
-- Compilation options
compile_command = "g++ % -o %< && %< < {input} > {output}",
})The plugin works great with C++ LSPs like clangd for a complete development environment.
- Neovim 0.8+
- g++ compiler
- Ubuntu/Debian:
sudo apt install g++ - macOS: Install via Homebrew with
brew install gcc - Windows: Install MinGW or use WSL
- Ubuntu/Debian:
Contributions are welcome! Feel free to open issues or submit pull requests.
MIT Β© Ankit
If you find this plugin useful, consider starring it on GitHub!