Skip to content

Plugin for Nvim to give funcionalities witch is not included in Clangd like, Remove Unused includes, Generate a .cpp from .hpp

License

Notifications You must be signed in to change notification settings

shadowchiki/nvim-cpp-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nvim-Cpp-Tools

Nvim-Cpp-Tools is a plugin to give more functionality than Clangd can do natively With this Plugin you can auto generate .cpp imeplementation from a .hpp, hxx, h file Remove unused includes. This plugin is developed using Treesitter

Index

  1. Requirements
  2. Configure
  3. Commands
  4. Default keymaps
  5. Examples

Requirements

These are the requirements of the functionalities that I would like the plugin to have This is what i expect, if you have some suggestion contact me via mail.

General Requirements

  • Must be able to remove unused includes.

Auto generate implementations of header file

  • Must be able to allow to implement the inheritance methods that could have override the pure virtual parent methods.
  • Read attributes and set them to be automatically initialized in the constructor as if it had a parent.
  • Template classes
  • Ask you in which path you want to create the file.
  • Initialize the attributes of the class with the parameters of the constructor, the search must be by type, if there are several parameters of that type, make a comparison by name, if it does not contain the text, the first attribute found of the same type is put.
  • Generate getters and setters
  • Select a method and generate it.

Refactoring requirements

  • Allows to select a method and generate a local variable or attribute from the return of the function.
  • Allows to mark (v) a block of code and export it in a function intuiting what kind of return is needed.
  • It must allow that if a method returns a variable, it allows to generate a variable of the return type with a default name.
  • The plugin must be able to refactor a class, change any comment of the class and put the new name in all the classes that use it.

Configure

LazyVim

{
 "shadowchiki/nvim-cpp-tools",
 dependencies = {
  "nvim-treesitter/nvim-treesitter",
 },
 config = function()
  require("nvim-cpp-tools")
 end,
}

Commands

Name Description Command
Remove Unused Includes Remove the unsued includes detected in a file :RemoveUnusedIncludes
Generate Cpp Implementation Creates a complete implementation of a header file to a implementation file :GenerateCppImplementation
Generate Method Implementation Creates a implementation of a method from header file to a implementation file :GenerateMethodImplementation

Default keymaps

Keymap Command
<leader>co :RemoveUnusedIncludes
<leader>ci :GenerateCppImplementation
<leader>cI :GenerateMethodImplementation

Examples

About

Plugin for Nvim to give funcionalities witch is not included in Clangd like, Remove Unused includes, Generate a .cpp from .hpp

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published