Closed rpietro closed 6 years ago
Check :verbose set commentstring?
@rpietro I had a similar problem, when I ran verbose set commentstring?
I got commentstring=> %s
.
I moved my line autocmd FileType markdown setlocal commentstring=<!--\ %s\ -->
to the end of my .vimrc
file and suddenly I got commentstring=<!-- %s -->
.
My commentstring
command for MATLAB worked just fine before the move, and I don't know why it works for markdown now, but maybe this works for you as well! :)
The problem is that is that autocommands run in the order they are defined, so if you define your autocommand before filetype on
, the filetype plugin will override your autocommand. The only 100% surefire way to avoid ordering issues is to use "after" runtime files, e.g. ~/.vim/after/ftplugin/markdown.vim
. But I hate having a bunch of tiny files, so I generally just arrange my vimrc correctly and hope filetype off|filetype on
doesn't get called during runtime.
Ah, I had indeed filetype on
after the commentstring commands! But MATLAB didn't need the filetype on
, but it did need the commentstring command... Anyways, thanks for the explanation!
I saw that commentstring=>\ %s
is in markdown.vim
bundled with neovim. If I understand it correctly, this actually creates a "block quote" not commenting. Why so, instead of sth like commentstring=<!--\ %s\ -->
shown above?
Hi, I've trying to find a way to add single and multiline comments for html and markdown. For example:
when I try to comment I can only get a '>' symbol in front of the line, even if the syntax is set to markdown on html
any thoughts on what I might be doing wrong?