Skip to content
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

fix(mini-indentscope): correctly disable indentscope in buftypes and terminals #566

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 39 additions & 32 deletions lua/astrocommunity/indent/mini-indentscope/init.lua
Original file line number Diff line number Diff line change
@@ -1,45 +1,52 @@
local excluded_filetypes = {
"Trouble",
"aerial",
"alpha",
"checkhealth",
"dashboard",
"fzf",
"help",
"lazy",
"lspinfo",
"man",
"mason",
"neo-tree",
"notify",
"null-ls-info",
"starter",
"toggleterm",
"undotree",
}
local excluded_buftypes = {
"nofile",
"prompt",
"quickfix",
"terminal",
}

return {
{
"echasnovski/mini.indentscope",
event = "User AstroFile",
opts = { symbol = "│", options = { try_as_border = true } },
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
local excluded_filetypes = {
"Trouble",
"aerial",
"alpha",
"checkhealth",
"dashboard",
"fzf",
"help",
"lazy",
"lspinfo",
"man",
"mason",
"neo-tree",
"notify",
"null-ls-info",
"starter",
"toggleterm",
"undotree",
}
local excluded_buftypes = {
"nofile",
"prompt",
"quickfix",
"terminal",
}
if
vim.tbl_contains(excluded_filetypes, vim.bo["filetype"])
or vim.tbl_contains(excluded_buftypes, vim.bo["buftype"])
then
vim.b.miniindentscope_disable = true
desc = "Disable indentscope for certain filetypes",
pattern = excluded_filetypes,
callback = function(event) vim.b[event.buf].miniindentscope_disable = true end,
})
vim.api.nvim_create_autocmd("BufWinEnter", {
desc = "Disable indentscope for certain buftypes",
callback = function(event)
if vim.tbl_contains(excluded_buftypes, vim.bo[event.buf].buftype) then
vim.b[event.buf].miniindentscope_disable = true
end
end,
})
vim.api.nvim_create_autocmd("TermOpen", {
desc = "Disable indentscope for terminals",
callback = function(event) vim.b[event.buf].miniindentscope_disable = true end,
})
end,
},
{
Expand Down