Skip to content

Commit

Permalink
lib_term: if terminal is open and LTListTerms selects it, set it as cur
Browse files Browse the repository at this point in the history
win.

Signed-off-by: ldelossa <louis.delos@gmail.com>
  • Loading branch information
ldelossa committed Jul 30, 2022
1 parent ae7c77e commit d346001
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/litee/lib/term/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ function M.list_terminals()
end
},
function (choice)
-- first see if there's a window that's opened with this term
for _, w in ipairs(vim.api.nvim_list_wins()) do
if vim.api.nvim_win_get_buf(w) == choice["buf"] then
vim.api.nvim_set_current_win(w)
return
end
end

if config.position == "top" then
vim.cmd('topleft split')
else
Expand Down

0 comments on commit d346001

Please sign in to comment.