How to disable dropbar for terminal tabs? #281
-
|
I am using ToggleTerm with tab direction. However, I'd like to remove dropbar from those tabs. There's an example in the readme to change bar name, but it doesn't work. How can I entirely disable dropbar for terminal tabs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Use
if vim.bo[buf].buftype == 'terminal' then
return {
sources.terminal,
}
endSo if you want no dropbar at all for ToggleTerm tab terminals, add the terminal check to require('dropbar').setup({
bar = {
enable = function(buf, win, _)
buf = vim._resolve_bufnr(buf)
if
not vim.api.nvim_buf_is_valid(buf)
or not vim.api.nvim_win_is_valid(win)
then
return false
end
if vim.bo[buf].buftype == 'terminal' then
return false
end
if
vim.fn.win_gettype(win) ~= ''
or vim.wo[win].winbar ~= ''
or vim.bo[buf].ft == 'help'
then
return false
end
local stat = vim.uv.fs_stat(vim.api.nvim_buf_get_name(buf))
if stat and stat.size > 1024 * 1024 then
return false
end
return vim.bo[buf].ft == 'markdown'
or pcall(vim.treesitter.get_parser, buf)
or not vim.tbl_isempty(vim.lsp.get_clients({
bufnr = buf,
method = 'textDocument/documentSymbol',
}))
end,
},
})That is basically the documented default If your ToggleTerm buffers use a custom filetype and you only want to exclude those, check the buffer with if vim.bo[buf].buftype == 'terminal' and vim.bo[buf].ft == 'toggleterm' then
return false
end |
Beta Was this translation helpful? Give feedback.
Use
bar.enablefor this, notbar.sources.bar.sourcesonly controls what dropbar shows after it has already attached. The default source function actually has a terminal branch:So if you want no dropbar at all for ToggleTerm tab terminals, add the terminal check to
bar.enableinstead: