Skip to content

Commit

Permalink
Add support for bibtex files
Browse files Browse the repository at this point in the history
BibTeX files have historically bad support for commenting out parts
of a file [1].

But the now standard replacement tool biber has reliabe
support for % as comment character [2].

So let's add that.

[1]: http://www.bibtex.org/Format/
[2]: https://tex.stackexchange.com/a/93982
  • Loading branch information
t-b committed Jan 4, 2020
1 parent c9cecef commit 0f94e96
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions autoload/tcomment/types/default.vim
Expand Up @@ -14,6 +14,7 @@ call tcomment#type#Define('applescript_inline','# %s' )
call tcomment#type#Define('asciidoc', '// %s' )
call tcomment#type#Define('asm', '; %s' )
call tcomment#type#Define('asterisk', '; %s' )
call tcomment#type#Define('bib', '%% %s' )
call tcomment#type#Define('blade', '{{-- %s --}}' )
call tcomment#type#Define('blade_block', '{{--%s--}}' )
call tcomment#type#Define('blade_inline', '{{-- %s --}}' )
Expand Down

7 comments on commit 0f94e96

@Konfekt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BibTeX files have historically bad support for commenting out parts of a file [1].

For example, pandoc --to docx throws error messages for this comment marker %.
Instead, what Vim recognizes as comment marker by his syntax highlighting and pandoc accepts as valid syntax is a comment marker

@Comment{ %s }

@tomtom
Copy link
Owner

@tomtom tomtom commented on 0f94e96 Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be only valid on the top level, wouldn't it?

@Konfekt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed.

@tomtom
Copy link
Owner

@tomtom tomtom commented on 0f94e96 Mar 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 0628c96 fix this? When the cursor is on the top level, @Comment should be used, % otherwise.

@Konfekt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good work. However, the condition is that the cursor is on the beginning of the line; if not, even though it is on the line of the top level that reads, say @article, then the comment marker % is used.

@Konfekt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though of a condition such as line('.') ~=? '^@'

@tomtom
Copy link
Owner

@tomtom tomtom commented on 0f94e96 Mar 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adapted the condition accordingly.

Please sign in to comment.