Added new theme switcher and removed lazy loading

This commit is contained in:
2023-09-18 10:39:20 +02:00
parent 7a62a045f4
commit b3523a5857
2 changed files with 15 additions and 40 deletions

View File

@@ -1,37 +1,25 @@
local M = {}
function M.themeselector()
local themes = {
"rose-pine-main",
"rose-pine-moon",
"rose-pine-dawn",
"catppuccin-mocha",
"catppuccin-latte",
"nightfly",
"tokyonight-night",
"tokyonight-storm",
"tokyonight-moon",
"tokyonight-day",
"dracula",
"dracula-soft",
"OceanicNext",
"onelight",
"onedark",
"onedark_dark",
"onedark_vivid",
"doom-one",
"moonlight",
"mellow",
"ofirkai",
"kanagawa-lotus",
"kanagawa-dragon",
"kanagawa-wave",
}
local configDir = vim.fn.stdpath("config")
local prefsFile = configDir .. "/lua/taken/prefs.lua"
local oldstring = 'M.colorscheme = .*"'
local colors = vim.fn.globpath(vim.o.rtp, "colors/*", 1, 1)
local dataDir = vim.fn.stdpath("data")
local newpath = string.gsub(dataDir, "%-", "%%-")
local themes = {}
for i, v in ipairs(colors) do
if string.find(v, "lazy") then
local filename = string.gsub(v, newpath .. "\\lazy\\.*\\", "")
local themename = string.gsub(filename, ".vim", "")
local themename2 = string.gsub(themename, ".lua", "")
table.insert(themes, themename2)
end
end
local opts = {
prompt = "Select a theme",
}
@@ -48,7 +36,6 @@ function M.themeselector()
end
local exec = function(choice)
if choice == nil then
vim.notify("No theme selected!")
return