summaryrefslogtreecommitdiff
path: root/lua/colorscheme_persistence.lua
diff options
context:
space:
mode:
authorbee <beebeeb5k@gmail.com>2026-05-05 22:37:10 +0530
committerbee <beebeeb5k@gmail.com>2026-05-05 22:37:10 +0530
commit9365a8e96827cbf7bc5adad6d29bcd05b4d761b2 (patch)
tree0998a5dcfc4517e4112a2c589e04ac0dbc1e011b /lua/colorscheme_persistence.lua
parent0c50f17133b90c60735f1f51943f51f60372bdd3 (diff)
Migrate from nixcats to nix-wrapper-modules
Diffstat (limited to 'lua/colorscheme_persistence.lua')
-rw-r--r--lua/colorscheme_persistence.lua50
1 files changed, 0 insertions, 50 deletions
diff --git a/lua/colorscheme_persistence.lua b/lua/colorscheme_persistence.lua
deleted file mode 100644
index e5f6cda..0000000
--- a/lua/colorscheme_persistence.lua
+++ /dev/null
@@ -1,50 +0,0 @@
-local M = {}
-
--- (~/.local/share/nvim/last_theme.txt)
-local theme_cache_path = vim.fn.stdpath("data") .. "/last_theme.txt"
-
-M.is_programmatic_change = false
-
-function M.load_theme()
- local theme = ""
-
- local f = io.open(theme_cache_path, "r")
- if f then
- theme = f:read("*all"):gsub("%s+", "")
- f:close()
- end
-
- if theme == "" then
- theme = nixCats.extra("colorscheme")
- end
-
- M.is_programmatic_change = true
- local status, _ = pcall(vim.cmd.colorscheme, theme)
-
- -- just to be safe
- if not status then
- vim.cmd.colorscheme("habamax")
- end
-end
-
-vim.api.nvim_create_autocmd("ColorScheme", {
- callback = function(args)
- -- If the change was programmatic (like at startup), don't overwrite the file
- if M.is_programmatic_change then
- M.is_programmatic_change = false -- Reset for the next manual change
- return
- end
-
- -- Save the new theme name to the file
- local theme_name = args.match
- local f = io.open(theme_cache_path, "w")
- if f then
- f:write(theme_name)
- f:close()
- end
- end,
-})
-
-M.load_theme()
-
-return M