This is a simple plugin to generate the compile_commands.json
file.
The main purpose of this plugin is to facilitate the generation of the compile_commands.json
file in Neovim projects, when you don't have access to other tools like bear. The compile_commands.json
file is used by various development tools for static code analysis, auto-completion, and more.
To use this plugin, follow these simple steps:
Install this plugin in your Neovim environment using your preferred method (e.g., using a plugin manager like lazy).
{
"leosmaia21/gcompilecommands.nvim",
opts = {
tmp_file_path = "$HOME/tmp/compilecommandsNEOVIM.json"
},
ft = { "c", "cpp" }, -- lazy load plugin only on C and C++ filetypes
}
In your project file, open Neovim and run the :Gcompilecommands
command. This will execute the make
command in dry-run mode to generate the compile_commands.json
file. Note that it will also run make fclean
before generating the file.
After successful execution, the compile_commands.json
file will be available for use by external tools.
Contributions are welcome! If you encounter issues, have improvements, or have ideas to make this plugin even more useful, feel free to open an issue or submit a pull request.
We hope this plugin makes generating the compile_commands.json
file a straightforward and efficient task in your Neovim projects. Enjoy!