Skip to content

skepticspriggan/cmp-reference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

nvim-reference

A source for nvim-cmp that provides completion for bibliography reference keys.

Features

  • Global bibliography definition: set the bibliography source file only once for all files
  • Format reference preview: define how the selected reference is shown in the preview

Installation

Make the plugin available to nvim with Lazy by specifying it as a dependency to nvim-cmp:

{
  'hrsh7th/nvim-cmp',
  ...
  dependencies = {
    ...
    'skepticspriggan/cmp-reference'
  }
}

Add the plugin as completion source for nvim-cmp:

require('cmp').setup({
  sources = {
    ...
    { name = 'reference' },
  },
})

Configuration

Add a table to the option field in the definition of the completion source:

cmp.setup {
  ...
  sources = {
    {
      name = 'reference',
      option = {
        file = "/path/to/bibliography.bib"
        format =
          [[
            **{{title}}**
            *{{year}}*
            {{author}}
          ]]
      }
    }
  }
}

The available parameters are:

file

The path to the file of the bibliography source.

Default: "~/.pandoc/bibliography.bib"

Examples: "/path/to/bibliography.bib"

format

The template used to print citation information in the documentation hover menu. The citation fields can be specified as {{field}}.

Missing fields will be removed.

Default:

[[
  **{{title}}**
  *{{year}}*
  {{author}}
]]

Todo

  • Multiple bibliography file types
  • Local bibliography file definition in YAML frontmatter

Credits

The package was inspired by:

Similar Projects

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages