modify main function to allow root nvim to have the same theme as user nvim
This commit is contained in:
parent
10e4445278
commit
4c830de928
34
init.lua
34
init.lua
@ -22,3 +22,37 @@ vim.diagnostic.config({
|
||||
})
|
||||
require("config.lazy")
|
||||
require("config.keymaps")
|
||||
local default_theme = "base16-oceanicnext"
|
||||
|
||||
local function get_tinty_theme()
|
||||
local theme_name = vim.fn.system("cat ~/.local/share/tinted-theming/tinty/current_scheme")
|
||||
|
||||
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
|
||||
|
||||
main()
|
||||
|
||||
@ -7,9 +7,9 @@
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "562d9724e3869ffd1801c572dd149cc9f8d0cc36" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a979821a975897b88493843301950c456a725982" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "38499e0bda64bc0f3ec6e7f03f8e13dd11c0fa00" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4daa1436595dbce4c6151f75c38a0d855796c554" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1a6d69206749a646ef28bfb39460610b14baff40" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "6620ae1c44dfa8623b22d0cbf873a9e8d073b849" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user