Plugin that inserts Javadoc style comments for c++ files using Treesitter. (Treesitter is required.)
using Packer
use 'zhou-michael/cpp-javadoc'
using vim-plug
Plug 'zhou-michael/cpp-javadoc'
While hovering over a function in c++ (anywhere in the function), the :Javadoc
command will create a Javadoc above the function. Uses treesitter to find the parameter names.
Using <C-j>
(or a custom keybinding) will achieve the same effect.
Parameter descriptions can be optionally aligned:
/** Description.
@param var_a | <- Description starts here
@param var_aaa | <- aligned on this column
@param var_aaaa | <- based on the longest variable name.
*/
require('cpp-javadoc').setup({
-- your options here
})
Or pass in no arguments for default configuration.
require('cpp-javadoc').setup()
default configuration:
{
add_javadoc = '<C-j>', -- keybinding to add javadoc
silent = true, -- whether or not to print error messages
align = true, -- whether or not to align parameter descriptions
left_spaces = 4, -- number of spaces between @param tag and parameter name
right_spaces = 4, -- number of spaces between parameter name and description
}