Open nullptr-yxw opened 8 months ago
well yes it is possible but quite useless... here is a snippet from my plugin... .......
local buf_type = vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), 'buftype')
local terminal_buf_found = false
if buf_type ~= 'terminal' then
local buffers = vim.api.nvim_list_bufs()
for _, buf in ipairs(buffers) do
if vim.api.nvim_buf_get_option(buf, 'buftype') == 'terminal' then
vim.api.nvim_win_set_buf(vim.api.nvim_get_current_win(), buf)
terminal_buf_found = true
break
end
end
if not terminal_buf_found then
vim.api.nvim_exec(':ToggleTerm', false)
end
end
the snippet is for a different usecase, in trying to send ctrl+c to the terminal, but maybe thats all you need to write a custom script to achieve what you want
It might be quite difficult to manage the window of the
toggleterm
(for example, #97 and #484), so is it possible to allow users opening the toggleterm in the current window(direction="buffer"), just like:term
? So that the manage of thetoggleterm
window will be more flexible. And the users can use some commands such astab
orsetlocal nobuflisted
to change the performance as well.