A Neovim plugin that allows you to search for books using the Google Books API and create markdown notes with book metadata.
- Search for books by title, author, publisher, or ISBN
- View search results and select a book using fzf-lua
- Create new markdown notes with book metadata from the search result
- Find existing book notes by filename using fzf-lua
- Grep existing book notes by content using fzf-lua
- Support for custom templates
- Support for Google Books API
- Neovim >= 0.8.0
- plenary.nvim
- fzf-lua
- ripgrep (optional, recommended) - used by
:BookNote grep; falls back togrepif not installed
Add the following to your lazy.nvim plugin configuration:
{
"masanobbb/booknote.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"ibhagwan/fzf-lua",
},
cmd = { "BookNote" },
keys = {
{
"<leader>bc",
function()
require("booknote").create_book_note()
end,
desc = "BookNote create",
},
{
"<leader>bf",
function()
require("booknote").find_book_note()
end,
desc = "BookNote find",
},
{
"<leader>bg",
function()
require("booknote").grep_book_note()
end,
desc = "BookNote grep",
},
},
opts = {
-- Required: Directory where book notes are created, found, and grepped
booknote_location = "~/Documents/BookNotes",
-- Optional: Customize the filename format
new_file_name = "{{title}}",
-- Optional: Path to custom template file
template_file = "~/.config/nvim/templates/book-template.md",
-- Optional: API key for Google Books (recommended to avoid rate limits)
api_key = os.getenv("BOOKS_API_KEY"),
-- Optional: Enable edge curl effect for cover images (default: true)
cover_image_edge_curl = true,
},
}The booknote_location option is required. Without it, the plugin will fail to create, find, or grep notes.
You can set environment variables for sensitive data like API keys:
# In your .bashrc, .zshrc, or similar
export BOOKS_API_KEY="your-google-books-api-key":BookNote create- Search for a book and create a note:BookNote find- Find.mdfiles underbooknote_locationby filename using fzf-lua:BookNote grep- Grep the contents of.mdfiles underbooknote_locationusing fzf-lua (Available once the plugin is loaded — see the lazy.nvim config above.)
No default keymap is set. Define your own — see the keys example in the lazy.nvim config above.
You can use the following variables in your custom templates:
| Variable | Description |
|---|---|
| title | The title of the book |
| subtitle | The subtitle of the book (if available) |
| author | Comma-separated list of authors |
| authors | Array of author names |
| description | Book description |
| publisher | Book publisher |
| publishDate | Publication date |
| totalPage | Total number of pages |
| category | Comma-separated list of categories |
| categories | Array of category names |
| isbn10 | ISBN-10 identifier |
| isbn13 | ISBN-13 identifier |
| coverUrl | URL to the book cover image |
| coverSmallUrl | URL to a smaller version of the cover image |
| DATE | Current date (YYYY-MM-DD format) |
| DATE:format | Current date with custom format |
If no template file is found, the plugin will use a built-in default template.
---
tag: 📚Book
title: "{{title}}"
subtitle: "{{subtitle}}"
author: [{{author}}]
category: [{{category}}]
publisher: {{publisher}}
publish: {{publishDate}}
total: {{totalPage}}
isbn: {{isbn10}} {{isbn13}}
cover: {{coverUrl}}
status: unread
created: {{DATE:YYYY-MM-DD HH:mm:ss}}
updated: {{DATE:YYYY-MM-DD HH:mm:ss}}
---
# {{title}}

## Description
{{description}}
## Notes
To avoid rate limits, it's recommended to set up your own Google Books API key:
- Create a project on Google Cloud
- Enable the Books API for your project using the Books API page
- Create an API key from the Google Cloud Credentials page
- Add the API key to your plugin configuration
This plugin was inspired by Obsidian Book Search Plugin by @anpigon.