Requirement: Neovim Nightly
Using vim-plug
Plug 'TwIStOy/cpp-toolkit.nvim'
Using packer.nvim
use 'TwIStOy/cpp-toolkit.nvim'
Using lazy.nvim
{
'TwIStOy/cpp-toolkit.nvim',
cmd = {
'CppGenDef', 'CppDebugPrint', 'CppToolkit'
},
dependencies = {
'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim'
}
}
Default values:
{
'TwIStOy/cpp-toolkit.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' },
opts = {
-- ext for header files used in include-headers
header_exts = { 'h', 'hh', 'hpp', 'hxx' },
-- marker to identify project root
project_markers = { 'Makefile', 'compile_commands.json', 'CMakeLists.txt' },
-- create user command or not
cmd = true,
-- highlight group for preview
impl_preview_highlight = 'Comment',
-- "trailing" or "beginning"
-- signature:
-- void foo(int bar);
-- impl, style = "begin":
-- void foo(int bar) {
-- }
-- impl, style = "trailing"
-- auto foo(int bar) -> void {
-- }
impl_return_type_style = "beginning",
}
config = function(_, opts)
require'cpp-toolkit'.setup(opts)
end,
cmd = { 'CppGenDef', 'CppDebugPrint', 'CppToolkit', 'Telescope' },
keys = {
{
'<C-e><C-i>',
function()
vim.cmd [[Telescope cpptoolkit insert_header]]
end,
desc = 'insert-header',
mode = { 'i', 'n' },
},
},
}