add windows support for compile theme autocmd
This commit is contained in:
parent
e8e7ed6144
commit
5246faa09a
|
@ -25,7 +25,7 @@ M.lazy = function(install_path)
|
||||||
require "plugins"
|
require "plugins"
|
||||||
|
|
||||||
vim.fn.mkdir(vim.g.base46_cache, "p")
|
vim.fn.mkdir(vim.g.base46_cache, "p")
|
||||||
vim.cmd "CompileNvTheme"
|
require("base46").load_all_highlights()
|
||||||
require("lazy").load { plugins = "nvim-treesitter" }
|
require("lazy").load { plugins = "nvim-treesitter" }
|
||||||
|
|
||||||
-- install binaries from mason.nvim & tsparsers on LazySync
|
-- install binaries from mason.nvim & tsparsers on LazySync
|
||||||
|
|
|
@ -19,14 +19,37 @@ autocmd("FileType", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
autocmd("BufWritePost", {
|
local sep = vim.loop.os_uname().sysname:find "windows" and "\\" or "/"
|
||||||
pattern = "*lua",
|
|
||||||
callback = function()
|
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
|
||||||
|
|
||||||
if string.find(bufname, "custom") and string.find(bufname, "lua") then
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
require("plenary.reload").reload_module "base46"
|
pattern = vim.fn.glob(
|
||||||
require("base46").load_all_highlights()
|
table.concat({
|
||||||
end
|
vim.fn.stdpath "config",
|
||||||
|
"lua",
|
||||||
|
"custom",
|
||||||
|
"**",
|
||||||
|
"*.lua",
|
||||||
|
}, sep),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
|
||||||
|
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||||
|
|
||||||
|
callback = function(opts)
|
||||||
|
require("plenary.reload").reload_module "base46"
|
||||||
|
local file = string
|
||||||
|
.gsub(vim.fn.fnamemodify(opts.file, ":r"), vim.fn.stdpath "config" .. sep .. "lua" .. sep, "")
|
||||||
|
:gsub(sep, ".")
|
||||||
|
require("plenary.reload").reload_module(file)
|
||||||
|
require("plenary.reload").reload_module "custom.chadrc"
|
||||||
|
|
||||||
|
local config = require("core.utils").load_config().ui
|
||||||
|
|
||||||
|
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.statusline.theme .. "').run()"
|
||||||
|
|
||||||
|
require("base46").load_all_highlights()
|
||||||
|
-- vim.cmd("redraw!")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue