A plugin to send a command to the terminal most recently opened (which is visible on the current tab).
Unlike other similar plugins this plugin automatically choose a terminal (the most recent one) so you do not have to "mark" the terminal you want to use.
I mainly use with a keymap to quickly repeat last command (SendToTerm !!
).
Like any other plugin add "ilan/nvim-send-to-first-term" to your package manager and call
require("nvim-send-to-first-term").setup()
.
{
"ilan-schemoul/nvim-send-to-first-term",
opts = {},
}
:SendToTerm <command>
If no command is provided an input is shown to you so you can type your command.
The last opened, non-hidden, terminal in your current tab is used. If no terminal is found a new one is created and the command is sent to it.
-- Repeat last command
vim.keymap.set("n", "<leader>pr", "<cmd>SendToTerm !!<cr>")
-- Open a ui input so you can type any command
vim.keymap.set("n", "<leader>ps", "<cmd>SendToTerm<cr>")
-- Run make
vim.keymap.set("n", "<leader>ps", "<cmd>SendToTerm make<cr>")