🎨 Automatic Colorscheme
- Store/restore the colorscheme when changed - Falls back on $KITTY_THEME and then the default catppuccin-frappe
This commit is contained in:
+2
-1
@@ -2,4 +2,5 @@ lazy-lock.json
|
|||||||
.luarc.json
|
.luarc.json
|
||||||
.neoconf.json
|
.neoconf.json
|
||||||
lazyvim.json
|
lazyvim.json
|
||||||
debug/
|
.colorscheme
|
||||||
|
debug/
|
||||||
|
|||||||
@@ -9,6 +9,19 @@ vim.api.nvim_create_user_command("Q", function()
|
|||||||
vim.cmd.qall()
|
vim.cmd.qall()
|
||||||
end, { force = true })
|
end, { force = true })
|
||||||
|
|
||||||
|
-- ------------------------------ Auto-Commands --------------------------------
|
||||||
|
-- Autosave Colorscheme
|
||||||
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
desc = "Store colorscheme name",
|
||||||
|
callback = function()
|
||||||
|
print("colorscheme:", vim.g.colors_name)
|
||||||
|
vim.fn.writefile(
|
||||||
|
{ vim.g.colors_name },
|
||||||
|
vim.fn.stdpath("config") .. "/.colorscheme"
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- --------------------------------- Keymaps -----------------------------------
|
-- --------------------------------- Keymaps -----------------------------------
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
wk.add({
|
wk.add({
|
||||||
|
|||||||
+11
-5
@@ -2,14 +2,20 @@
|
|||||||
-- ---------------------------------- Style ------------------------------------
|
-- ---------------------------------- Style ------------------------------------
|
||||||
-- -----------------------------------------------------------------------------
|
-- -----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Get the kitty theme
|
-- Restore Colorscheme
|
||||||
if os.getenv("KITTY_THEME") then
|
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.colorscheme") == 1 then
|
||||||
KITTY_THEME = os.getenv("KITTY_THEME")
|
-- Load the stored colorscheme
|
||||||
|
STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1]
|
||||||
|
else
|
||||||
|
-- Get the kitty theme
|
||||||
|
if os.getenv("KITTY_THEME") then
|
||||||
|
KITTY_THEME = os.getenv("KITTY_THEME")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply the colorscheme
|
-- Apply the colorscheme
|
||||||
vim.cmd.colorscheme(KITTY_THEME or "catppuccin-frappe")
|
vim.cmd.colorscheme(STORED_THEME or KITTY_THEME or "catppuccin-frappe")
|
||||||
|
|
||||||
-- Set GUI font
|
-- Set GUI font
|
||||||
vim.opt.guifont = "Iosevka:#e-subpixelantialias:h12"
|
vim.opt.guifont = "Iosevka:#e-subpixelantialias:h12"
|
||||||
vim.g.have_nerd_font = true
|
vim.g.have_nerd_font = true
|
||||||
|
|||||||
Reference in New Issue
Block a user