Fix pandoc citation autocompletions

wiki.vim overwrites omnifunc for any buffer it sees as its own. Pandoc
uses g:pandoc#competion#Complete as its omnifunc to generate citations.

So we use deoplete to collect the citations and display them on being
invoked by `@`. When typing more, it filters the list accordingly.

Have not gotten preview window working again, nor searching of fields
other than bibkey.
This commit is contained in:
Marty Oehme 2020-02-04 00:44:12 +01:00
parent 756e45e037
commit e7ff8c9f78
6 changed files with 24 additions and 38 deletions

View file

@ -1,15 +0,0 @@
" PLUGIN: DEOPLETE
" For async completion
" enable deoplete at startup
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_camel_case = 1
let g:deoplete#enable_refresh_always = 1
let g:deoplete#max_abbr_width = 0
let g:deoplete#max_menu_width = 0
call deoplete#custom#var('omni', 'input_patterns', {
\ 'pandoc': '@',
\})
call deoplete#enable()

View file

@ -1,21 +0,0 @@
" lazy loading since they require a lot of startup time
let s:ide_features_loaded=0
function! Autocomplete_linting_init() abort
if s:ide_features_loaded || !has('nvim')
return
endif
let s:ide_features_loaded=1
call plug#load('ale', 'deoplete.nvim', 'echodoc.vim')
call echodoc#enable()
call deoplete#custom#var('omni', 'input_patterns', {
\ 'pandoc': '@',
\})
call deoplete#enable()
endfunction
" augroup load_ide_features
" autocmd!
" autocmd InsertEnter * call Autocomplete_linting_init()
" augroup END

View file

@ -1,7 +1,5 @@
" PLUGIN: vim-pandoc
" handle markdown files with pandoc (and pandoc syntax!)
let g:pandoc#modules#disabled = ["folding", "keyboard"]
let g:pandoc#modules#enabled = ["formatting", "bibliographies", "completion", "metadata", "menu", "spell", "hypertext"]
let g:pandoc#filetypes#pandoc_markdown = 1
let g:pandoc#filetypes#handled = [ "extra", "latex", "markdown", "pandoc", "rst", "textile" ]
" disable all default keymaps

View file

@ -0,0 +1,22 @@
" PLUGIN: DEOPLETE
" For async completion
" enable deoplete at startup
let g:deoplete#enable_at_startup =1
let g:deoplete#enable_ignore_case =1
let g:deoplete#enable_smart_case =1
let g:deoplete#enable_camel_case =1
let g:deoplete#enable_refresh_always =1
let g:deoplete#max_abbr_width =0
let g:deoplete#max_menu_width =0
call deoplete#custom#var('omni', 'input_patterns', {
\'pandoc': '@\w*',
\})
call deoplete#custom#var('omni', 'functions', {
\'pandoc': 'pandoc#completion#Complete',
\})
call deoplete#custom#option({
\ 'auto_complete_delay': 0,
\ 'smart_case': v:true,
\})

View file

@ -1,6 +1,8 @@
" PLUGIN: ECHODOC
let g:echodoc#type="virtual"
let g:echodoc_enable_at_startup=1
set splitbelow
set completeopt+=menuone,noinsert,noselect
set completeopt-=preview
autocmd CompleteDone * pclose