Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jalvesaq/zotcite

Neovim plugin for integration with Zotero
https://github.com/jalvesaq/zotcite

neovim-plugin zotero

Last synced: 2 months ago
JSON representation

Neovim plugin for integration with Zotero

Awesome Lists containing this project

README

        

# Zotcite

> [!Note]
> Users of Vim and Neovim < 0.10 have to install the branch "vim".

_Zotcite_ is a Neovim plugin that provides integration with Zotero. With
_zotcite_ you can:

- Do auto-completion of citation keys from Zotero database in
Markdown, RMarkdown and Quarto documents (with `cmp-zotcite`).

![Auto-completion](https://raw.githubusercontent.com/jalvesaq/zotcite/master/zotcite_completion.gif "auto-completion")

![Citation key highligting](https://raw.githubusercontent.com/jalvesaq/zotcite/master/zotcite_conceal.gif "Citation key highlighting")

- Quickly see on the status bar information on the reference under the cursor.

![Reference brief information](https://raw.githubusercontent.com/jalvesaq/zotcite/master/zotcite_info.gif "Reference brief information")

![Complete reference information](https://raw.githubusercontent.com/jalvesaq/zotcite/master/zotcite_more_info.gif "Complete reference information")

- Use the `zotref.py` filter to pre-process the Markdown document before the
citations are processed by `pandoc`, avoiding the need of `bib` files.

- Open the PDF attachment of the reference associated with the citation key
under the cursor.

- Extract highlighted text and text notes from PDF attachments of
references.

- Extract Zotero notes and annotations from Zotero database.

- Add all cited references to the YAML header of the Markdown document.

_Zotcite_ is being developed and tested on Linux and should work flawlessly on
other Unix systems, such as Mac OS X. It may require additional configuration
on Windows.

## Installation

Requirements:

- Zotero >= 5

- Python 3

- Python 3 modules pynvim (see Neovim documentation on `provider-python` for
details) and PyYAML.

- Python modules PyQt5 and python-poppler-qt5 (only if you are going to extract
annotations from PDF documents). On Debian based Linux distributions, you
can install them with the command:

`sudo apt install python3-pyqt5 python3-poppler-qt5`

Depending on your system, you may have to install python modules in an virtual
environment and maybe also system-wide.

Zotcite can be installed as any Neovim plugin, and it depends on
[telescope.nvim](https://github.com/nvim-telescope/telescope.nvim), and
[nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) as well
as tree-sitter parsers for `markdown`, `markdown_inline`, and `yaml`.
Optionally, you can also use
[cmp-zotcite](https://github.com/jalvesaq/cmp-zotcite), for auto-completing
the citations keys. Below is an example of how to install `zotcite` with
[lazy.nvim](https://github.com/folke/lazy.nvim):

```lua
{
"jalvesaq/zotcite",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-telescope/telescope.nvim",
},
config = function ()
require("zotcite").setup({
-- your options here (see doc/zotcite.txt)
})
end
},

{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function ()
require("nvim-treesitter.configs").setup({
sync_install = true,
ensure_installed = {
"html",
"latex",
"markdown",
"markdown_inline",
"yaml",
},
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldenable = false
end
},
```

Note: you don't need to lazy load zotcite because it already lazy loads its
modules only for the supported file types, and you do need to call zotcite's
setup function.

The Python module `zotero` does not import the `vim` module. Hence, its code
could easily be adapted to other text editors or as a language server for
markdown and quarto.

## Usage

Please, read the plugin's
[documentation](https://raw.githubusercontent.com/jalvesaq/zotcite/master/doc/zotcite.txt)
for further instructions.

## Acknowledgment

Zotcite's Python code was based on the
[citation.vim](https://github.com/rafaqz/citation.vim) project.