-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
34 lines (28 loc) · 729 Bytes
/
init.lua
File metadata and controls
34 lines (28 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Configuration
_G.Common = require('config.common')
require("config.options")
require("config.keymaps")
require("config.lazy")
-- Save and load colorscheme
local theme_cache = vim.fn.stdpath("data") .. "/last_theme.lua"
local function load_theme()
local f = io.open(theme_cache, "r")
if f then
local theme = f:read("*all")
f:close()
pcall(vim.cmd.colorscheme, theme)
else
vim.cmd.colorscheme "catppuccin"
end
end
vim.api.nvim_create_autocmd("ColorScheme", {
callback = function()
local theme = vim.g.colors_name
local f = io.open(theme_cache, "w")
if f then
f:write(theme)
f:close()
end
end,
})
load_theme()