Skip to content

ankit02327/nvim-cpp-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

image image

C++ Runner for Neovim πŸš€

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.

✨ Features

  • Single-key execution - Press F5 to 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

πŸ“¦ Installation

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()

🎯 Usage

  1. Open a .cpp file in Neovim
  2. Edit input.txt (left panel) with your test cases
  3. Press F5 to:
    • Compile your code
    • Run with the provided input
    • Display output in output.txt (bottom panel)
  4. Type the following to exit at once:
    :qa

βš™οΈ Configuration

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}",

})

πŸ” Advanced Usage

Integration with LSP

The plugin works great with C++ LSPs like clangd for a complete development environment.

βœ”οΈ Requirements

  • 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

🀝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

πŸ“œ License

MIT Β© Ankit


If you find this plugin useful, consider starring it on GitHub!

About

πŸš€ Neovim plugin to compile/run C++ code - Input/Output panels built in!

Topics

Resources

License

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages