tmutils.nvim
is a Neovim plugin designed to streamline common development tasks that involve both tmux
and Neovim. Key features include:
- Sending a range of lines from Neovim to a
tmux
pane. - Collecting output from a
tmux
pane into Neovim. - Creating a configurable
tmux
pane to serve as a terminal. - Setting up and managing REPLs within
tmux
panes directly from Neovim.
-
lazy
: to install this plugin using lazy:{ "juselara1/tmutils.nvim", dependencies = { "nvim-telescope/telescope.nvim", -- Optional, use this only if you want to use the telescope selector. }, config = function() require("tmutils").setup { selector = { selector = "telescope" -- Optional, you can use tmutils using Ex commands only. }, window = { terminal = { direction = "vertical", -- Split window direction to create a new pane. size = 20, -- Size of the pane in percentage. commands = function() return { ("cd %s"):format(vim.fn.getcwd()), "clear" } end -- Commands to execute in the new terminal pane. }, repls = { py = { direction = "vertical", size = 20, commands = function() return { ("cd %s"):format(vim.fn.getcwd()), "clear", "python", } end }, -- Configuration for a Python repl that will be accessed using the `py` keyword. lua = { direction = "vertical", size = 20, commands = function() return { ("cd %s"):format(vim.fn.getcwd()), "clear", "lua", } end }, -- Configuration for a Lua repl that will be accessed using the `lua` keyword. -- You can add more repls here following the previous structure. } } } end }
Here are some common use cases for tmutils
:
external_panes.mp4
- Set up a target pane:
:help :TmutilsConfig
. - Send a range of lines to the pane:
:help :TmutilsSend
. - Capture the pane's content into a buffer:
:help :TmutilsCapture
.
terminal_pane.mp4
- Create a new terminal pane:
:help TmutilsWindow
. - Send a range of lines to the terminal:
:help :TmutilsSend
. - Delete the terminal:
:help TmutilsWindow
.
repl_pane.mp4
- Create a new REPL pane (ensure the
window.repls.{repl}
option is set in yoursetup
)::help TmutilsWindow
. - Send a range of lines to the REPL:
:help :TmutilsSend
. - Delete the REPL:
:help TmutilsWindow
.