Skip to content

A neovim plugin to tunnell text from neovim to a tmux target pane, written in Lua.

License

Notifications You must be signed in to change notification settings

sourproton/tunnell.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

tunnell.nvim

A neovim plugin to send tunnell text from neovim to a tmux target pane, written in Lua.

One use case is having the comfort of editing code in neovim, while tunnelling it to a REPL to code iteractively.

Usage

tunnelldemo.webm
  • :TunnellCell to tunnell the cell where the cursor is. Note that the cursor doesn't need to be on the cell's header, but anywhere in it
  • :'<,'>TunnellRange to tunnell the active selection, or any other range of lines with :startline,endlineTunnellRange
  • :TunnellConfig to change the default cell header (# %%) or the default target ({right-of}) of the current buffer

Installation

With lazy.nvim plugin manager:

{
    "sourproton/tunnell.nvim",
    config = true,
}

Configuration:

{
    "sourproton/tunnell.nvim",
    opts = {
        -- defaults are:
        cell_header = "# %%",
        tmux_target = "{right-of}",
    },

    -- to lazy-load on keymaps:
    keys = {
        -- suggestions for keymaps:
        { "<leader>tt", ":TunnellCell<CR>",   mode = { "n" }, desc = "Tunnell cell" },
        { "<leader>tt", ":TunnellRange<CR>",  mode = { "v" }, desc = "Tunnell range" },
        { "<leader>tc", ":TunnellConfig<CR>", mode = { "n" }, desc = "Tunnell config" },
    },

    -- to lazy-load on commands:
    cmd = {
        "TunnellCell",
        "TunnellRange",
        "TunnellConfig",
    },
}

About

I made this plugin to learn Lua and how to make a neovim plugin. I work a lot with REPL-based workflows and tunnelling is something that makes my life a lot easier.

Yes, this plugin does the same as vim-slime but has a lot less functionality. You should definitely go with vim-slime.

Name inspired by quantum tunnelling.

For now, only tmux targets are supported, but making zellij, kitty, wezterm and other targets should not be hard. I just lack the motivation to do it because I personally use tmux.

Releases

No releases published

Languages