-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Detach from the buffer when general.enable
returns false
#70
Comments
No, because that can accidently disable winbar set by other plugins, see #9. Instead you should improve the |
@lopi-py How about letting |
enable = function(bufnr, winnr)
-- default enable function
return not vim.api.nvim_win_get_config(winnr).zindex
and vim.bo[bufnr].buftype == ""
and vim.bo[bufnr].filetype ~= "" -- new check
and vim.api.nvim_buf_get_name(bufnr) ~= ""
and not vim.wo[winnr].diff
end Yeah, checking if the filetype is not empty seems to work, thanks @Bekaboo |
Can you try detecting the bufname in the |
@Bekaboo sorry for the later response, this seems to work enable = function(bufnr, winnr)
local path = vim.fs.normalize(vim.api.nvim_buf_get_name(bufnr))
if vim.bo[bufnr].buftype ~= "" or path == "" then
return false
end
if path:match "Trouble$" then
print "trouble skipped"
return false
end
return not vim.wo[winnr].diff
end but it is some hacky. I think this is related because it sets vim.api.nvim_create_autocmd("OptionSet", {
pattern = "buftype,filetype,diff",
callback = function(event)
attach(event.buf, 0)
end
}) It works fine for me even with the default |
Because some will want to attach dropbar when some specific options is set so only listen to |
What if it was configurable? require("dropbar").setup {
general = {
-- string | nil
enable_pattern = nil, -- "buftype,filetype,diff"
},
} |
Good idea, will think about this later |
Problem
When using trouble, seems like
general.enable
gives a false positive (I also tried with my own function) so dropbar is attached, but on later calls,general.enable
returns falseExpected behavior
The dropbar should be detached (if attached first) from the given buffer if
general.enable
returns falseThe text was updated successfully, but these errors were encountered: