SexNvim/lua/config/mutton.lua

34 lines
1.1 KiB
Lua
Raw Normal View History

-- Для Mutton
local normal_bg = vim.fn.synIDattr(vim.fn.hlID("Normal"), "bg")
vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = normal_bg} ) -- overrides `~` character at the end of buffer
vim.api.nvim_set_hl(0, "VertSplit", { fg = normal_bg} ) -- overrides `~` character at the end of buffer
vim.api.nvim_set_hl(0, "WinSeparator", { fg = normal_bg })
local mutton = false
local function on_buf_read()
vim.defer_fn(function()
local buf_name = vim.api.nvim_buf_get_name(0) -- Получаем имя файла
if buf_name:match("%.md$") and mutton == false then -- Проверяем, заканчивается ли имя на ".md"
mutton = true
vim.cmd("MuttonToggle")
elseif buf_name:match("NvimTree_1$") then
elseif buf_name:match("%[%[Mutton%]%]$") then
elseif mutton == true and not buf_name:match("%.md$") then
mutton = false
vim.cmd('winc h')
vim.cmd('q')
vim.cmd('winc l')
vim.cmd('q')
vim.cmd("MuttonToggle")
end
end, 100)
end
vim.api.nvim_create_autocmd("BufEnter", { callback = on_buf_read })