Skip to content
Discussion options

You must be logged in to vote

I figured it out after looking at it a bit more

local toggle_terminal = function()
  local list = Snacks.terminal.list()
  if #list > 0 then
    if vim.bo.buftype ~= "terminal" then
      local terminal = list[1]
      terminal:show()
      terminal:focus()
    end
  else
    Snacks.terminal()
  end
end

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@drowning-cat
Comment options

@IceSentry
Comment options

Answer selected by IceSentry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants