Files
AstroVim_Config/lua/plugins/indent-scope.lua
2024-11-01 10:30:42 +07:00

91 lines
2.6 KiB
Lua

local ignore_filetypes = {
"aerial",
"alpha",
"dashboard",
"help",
"lazy",
"mason",
"neo-tree",
"NvimTree",
"neogitstatus",
"notify",
"startify",
"toggleterm",
"Trouble",
}
local ignore_buftypes = {
"nofile",
"prompt",
"quickfix",
"terminal",
}
local char = "󰥓"
return {
"echasnovski/mini.indentscope",
event = "User AstroFile",
opts = function()
vim.api.nvim_set_hl(0, "MiniIndentscopeSymbol", { fg = "#FF4500" }) -- Replace #FF4500 with your desired color
return {
options = { try_as_border = true, border = "both" },
symbol = require("astrocore").plugin_opts("indent-blankline.nvim").context_char or char,
draw = {
delay = 0,
animation = function(s, n) return 10 end,
},
}
end,
dependencies = {
{
"lukas-reineke/indent-blankline.nvim",
optional = true,
opts = { scope = { enabled = false } },
},
{
"AstroNvim/astrocore",
opts = {
autocmds = {
mini_indentscope = {
{
event = "FileType",
desc = "Disable indentscope for certain filetypes",
callback = function(event)
if vim.b[event.buf].miniindentscope_disable == nil then
local filetype = vim.bo[event.buf].filetype
local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim"
if vim.tbl_contains(blankline_opts.filetype_exclude or ignore_filetypes, filetype) then
vim.b[event.buf].miniindentscope_disable = true
end
end
end,
},
{
event = "BufWinEnter",
desc = "Disable indentscope for certain buftypes",
callback = function(event)
if vim.b[event.buf].miniindentscope_disable == nil then
local buftype = vim.bo[event.buf].buftype
local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim"
if vim.tbl_contains(blankline_opts.buftype_exclude or ignore_buftypes, buftype) then
vim.b[event.buf].miniindentscope_disable = true
end
end
end,
},
{
event = "TermOpen",
desc = "Disable indentscope for terminals",
callback = function(event)
if vim.b[event.buf].miniindentscope_disable == nil then
vim.b[event.buf].miniindentscope_disable = true
end
end,
},
},
},
},
},
},
}