diff --git a/lua/nvterm/terminal.lua b/lua/nvterm/terminal.lua index 48a24ab..78e948c 100644 --- a/lua/nvterm/terminal.lua +++ b/lua/nvterm/terminal.lua @@ -72,11 +72,16 @@ local call_and_restore = function(fn, opts) vim.cmd(mode) end -nvterm.send = function(cmd, type) +nvterm.send = function(cmd, type, focus) if not cmd then return end - call_and_restore(ensure_and_send, { cmd, type }) + + if not focus then + call_and_restore(ensure_and_send, { cmd, type }) + else + ensure_and_send(cmd, type) + end end nvterm.hide_term = function(term) @@ -152,7 +157,6 @@ nvterm.toggle_all_terms = function() end end - nvterm.close_all_terms = function() for _, buf in ipairs(nvterm.list_active_terms "buf") do vim.cmd("bd! " .. tostring(buf))