mirror of
https://github.com/NvChad/NvChad.git
synced 2024-11-10 07:10:44 +00:00
8ad6845386
as the filetype one is related to tabufline and the bufwritepost one is used for reloading nvconfig
28 lines
915 B
Lua
28 lines
915 B
Lua
local autocmd = vim.api.nvim_create_autocmd
|
|
|
|
-- user event that loads after UIEnter + only if file buf is there
|
|
autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
|
|
group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }),
|
|
callback = function(args)
|
|
local file = vim.api.nvim_buf_get_name(args.buf)
|
|
local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf })
|
|
|
|
if not vim.g.ui_entered and args.event == "UIEnter" then
|
|
vim.g.ui_entered = true
|
|
end
|
|
|
|
if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then
|
|
vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false })
|
|
vim.api.nvim_del_augroup_by_name "NvFilePost"
|
|
|
|
vim.schedule(function()
|
|
vim.api.nvim_exec_autocmds("FileType", {})
|
|
|
|
if vim.g.editorconfig then
|
|
require("editorconfig").config(args.buf)
|
|
end
|
|
end)
|
|
end
|
|
end,
|
|
})
|