coman.nvim icon indicating copy to clipboard operation
coman.nvim copied to clipboard

neovim plugin for comment and annotation

Comment and Annotation

Notice current only work with backend language

Install

-- if you like to use annotation you need install treesitter
packer.use('nvim-treesitter/nvim-treesitter')
packer.use('glepnir/coman.nvim')

Option

custom_template -- table custom the Annotation tempaltes.

Comment

comment use commentstring, so you can check the commentstring of your file.

vim.keymap.set('n','gcc','<cmd>ComComment<cr>',{noremap = true,silent = true})
vim.keymap.set('x','gcc',':ComComment<cr>',{noremap = true,silent = true})

Annotation

Annotation need nvim-treesitter

vim.keymap.set('n','gcj','<cmd>ComAnnotation<Cr>',{noremap = true,silent = true})
  • custom annotation tempaltes

you can overwrite or custom the annotation tempaltes for your language.

local custom_template = require('coman').custom_template
-- tbl is the function relate table. index 1 is function name
-- others are params name with type (if have)
custom_template['c'] = function(tbl, cms)
  return {}
end

Show

image

Liencese MIT