A lightweight tmux REPL (trepl) interaction plugin for Neovim.
trepl.nvim
is a lightweight plugin for Neovim, designed to easily pass data to tmux panes from within Neovim.
It allows you to send lines and selections from your current buffer to a tmux pane without leaving your editor,
facilitating quick interaction with other processes, e.g. REPLs.
You can install trepl.nvim
using your favorite package manager.
Please note that pinning to a tag can help provide more stability.
Using vim-plug:
Plug 'geenen124/trepl.nvim', { 'tag': 'v0.1.0' }
Using packer.nvim:
use {
"geenen124/trepl.nvim",
tag="v0.1.0"
}
Using lazy.nvim:
use {
"geenen124/trepl.nvim",
tag="v0.1.0"
}
Here's how you can configure trepl.nvim
in your init.vim
or init.lua
:
require("trepl").setup {
-- Configuration settings
-- default values below
commands = true, -- set up user commands
}
Recommended - set up keyboard mappings as follows:
vim.keymap.set("n", "<leader>tc", ":Trepl current_line<cr>")
vim.keymap.set("n", "<leader>tv", ":Trepl variable<cr>")
vim.keymap.set("n", "<leader>tcl", ":Trepl class<cr>")
vim.keymap.set("n", "<leader>tfn", ":Trepl function<cr>")
vim.keymap.set("v", "<leader>ts", ":Trepl selection<cr>")
vim.keymap.set("v", "<leader>tl", ":Trepl selected_lines<cr>")
Commands:
TreplSetSocket <socket_path>
- set the tmux socket path. By default trepl will use the socket path defined by the$TMUX
environment variable.TreplSetPane <pane>
- set the tmux pane trepl will send data to. By default it will send it the to next pane.Trepl current_line
- send the current line.Trepl selection
- send the current selection.Trepl selected_lines
- send the lines included in your current selection.
N.B. The following commands make use of treesitter, so please make sure that the correct parser is installed and that trepl supports it:
Trepl variable
- send the current variable.Trepl function
- send the current function.Trepl class
- send the current class.
The following languages are supported for intelligent treesitter-powered selections:
- python
trepl.nvim
is open-source software released under the MIT License.
Add Support For:
- Repeated motions
- Send files
- Additional languages