Skip to content

Commit

Permalink
fix(mini-indentscope): disable indentscope in buftypes and terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
Subjective committed Sep 9, 2023
1 parent 8284d88 commit 4ec3911
Showing 1 changed file with 39 additions and 32 deletions.
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 buftiypes",
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

0 comments on commit 4ec3911

Please sign in to comment.