neovim: Follow GNOME theme
This commit is contained in:
parent
65d0f5acba
commit
64da4c43ce
1 changed files with 15 additions and 2 deletions
|
@ -2,8 +2,6 @@ local opt = vim.opt
|
|||
local g = vim.g
|
||||
|
||||
vim.cmd [[
|
||||
colorscheme onehalflight
|
||||
|
||||
if has("autocmd")
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
endif
|
||||
|
@ -146,3 +144,18 @@ cmp.setup {
|
|||
require("leap").add_default_mappings()
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<C-b>", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
|
||||
|
||||
local update_theme = function()
|
||||
local file = io.popen("dconf read /org/gnome/desktop/interface/color-scheme")
|
||||
local theme = file:read("*all")
|
||||
file:close()
|
||||
|
||||
if(string.find(theme, "dark")) then
|
||||
vim.cmd "colorscheme onehalfdark"
|
||||
elseif(string.find(theme, "default")) then
|
||||
vim.cmd "colorscheme onehalflight"
|
||||
end
|
||||
end
|
||||
|
||||
update_theme()
|
||||
vim.loop.new_timer():start(0, 750, vim.schedule_wrap(update_theme))
|
||||
|
|
Loading…
Reference in a new issue