2

With Commentary I've set the commentstring for markdown:

autocmd FileType markdown setlocal commentstring=<!--\ %s\ -->

When I visually select the lines and gc

a
b
c

I get

<!-- a -->
<!-- b -->
<!-- c -->

where I'd prefer a single block like

<!-- 
a
b
c 
-->

Is this possible with this or another plugin?

1
  • Commentary explicitly uses single-line comments (easier to parse and handle, every time), so I doubt it can do what you’re after. – D. Ben Knoble Dec 4 '20 at 3:17
1

Thanks @D. Ben Knoble - I switched to tcomment_vim

Plug 'tomtom/tcomment_vim'
[..]


let g:tcomment#block_fmt_xml = {
            \ 'commentstring': "<!--%s-->\n",
            \ 'replacements': g:tcomment#replacements_xml
            \ }
call tcomment#type#Define('markdown', g:tcomment#inline_fmt_xml )
call tcomment#type#Define('markdown_block', g:tcomment#block_fmt_xml )

I've changed the commentstring so I does not prefix any spaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.