From 565a356ea8e883bec39f25065c8d9784e99910f3 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 16 Jan 2023 18:52:48 +0100 Subject: [PATCH] nvim: Add bibtex source to cmp autocompletion Added simple bibtex source display: Will show the bibtex entries existing in the bib file set through `bibliography: path/to/mine.bib`. Shows author, title, date on hovering. --- nvim/.config/nvim/lua/plug/_cmp.lua | 7 +++++-- nvim/.config/nvim/lua/plugins.lua | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lua/plug/_cmp.lua b/nvim/.config/nvim/lua/plug/_cmp.lua index bad2eb5..b61ef7e 100644 --- a/nvim/.config/nvim/lua/plug/_cmp.lua +++ b/nvim/.config/nvim/lua/plug/_cmp.lua @@ -68,14 +68,17 @@ cmp.setup({ }, sources = cmp.config.sources({ { name = 'path' }, { name = 'nvim_lsp' }, { name = 'treesitter' }, - { name = 'tmux' }, { name = 'vsnip' }, { name = 'latex_symbols' }, - { name = 'vCard' }, { name = 'nvim_lua' } + { name = 'cmp_pandoc' }, { name = 'tmux' }, { name = 'vsnip' }, + { name = 'latex_symbols' }, { name = 'vCard' }, { name = 'nvim_lua' } }, { { name = 'buffer' }, { name = 'spell' } }) }) if vim.o.ft == 'clap_input' and vim.o.ft == 'guihua' and vim.o.ft == 'guihua_rust' then require 'cmp'.setup.buffer { completion = { enable = false } } end +-- set up pandoc bibtex source generation +require 'cmp_pandoc'.setup() + -- Use buffer source for `/` search cmp.setup.cmdline('/', { mapping = cmp.mapping.preset.cmdline(), diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 45ff9f5..388b2d0 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -236,6 +236,10 @@ require("packer").startup(function() } } + use { + 'aspeddro/cmp-pandoc.nvim', + requires = {'nvim-lua/plenary.nvim', 'jbyuki/nabla.nvim'} + } require('plug._cmp') -- Automatically set up your configuration after cloning packer.nvim