Skip to content

Commit d346001

Browse files
committed
lib_term: if terminal is open and LTListTerms selects it, set it as cur
win. Signed-off-by: ldelossa <louis.delos@gmail.com>
1 parent ae7c77e commit d346001

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/litee/lib/term/init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ function M.list_terminals()
109109
end
110110
},
111111
function (choice)
112+
-- first see if there's a window that's opened with this term
113+
for _, w in ipairs(vim.api.nvim_list_wins()) do
114+
if vim.api.nvim_win_get_buf(w) == choice["buf"] then
115+
vim.api.nvim_set_current_win(w)
116+
return
117+
end
118+
end
119+
112120
if config.position == "top" then
113121
vim.cmd('topleft split')
114122
else

0 commit comments

Comments
 (0)