Skip to content

Commit

Permalink
fix: handle errors when switching buffer #453 (#454)
Browse files Browse the repository at this point in the history
Co-authored-by: towry <[email protected]>
  • Loading branch information
towry and towry authored Jul 3, 2023
1 parent 4cac5c9 commit 029ad96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lua/toggleterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ local function close_last_window(term)
local only_one_window = fn.winnr("$") == 1
if only_one_window and vim.bo[term.bufnr].filetype == constants.FILETYPE then
if term:is_split() then
vim.cmd("keepalt bnext")
return true
local has_next = pcall(vim.cmd, "keepalt bnext")
return has_next
end
end
return false
Expand Down Expand Up @@ -247,6 +247,7 @@ function _G.___toggleterm_winbar_click(id)
term:toggle()
end
end

--- If a count is provided we operate on the specific terminal buffer
--- i.e. 2ToggleTerm => open or close Term 2
--- if the count is 1 we use a heuristic which is as follows
Expand Down

0 comments on commit 029ad96

Please sign in to comment.