fix tinty setup command so that root also gets the set theme
This commit is contained in:
parent
db5afcc9d9
commit
93bee8f078
4 changed files with 63 additions and 44 deletions
1
lua/plugins/tinted.lua
Normal file
1
lua/plugins/tinted.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
return {}
|
||||
|
|
@ -1,4 +1,37 @@
|
|||
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 {
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
|
|
@ -9,26 +42,30 @@ return {
|
|||
opts = {},
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
theme = "base16",
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "diagnostics" },
|
||||
lualine_c = { "filename", "branch", "navic" },
|
||||
lualine_x = { "lsp_status", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
})
|
||||
"RRethy/base16-nvim",
|
||||
lazy = false,
|
||||
init = function()
|
||||
main()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", "RRethy/base16-nvim" },
|
||||
opts = {
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "diagnostics" },
|
||||
lualine_c = { "filename", "branch", "navic" },
|
||||
lualine_x = { "lsp_status", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvimdev/lspsaga.nvim",
|
||||
|
|
|
|||
Loading…
Reference in a new issue