Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for coc.nvim #9

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions autoload/coc/source/pandoc.vim
@@ -0,0 +1,26 @@
function! coc#source#pandoc#init() abort
return {
\ 'priority': 9,
\ 'shortcut': 'pandoc',
\ 'filetypes': ['pandoc'],
\ 'triggerCharacters': ['@'],
\ }
endfunction

function! coc#source#pandoc#complete(opt, cb) abort
let l:classes = []
let l:items = []
let l:bibs = split(glob('%:p:h/**/*.bib'))
for l:bib in l:bibs
let l:lines = readfile(l:bib)
for l:line in l:lines
if l:line =~# '^@\l*{.*,'
let l:items += [split(l:line, '{\|,')[1]]
endif
endfor
endfor
for l:item in l:items
call add(l:classes, {'word': l:item})
endfor
call a:cb(l:classes)
endfunction