modify main function to allow root nvim to have the same theme as user nvim
This commit is contained in:
parent
10e4445278
commit
4c830de928
3 changed files with 36 additions and 39 deletions
|
|
@ -1,37 +1,3 @@
|
|||
local default_theme = "base16-oceanicnext"
|
||||
|
||||
local function get_tinty_theme()
|
||||
local theme_name = vim.fn.system(
|
||||
"tinty -d /home/lucy/.local/share/tinted-theming/tinty/ current &> /dev/null && tinty -d /home/lucy/.local/share/tinted-theming/tinty/ current"
|
||||
)
|
||||
|
||||
if vim.v.shell_error ~= 0 then
|
||||
return default_theme
|
||||
else
|
||||
return vim.trim(theme_name)
|
||||
end
|
||||
end
|
||||
|
||||
local function handle_focus_gained()
|
||||
local new_theme_name = get_tinty_theme()
|
||||
local current_theme_name = vim.g.colors_name
|
||||
|
||||
if current_theme_name ~= new_theme_name then
|
||||
vim.cmd("colorscheme " .. new_theme_name)
|
||||
end
|
||||
end
|
||||
|
||||
local function main()
|
||||
vim.o.termguicolors = true
|
||||
vim.g.tinted_colorspace = 256
|
||||
local current_theme_name = get_tinty_theme()
|
||||
|
||||
vim.cmd("colorscheme " .. current_theme_name)
|
||||
|
||||
vim.api.nvim_create_autocmd("FocusGained", {
|
||||
callback = handle_focus_gained,
|
||||
})
|
||||
end
|
||||
return {
|
||||
{
|
||||
"vyfor/cord.nvim",
|
||||
|
|
@ -47,9 +13,6 @@ return {
|
|||
"tinted-theming/tinted-vim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
init = function()
|
||||
main()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
|
|
|
|||
Loading…
Reference in a new issue