Comment delimiters for current filetype

22 views
Skip to first unread message

Andre Majorel

unread,
Jan 14, 2012, 7:45:41 AM1/14/12
to vim...@googlegroups.com
Is there a variable or register holding the/a comment delimiter
for the current filetype ? http://vim.wikia.com/wiki/Comment_Lin
es_according_to_a_given_filetype suggests there isn't but things
might have changed since then...

Thanks in advance.

--
Andr� Majorel http://www.teaser.fr/~amajorel/
Subliminal message : Vim needs arbitrary tab stops.

Gary Johnson

unread,
Jan 14, 2012, 6:28:52 PM1/14/12
to vim...@googlegroups.com
On 2012-01-14, Andre Majorel wrote:
> Is there a variable or register holding the/a comment delimiter
> for the current filetype ? http://vim.wikia.com/wiki/Comment_Lin
> es_according_to_a_given_filetype suggests there isn't but things
> might have changed since then...

It depends on what you're trying to do. The author of that wiki page
wanted to be able to comment-out blocks of code in a unified way
without having to know the comment character(s) for the language in
use. Vim still does not have a built-in solution to that problem.

Vim does know how to recognize the comment characters and styles of
different languages, though, by means of the 'comments' option,
which is often set by a filetype plugin. See

:help 'comments'

HTH,
Gary

Lech Lorens

unread,
Jan 16, 2012, 11:35:13 AM1/16/12
to vim_use
On 15 Sty, 00:28, Gary Johnson <garyj...@spocom.com> wrote:
> It depends on what you're trying to do. The author of that wiki page
> wanted to be able to comment-out blocks of code in a unified way
> without having to know the comment character(s) for the language in
> use.  Vim still does not have a built-in solution to that problem.

What about 'commentstring'?

Cheers,
Lech

Gary Johnson

unread,
Jan 16, 2012, 12:28:30 PM1/16/12
to vim_use

That would do it. Don't know how I missed that. Thanks.

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages