This adds a skip_toggle option to allow users skip specific terminals when toggling. A use case is when using the file explorer lf.nvim which is based on toggleterm.nvim. A common scenario on my side is that there are two hidden terminals, an Lf terminal and a Shell terminal, where I hope the Shell terminal always shows up on ToggleTerm, even though it is not the last toggled one.
With the skip_toggle this behavior can be achieved:
toggleterm.setup({
open_mapping = [[<m-=>]],
skip_toggle = function(t)
return t and t.cmd and vim.startswith(t.cmd, "lf ")
end,
}
This adds a
skip_toggle
option to allow users skip specific terminals when toggling. A use case is when using the file explorer lf.nvim which is based on toggleterm.nvim. A common scenario on my side is that there are two hidden terminals, an Lf terminal and a Shell terminal, where I hope the Shell terminal always shows up onToggleTerm
, even though it is not the last toggled one.With the
skip_toggle
this behavior can be achieved:https://github.com/akinsho/toggleterm.nvim/assets/71320000/a22fe4da-6abd-467e-8212-e8d8c97da383