Notion.nvim is a Neovim plugin that allows you to interact with Notion.so from Neovim.
Is is developed to simplfy adding issue numbers to git commits.
Currently it only supports searching for issues in a database and inserting the issue number in the current buffer. Searching for issues is done using telescope.nvim.
- Neovim 0.9.4 or later
- plenary.nvim
- telescope.nvim
- notion.nvim binary, see below
The binary is not included in the repository, for now you need to install it using go.
go install github.com/nousefreak/notion.nvim/cmd/notion.nvim@latest
Using Lazy:
{
"NoUseFreak/notion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
require('notion').setup({
prefix = '#',
})
require('telescope').load_extension 'notion'
vim.keymap.set('n', '<leader>na', require('notion.builtin').issues_all, { noremap = true, silent = true })
vim.keymap.set('n', '<leader>ni', require('notion.builtin').issues, { noremap = true, silent = true })
vim.keymap.set('n', '<leader>no', require('notion.builtin').issues_owned, { noremap = true, silent = true })
end,
},
The plugins searches for a .notion.json
file in the current directory and all parent directories.
This file should contain the following fields:
{
"apiKey": "your-api",
"dbId": "your-db-id",
"userID": "your-user-id"
}
The apiKey
can be created in the Notion settings under Integrations.
Open the database you want to use and copy the id from the URL. It should look something like https://www.notion.so/your-db-id
.
Note you may have to grant the intergration access to the database. This can be done by the hamburger menu in the top right corner of the database view.
In the menu under Connections you can Connect to
the integration.
Not sure if a cleaner way exists. But you can get the user id by inspecting the local storage of the Notion web app.
JSON.parse(localStorage.getItem("gist.web.userToken")).value
In the list of issues you can use CTRL-X
to open the issue in the browser.