wallpants / ghost-text.nvim

πŸ‘» Use Neovim to write in your browser. Everything you type in Neovim will be instantly updated in the browser (and vice versa).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Neovim GhostText

Use Neovim in the browser.

Powered by Bunvim.

demo.mp4

βœ… Requirements

  1. GhostText browser extension
  2. Bun
  3. Neovim

πŸ“¦ Installation

Using lazy.nvim

{
    "wallpants/ghost-text.nvim",
    opts = {
        -- config goes here
    },
}

βš™οΈ Configuration

All values are optional, you can leave empty to use default values. Any values you specify will be deeply merged with this dictionary.

require("ghost-text").setup({
    -- port used by local server
    port = 4001,

    -- automatically start server
    -- if "false", you must manually call ":GhostTextStart" to start server
    autostart = true,

    -- map url patterns to filetypes to set the buffer to
    -- matching done by https://github.com/isaacs/minimatch
    filetype_domains = {
      -- markdown = { "*.openai.com*", "*.github.com*" },
    },

    -- for debugging
    -- nil | "debug" | "verbose"
    log_level = nil,
})

πŸ’» Usage

Usually the steps to follow are:

  1. open Neovim (ghost-text.nvim automatically starts listenning for connections)
  2. on your browser select an input field and activate the extension
  3. a synced buffer is created in Neovim
    • The buffer is created in the Neovim instance where ghost-text.nvim was most recently started. If you want a specific Neovim instance to handle this, call :GhostTextStart in that Neovim instance before activating the extension in your browser.

The synced buffer will sync changes bidirectionally. Any changes in the browser input will update Neovim's buffer. Any changes to the buffer will update the browser input.

:GhostTextStart

Start listenning for connections. Any previously created ghost-text.nvim instances are killed.

You should only call :GhostTextStart if you're lazy-loading the plugin or if you want a specific Neovim instance to handle the connection.

πŸ’€ lazy-loading

I recommend you don't lazy-load this plugin as having it autostart is a better experience. That being said, you can configure lazy.nvim to lazyload ghost-text.nvim with the following setup.

{
    "wallpants/ghost-text.nvim",
    cmd = { "GhostTextStart" },
    opts = {
        autostart = false
        -- ...your config
    },
}

About

πŸ‘» Use Neovim to write in your browser. Everything you type in Neovim will be instantly updated in the browser (and vice versa).

License:Other


Languages

Language:TypeScript 61.6%Language:Lua 32.9%Language:JavaScript 5.5%