I write in pandoc markdown, which uses bibligraphic keys from biblatex that look like @smith_foo_1999, where "Smith" is the author name, "Foo" is the title, and 1999 is the year of publication. This corresponds to an entry in my library.bib file that starts @article{smith_foo_1999. I use unite-bibtex and vim-pandoc, which both have great autocompletion for these keys, but what I'd really like to be able to do is to jump to my bibliographic entry in my library.bib file when I position the cursor over the key @smith_foo_1999, and press some key combination like gf or <C-]>. Is there a way to do that?
Asked
Active
Viewed 236 times
1
Jonathan
- 1,979
- 4
- 23
- 34
1 Answers
3
You could make a mapping in vim that opens the file, and searched for the selected word. Lets assume the following file structure:
.
..
img/
library.bib
markdownfile.md
a simple mapping could do most of the work then,
map <leader>bib yiw:e library.bib<CR>q/p
Place your cursor on the word, e.g. @mybib_2015 and press <leader>bib.
This mapping will
yiwyank entire word:e library.bib<cr>open library.bib in a new bufferq/pwill toggle search, and paste the aforementioned yanked word.
-
`bvwy` has a couple problems, I think. `b` will go to the beginning of the *previous* word if the cursor is on the first character of the current word and `w` will go to the beginning of the *next* word, not the end of the current word. I'd suggest replacing `bvwy` with `viwy` (visual mode, inner word, yank) or `yiw` (yank inner word). The latter will leave the previous visual mode are untouched, which may be relevant to fans of `gv` and similar commands. – 8bittree Nov 16 '16 at 20:51
-
Excellent addition! I didn't think about that. – Nov 17 '16 at 16:59