fix tinty setup command so that root also gets the set theme

This commit is contained in:
lucy 2026-03-20 11:34:59 +01:00
commit 93bee8f078
4 changed files with 63 additions and 44 deletions

View file

@ -1,8 +1,10 @@
local opt = vim.opt
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
opt.number = true
opt.relativenumber = true
opt.cursorline = true
opt.termguicolors = true
opt.winborder = "single"
@ -21,25 +23,3 @@ vim.diagnostic.config({
require("config.options")
require("config.lazy")
require("config.keymaps")
local theme_script_path = vim.fn.expand("~/.local/share/tinted-theming/tinty/base16-vim-colors-file.vim")
local function file_exists(file_path)
return vim.fn.filereadable(file_path) == 1 and true or false
end
local function handle_focus_gained()
if file_exists(theme_script_path) then
vim.cmd("source " .. theme_script_path)
end
end
if file_exists(theme_script_path) then
vim.o.termguicolors = true
vim.g.tinted_colorspace = 256
vim.cmd("source " .. theme_script_path)
vim.api.nvim_create_autocmd("FocusGained", {
callback = handle_focus_gained,
})
end