add theme toggler (#245)

This commit is contained in:
siduck76 2021-08-15 00:44:55 +05:30
parent ea0a221230
commit 154ba7d419
5 changed files with 40 additions and 5 deletions

View file

@ -110,6 +110,7 @@ M.theme_switcher = function(opts)
end
if reload_theme(final_theme) then
vim.g.current_nvchad_theme = final_theme
if change then
-- ask for confirmation to set as default theme
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
@ -119,8 +120,11 @@ M.theme_switcher = function(opts)
else
-- will be used in restoring nvchad theme var
final_theme = current_theme
vim.g.current_nvchad_theme = final_theme
end
end
end
-- open a buffer and close it to reload the statusline
vim.cmd("new|bwipeout")
else
final_theme = current_theme
end
@ -130,7 +134,7 @@ M.theme_switcher = function(opts)
-- launch the telescope picker
picker:find()
else
print("No themes found in " .. themes_folder)
print("No themes found in " .. vim.fn.stdpath("config") .. "/lua/themes")
end
end