msprev / fzf-bibtex

a BibTeX source for fzf
BSD 3-Clause "New" or "Revised" License
129 stars 15 forks source link

Only show first author #8

Closed tom-anders closed 5 years ago

tom-anders commented 5 years ago

I have some papers that have lots of authors (>6) which makes this tool really messy, is there a way to show only the first author?

msprev commented 5 years ago

This is easy to change by modifying the function abbrevAuthors to truncate the authors string to 'et al.' if number of authors len(sl) > some value n. You can see the function here: https://github.com/msprev/fzf-bibtex/blob/master/bibtex/bibtex.go. If you like, you can fork from the master and do this.

However, I haven't done this because a user may wish to narrow their search by typing the name of any one of the authors (e.g. 'Jones'). If 'Jones' has been truncated to 'et al.' then fzf will not be able to narrow the search on 'Jones'. I can imagine this being really annoying. Users should be able to narrow the search based on any of the authors.

If you have a suggestion that still allows users to search by any of the authors, I'd be happy to implement. But it sounds like, if the formatting is important to you, it's best to do it in a fork.

tom-anders commented 5 years ago

Yeah I can see where you're coming from. Unfortunately I don't know Go, so I ended up writing my own python script using bibtextparser. Thanks anyway!

msprev commented 5 years ago

Have a try with Go! It's really easy to do what you ask for and if you can write Python you'd easily be able to do it. I used bibtextparser for a previous version of this written in Python and it's good but considerably slower.

tom-anders commented 5 years ago

Haha alright, I'll try :)