mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-30 16:25:41 +00:00
feat(nvim/theme): support macos theme changeing
This commit is contained in:
parent
665f4fe4f0
commit
70b247edd4
3 changed files with 1 additions and 39 deletions
|
@ -8,6 +8,7 @@ Plug("nvim-lua/plenary.nvim")
|
||||||
-- General
|
-- General
|
||||||
Plug("ojroques/nvim-osc52")
|
Plug("ojroques/nvim-osc52")
|
||||||
-- Look
|
-- Look
|
||||||
|
Plug('f-person/auto-dark-mode.nvim')
|
||||||
Plug("rose-pine/neovim", { as = "rose-pine", tag = "v3.*" })
|
Plug("rose-pine/neovim", { as = "rose-pine", tag = "v3.*" })
|
||||||
Plug("nvim-lualine/lualine.nvim")
|
Plug("nvim-lualine/lualine.nvim")
|
||||||
Plug("Yggdroot/indentLine")
|
Plug("Yggdroot/indentLine")
|
||||||
|
|
|
@ -129,7 +129,6 @@ require("mason").setup({
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"typos_lsp", -- all
|
"typos_lsp", -- all
|
||||||
"angularls", -- angular
|
|
||||||
"ansiblels", -- ansible
|
"ansiblels", -- ansible
|
||||||
"bashls", -- bash
|
"bashls", -- bash
|
||||||
"buf_ls", -- buf
|
"buf_ls", -- buf
|
||||||
|
|
|
@ -12,41 +12,3 @@ require("rose-pine").setup({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.cmd("colorscheme rose-pine")
|
vim.cmd("colorscheme rose-pine")
|
||||||
vim.o.background = "light"
|
|
||||||
|
|
||||||
local debounce = function(ms, fn)
|
|
||||||
local running = false
|
|
||||||
return function()
|
|
||||||
if running then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
vim.defer_fn(function()
|
|
||||||
running = false
|
|
||||||
end, ms)
|
|
||||||
running = true
|
|
||||||
vim.schedule(fn)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create a job to detect current gnome color scheme and set background
|
|
||||||
local Job = require("plenary.job")
|
|
||||||
local set_background = function()
|
|
||||||
local j = Job:new({ command = "gsettings", args = { "get", "org.gnome.desktop.interface", "color-scheme" } })
|
|
||||||
j:sync()
|
|
||||||
if j:result()[1] == "'default'" then
|
|
||||||
vim.o.background = "light"
|
|
||||||
else
|
|
||||||
vim.o.background = "dark"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Call imidiatly to set initially
|
|
||||||
set_background()
|
|
||||||
|
|
||||||
-- Listen for SIGUSR1 signal to update background
|
|
||||||
local group = vim.api.nvim_create_augroup("BackgroundWatch", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd("Signal", {
|
|
||||||
pattern = "SIGUSR1",
|
|
||||||
callback = debounce(500, set_background),
|
|
||||||
group = group,
|
|
||||||
})
|
|
||||||
|
|
Loading…
Reference in a new issue