Skip to content

NoUseFreak/notion.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notion.nvim

Work In Progress NeoVim Lua Golang

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.

Installation

Requirements

Install the binary

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,
  },

Configuration

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"
}

Getting an API key

The apiKey can be created in the Notion settings under Integrations.

Getting the database id

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.

Getting the user id

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

Keybindings

In the list of issues you can use CTRL-X to open the issue in the browser.

About

neovim plugin to read notion issue numbers

Topics

Resources

License

Stars

Watchers

Forks