diff options
author | zbirenbaum <zacharyobirenbaum@gmail.com> | 2022-06-19 13:53:04 -0400 |
---|---|---|
committer | zbirenbaum <zacharyobirenbaum@gmail.com> | 2022-06-19 13:53:04 -0400 |
commit | 358ac17fedb32a91ca3aa8440a92866986f85a8f (patch) | |
tree | f1d6bf866b7b7509b2c9a17d5e93316dea715fb5 /lua | |
parent | remove debug print statement (diff) |
fix send term type parameter
Diffstat (limited to 'lua')
-rw-r--r-- | lua/nvterm/terminal.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lua/nvterm/terminal.lua b/lua/nvterm/terminal.lua index a86f8bb..45f1569 100644 --- a/lua/nvterm/terminal.lua +++ b/lua/nvterm/terminal.lua @@ -48,12 +48,11 @@ end local ensure_and_send = function(cmd, type) terminals = util.verify_terminals(terminals) - local term = type and get_type_last(type) or get_last_still_open() or nvterm.new("vertical") - - if not term then - term = nvterm.new("horizontal") + local function select_term() + if not type then return get_last_still_open() or nvterm.new("horizontal") + else return get_type_last(type) or nvterm.new(type) end end - + local term = select_term() a.nvim_chan_send(term.job_id, cmd .. "\n") end @@ -68,9 +67,7 @@ local call_and_restore = function(fn, opts) end nvterm.send = function(cmd, type) - if not cmd then - return - end + if not cmd then return end call_and_restore(ensure_and_send, { cmd, type }) end |