Skip to content

fold text in bib files? #2065

@yongrenjie

Description

@yongrenjie

Is your feature request related to a problem? Please describe it.

Setting foldmethod=syntax in bib files (provided by vim8.2's built in syntax file) gives nice folding, but the default fold text is a bit dull. For example (stealing a paper from my supervisor :-))

@article{Foroozandeh2014ACIE,
    doi = {10.1002/anie.201404111},
    author = {Foroozandeh, Mohammadali and Adams, Ralph W. and Meharry, Nicola J. and Jeannerat, Damien and Nilsson, Mathias and Morris, Gareth A.},
    title = {Ultrahigh-Resolution NMR Spectroscopy},
    journaltitle = {Angew.\ Chem.\ Int.\ Ed.},
    year = {2014},
    volume = {53},
    number = {27},
    pages = {6990--6992},
}

produces the following foldtext

+-- 10 lines: @article{Foroozandeh2014ACIE,-----------------------------------------------

IMO, it's not useful to know how many lines an entry is; also, the remainder of the space could be more usefully utilised to show some information about the bib entry.

Describe the solution you'd like

For most bib entries I think the most useful piece of extra information would be the title (?) or for @set{...}, it would be useful to see which entries are contained within the set.

I actually have an implementation of the foldtext function here: https://github.com/yongrenjie/abbotsbury.vim/blob/master/ftplugin/bib.vim which I use personally. For the same bib entry above it produces the following foldtext:

+-- article{Foroozandeh2014ACIE} -- Ultrahigh-Resolution NMR Spectroscopy ----------------

Describe alternatives you've considered

I mainly opened this issue as I was curious as to whether this would be something you might be interested in including in vimtex. I'm happy to modify the output slightly if desired!

The main alternative would be sticking with the default, I guess. There might be an argument that long fold texts lead to visual clutter.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions