Closed ashwinvis closed 5 years ago
Here is vim configuration that I came up with, which does not require to hard code the bib file name. Notice the globpath which detects bib files in parent, present or child directories
function! Bibtex_ls() let bibfiles = ( \ globpath('.', '*.bib', v:true, v:true) + \ globpath('..', '*.bib', v:true, v:true) + \ globpath('*/', '*.bib', v:true, v:true) \ ) let bibfiles = join(bibfiles, ' ') let source_cmd = 'bibtex-ls '.bibfiles return source_cmd endfunction function! s:bibtex_cite_sink_insert(lines) let r=system("bibtex-cite ", a:lines) execute ':normal! i' . r call feedkeys('a', 'n') endfunction inoremap <silent> @@ <c-g>u<c-o>:call fzf#run({ \ 'source': Bibtex_ls(), \ 'sink*': function('<sid>bibtex_cite_sink_insert'), \ 'up': '40%', \ 'options': '--ansi --layout=reverse-list --multi --prompt "Cite> "'})<CR>
Thanks! This looks useful and I’ll add it to the readme.
Here is vim configuration that I came up with, which does not require to hard code the bib file name. Notice the globpath which detects bib files in parent, present or child directories