add autocmd for automatically compiling base46

This commit is contained in:
siduck 2023-02-14 11:12:31 +05:30
parent 7daf171948
commit e8e7ed6144
1 changed files with 12 additions and 4 deletions

View File

@ -4,10 +4,6 @@ vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "da
local new_cmd = vim.api.nvim_create_user_command local new_cmd = vim.api.nvim_create_user_command
new_cmd("CompileNvTheme", function()
require("base46").load_all_highlights()
end, {})
new_cmd("NvChadUpdate", function() new_cmd("NvChadUpdate", function()
require("nvchad").update_nvchad() require("nvchad").update_nvchad()
end, {}) end, {})
@ -22,3 +18,15 @@ autocmd("FileType", {
vim.opt_local.buflisted = false vim.opt_local.buflisted = false
end, end,
}) })
autocmd("BufWritePost", {
pattern = "*lua",
callback = function()
local bufname = vim.api.nvim_buf_get_name(0)
if string.find(bufname, "custom") and string.find(bufname, "lua") then
require("plenary.reload").reload_module "base46"
require("base46").load_all_highlights()
end
end,
})