Giter VIP home page Giter VIP logo

impulse.nvim's Introduction

impulse.nvim

impulse.nvim is a neovim plugin for viewing Notion.so pages. It converts Notion blocks to Markdown for viewing. It is written in Yuescript.

Currently, impulse does not support updating Notion pages. I'm still working on implementing that functionality. Please feel free to contribute!

Screenshots

Search Results

search

Page View

view

Before Installing

In order to use this plugin, you need to have a Notion integration.

Only admins of a Notion workspace can set up integrations, and an integration must be invited to the page you wish for it to be able to retrieve. It's a bit silly, but if you are organized in your Notion use, you should be able to invite it to a top-level "page" and give it access to everything underneath.

The way impulse.nvim currently interacts with Notion is purely read-only, so your integration can drop update/insert permissions for now. If such functionality is ever implemented, you can update the permissions easily.

Functions

  • impulse.search("query") - search for pages with "query" in the title (uses telescope)
  • impulse.menu_search() - pop up a menu at cursor that you can use to type in a query ad-hoc
  • impulse.follow_link() follow page links in a document (only works on pages)

Example keybinds in .vim

nnoremap <leader>vs :lua require("impulse").menu_search()<CR>
nnoremap <leader>vl :lua require("impulse").follow_link()<CR>

Install

In yue/moonscript:

packer.startup (use) ->
  use {
    "chrsm/impulse.nvim"
    config: ->
      require("impulse").setup!
    requires:
      * "nvim-lua/plenary.nvim"
      * "nvim-telescope/telescope.nvim"
  }

In lua:

packer.startup(function(use)
  use {
    "chrsm/impulse.nvim",
    config = function()
      require("impulse").setup({})
    end,
    requires = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
  }
end)

Configuration Options

{
  -- Your notion API key. 
  -- Get one by creating an integration here: https://www.notion.so/my-integrations
  -- This plugin does not update or modify any pages, so you can set
  -- "Read content" as the only option if you prefer.
  --
  -- It is possible that impulse will be updated with write abilities at some
  -- point.
  --
  -- DEFAULT: os.getenv "NOTION_SECRET"
  api_key: "NOTION API KEY"

  -- If always_refetch is true, every time you search-and-select or follow a
  -- link, that page's block set will be pulled again. Useful if you are
  -- following live updates.
  --
  -- DEFAULT: false
  always_refetch: false or true

  -- Whether or not to allow `follow_link` to open a non-impulse URL.
  -- If false, nothing will happen with follow_link.
  -- If true, impulse will use xdg-open.
  -- If a path is specified or name of a browser in $PATH, impulse will use it.
  --
  -- DEFAULT: false
  open_in_browser: false, true or "string browser"
}

Contributing

  • don't be an ass
  • use yue
  • write decent commit messages
  • ???

impulse.nvim's People

Contributors

chrsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cstaaben

impulse.nvim's Issues

fetching: use curl to call Notion API

Rather than make people install rocks, impulse.nvim should probably switch to using curl, which is much more easily installed.

I've run into annoying issues install http (as an example) on MacOS, and curl would do the job just as well. Also, macs suck.

Write access

What is needed to be able to have write access to a notion page?

blank results

in lazyvim

.config/nvim/lua/plugins/notion.lua

return {
    "chrsm/impulse.nvim",
    dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
    config = function()
        require("impulse").setup({})
    end,
}

.config/nvim/lua/config/keymaps.lua

vim.keymap.set("n", "<leader>vs", require("impulse").menu_search)
vim.keymap.set("n", "<leader>vl", require("impulse").follow_link)

in fish

set -Ux NOTION_SECRET secret_xxxxxxxxx....

the keybindings open the search, but the results are always blank.

`follow_link`: support opening browser on non-renderable links

For user-uploaded content we should try opening it in a browser (if available or configured). It looks like the links returned may have an expiry date, so it might be smarter to translate them into an impulse-specific link (eg impulse://uploaded/block-id) and then retrieve the real block content at calltime.

i.e.

should all be browser-able.

current code in follow_link: https://github.com/chrsm/impulse.nvim/blob/master/yue/impulse/impulse.yue#L87

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.