The vim-commentary plugin uses
'commentstring' to define what a comment should look like. Some languages support multiple comment formats, e.g.
/* */. Change
'commentstring to match the format that you use
However, if a project uses two different formats then you can still it becomes more challenging. I would then suggest making mappings which set
'commentstring' and then rest it after the commentary command is given with the
let s:commentary_format = &commentstring
let &commentstring = '// %s'
autocmd User CommentaryPost let &commentstring = s:commentary_format |
\ autocmd! alt_commentary
xmap <leader>gc :<c-u>call <SID>AltCommentary()<cr>gv<Plug>Commentary
nmap <leader>gc :<c-u>call <SID>AltCommentary()<cr><Plug>Commentary
nmap <leader>gcc :<c-u>call <SID>AltCommentary()<cr><Plug>CommentaryLine