Skip to content

Repository files navigation

bib.nvim

Bibliography management for Neovim via LSP. Provides completion, hover, go-to-definition, and code actions for citation keys in Markdown and LaTeX documents.

Features

  • LSP server — completion, hover, go-to-definition for @citekey references
  • Automatic backend dispatch.bib files via tree-sitter, Zotero via sqlite
  • Composite key conceal@ABC123#citekey → hides the ID, shows only the citekey
  • :Bib search — fuzzy picker over the active backend (zotero for Zotero-only)
  • Code actions — Open PDF and Get notes from Zotero for citations
  • Markdown + LaTeX — YAML frontmatter, \addbibresource, .bib.json, !TeX root

Installation

With vim.pack (Neovim 0.12+):

vim.pack.add({
    "https://github.com/phrmendes/bib.nvim",
    "https://github.com/kkharji/sqlite.lua",
})

Requires pandoc and sqlite.lua. Zotero users also need BetterBibTeX for citation key generation.

Tree-sitter parsers required: bibtex, latex, markdown, markdown_inline, yaml.

Quick start

require("bib").setup({
    filetypes = { "markdown", "tex" },
    zotero = { database = "/path/to/zotero.sqlite" },
})

The Zotero database path is auto-detected from the default location if not specified.

Add a bibliography field to your Markdown frontmatter:

---
bibliography: refs.bib
---

See @smith2020 for details.

Or use \addbibresource in LaTeX:

\documentclass{article}
\addbibresource{refs.bib}
\begin{document}
See \cite{smith2020}.
\end{document}

Or place a .bib.json file in the project root:

{ "bibliography": "refs.bib" }

Commands

  • :Bib search — search the current backend and open the reference
  • :Bib search zotero — search Zotero only

Code actions

Triggered on a citation line:

  • Open PDF — opens the attached PDF in the system viewer
  • Get notes from Zotero — inserts Zotero notes below the citation as plain text

Dependencies

Credits

Zotero note extraction inspired by zotcite.

License

Apache-2.0

About

A plugin to manage bibliography

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages