zbirenbaum / nvterm

NvChad's Official Terminal Plugin ( Unmaintained but still usable and stable), wait for v3.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lazygit integration

Parry-97 opened this issue · comments

Hi, I tried using the send function for this and the command is successfully executed inside the spawned terminal but I can't insert on that specific terminal and the focus remains on the previously active buffer. have to toggle back to the terminal in order to work on it.
Is there another alternative to send to execute the command and to work on the terminal in insert mode ?

Very simple mapping on my side:
image

nvterm deliberately restores focus after sending the command to the terminal:

https://github.com/NvChad/nvterm/blob/29a70ef608a8cc5db3a5fc300d39a39d1a44a863/lua/nvterm/terminal.lua#L65-L80

A workaround is to use the following:

    ["<leader>gg"] = {
      function()
        local term = require("nvterm.terminal").new("float")
        vim.api.nvim_chan_send(term.job_id, "lazygit\n")
      end,
      "open Lazygit",
    },