-
Notifications
You must be signed in to change notification settings - Fork 407
New feature request: sort of bibtex by bibkey #1293
Description
Currently, I develop a javascrip plugin that will replace the bibkey generated by AmsSciNet, which is MRnumber, to Author+Year+Title, it helps me a lot when I cite the reference, since I can distinguish them easily.
I believe it is helpful to sort of bibtex items by the bibtex key, e.g., when we check the dumplicated items, I would like to share a solution from so:
put the following macro into .vimrc,
let @b=':g/^}$/s//}\r
:g/^@/,/^}$/s/\r\|\n/の
:%sort r /{[A-z0-9]\+,の/
:g/の/s//\r/g
:g/^$/d
:w
'where we should replace the linebreak by ^M, it is Ctrl+V Ctrl+M on windows gvim. After so it, we can apply the macro b in bibtex file by @b in normal mode, which will automatically sort the bibtex items through its bibkey.
Of course, we can execute the macro whenever we write the bibtex data:
au! BufWritePost *.bib :norm @b<cr>:set fdm=syntax<cr>I think it is interesting to add this function as a minor improvement of vimtex. How about you?