Context
I currently write research articles in LaTeX using Vim.
I have bibtex keys in my articles like \cite{smith2000sometopic} and I have corresponding pdf versions of most articles in a subfolder of ~/lib e.g., ~/lib/topica/smith2000sometopic.pdf.
Aim
I'd like to be able to press a key in Vim when my cursor is over a bibtex key that:
- extracts the
bibtex-keyunder the cursor - performs a search for
bibtex-key.pdf - if the file is found, opens the file in a pdf viewer
- If the file is not found, indicate that this is the case
Question
- Has anyone already done something like this?
- Are there any examples that would be useful to study?
Initial thoughts
I thought I could use something like:
gnome-open `find ~/lib/ -iname "smith2000sometopic.pdf" | head -1`
and then experiment with some Vimscript to fine tune the interaction; but if anyone has any examples or suggestions, that would be most appreciated.