|
| 1 | +{ lib, ... }: |
| 2 | +let |
| 3 | + inherit (lib) types; |
| 4 | + inherit (lib.nixvim) defaultNullOpts; |
| 5 | +in |
| 6 | +lib.nixvim.plugins.mkNeovimPlugin { |
| 7 | + name = "zotcite"; |
| 8 | + |
| 9 | + maintainers = [ lib.maintainers.GaetanLepage ]; |
| 10 | + |
| 11 | + settingsOptions = { |
| 12 | + hl_cite_key = defaultNullOpts.mkBool true '' |
| 13 | + Set to `false` if you want to disable Zotcite's syntax highlighting of citation keys. |
| 14 | + ''; |
| 15 | + |
| 16 | + conceallevel = defaultNullOpts.mkUnsignedInt 2 '' |
| 17 | + Zotcite sets the `conceallevel` of the Markdown document to `2`. |
| 18 | + Use this option if you want a different value. |
| 19 | + ''; |
| 20 | + |
| 21 | + wait_attachment = defaultNullOpts.mkBool false '' |
| 22 | + While opening an attachment, Zotcite cannot catch errors because it doesn't wait for the |
| 23 | + application to finish. |
| 24 | +
|
| 25 | + If zotcite fails to open a PDF attachment, you may want to temporarily set this option to |
| 26 | + `true`. |
| 27 | +
|
| 28 | + Then, Neovim should freeze until the attachment is closed, and, if the PDF viewer finishes |
| 29 | + with non-zero status, anything output to the `stderr` will be displayed as a warning message. |
| 30 | + ''; |
| 31 | + |
| 32 | + open_in_zotero = defaultNullOpts.mkBool false '' |
| 33 | + Set this to `true` if you want `:ZOpenAttachment` to open PDF attachments in Zotero (as |
| 34 | + opposed to your system's default PDF viewer). |
| 35 | +
|
| 36 | + Note that you'll need to have Zotero configured as the default app for opening `zotero://` |
| 37 | + links. |
| 38 | + On Linux, assuming your Zotero installation included a `zotero.desktop` file, you can do the |
| 39 | + following: |
| 40 | + ```console |
| 41 | + xdg-mime default zotero.desktop x-scheme-handler/zotero |
| 42 | + ``` |
| 43 | + ''; |
| 44 | + |
| 45 | + filetypes = defaultNullOpts.mkListOf types.str [ "markdown" "pandoc" "rmd" "quarto" "vimwiki" ] '' |
| 46 | + Which filetypes to enable Zotcite on. |
| 47 | + ''; |
| 48 | + }; |
| 49 | + |
| 50 | + settingsExample = { |
| 51 | + hl_cite_key = false; |
| 52 | + wait_attachment = true; |
| 53 | + open_in_zotero = true; |
| 54 | + filetypes = [ |
| 55 | + "markdown" |
| 56 | + "quarto" |
| 57 | + ]; |
| 58 | + }; |
| 59 | +} |
0 commit comments