Small tweaks
This commit is contained in:
@@ -6,8 +6,9 @@ local prefsFile = configDir .. "/lua/taken/prefs.lua"
|
||||
local getAllThemes = function()
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "ThemeSwitcher", modeline = false })
|
||||
|
||||
local colors = vim.fn.globpath(vim.o.rtp, "colors/*", 1, 1)
|
||||
local colors = vim.fn.globpath(vim.o.rtp, "colors/*", true, 1)
|
||||
local dataDir = vim.fn.stdpath("data")
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
local newpath = string.gsub(dataDir, "%-", "%%-")
|
||||
local themes = {}
|
||||
|
||||
@@ -35,10 +36,22 @@ end
|
||||
local change_theme = function(old, new)
|
||||
-- function from nvchad
|
||||
local file = io.open(prefsFile, "r")
|
||||
|
||||
if file == nil then
|
||||
vim.notify("Could not open " .. prefsFile, 4)
|
||||
return
|
||||
end
|
||||
|
||||
local added_pattern = string.gsub(old, "-", "%%-")
|
||||
local new_content = file:read("*all"):gsub(added_pattern, new)
|
||||
|
||||
file = io.open(prefsFile, "w")
|
||||
|
||||
if file == nil then
|
||||
vim.notify("Could not open " .. prefsFile, 4)
|
||||
return
|
||||
end
|
||||
|
||||
file:write(new_content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user