mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-15 12:03:52 +00:00
nvim config
This commit is contained in:
commit
57407e8ef8
21 changed files with 984 additions and 0 deletions
68
lua/plugins/colorscheme.lua
Normal file
68
lua/plugins/colorscheme.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
return {
|
||||
{
|
||||
"datsfilipe/vesper.nvim",
|
||||
name = "vesper",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'maxmx03/solarized.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
---@type solarized.config
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
name = "tokyonight",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- Auto-detect light/dark mode
|
||||
local function set_theme()
|
||||
-- Check if running in VSCode
|
||||
if vim.env.VSCODE or vim.env.TERM_PROGRAM == "vscode" then
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "light"
|
||||
require('solarized').setup({})
|
||||
vim.cmd.colorscheme("solarized")
|
||||
return
|
||||
end
|
||||
|
||||
-- Check COLORFGBG for other terminals
|
||||
if os.getenv("COLORFGBG") then
|
||||
local colors = vim.split(os.getenv("COLORFGBG"), ";")
|
||||
if colors[2] and tonumber(colors[2]) > 7 then
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "light"
|
||||
require('solarized').setup({})
|
||||
vim.cmd.colorscheme("solarized")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Default to dark
|
||||
vim.o.background = "dark"
|
||||
require("vesper").setup({ transparent = true })
|
||||
vim.cmd.colorscheme("vesper")
|
||||
end
|
||||
|
||||
-- Set theme on startup
|
||||
set_theme()
|
||||
|
||||
-- Add command to manually toggle
|
||||
vim.api.nvim_create_user_command("ToggleTheme", function()
|
||||
if vim.g.colors_name == "vesper" then
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "light"
|
||||
require('solarized').setup({})
|
||||
vim.cmd.colorscheme("solarized")
|
||||
else
|
||||
vim.o.background = "dark"
|
||||
require("vesper").setup({ transparent = true })
|
||||
vim.cmd.colorscheme("vesper")
|
||||
end
|
||||
end, {})
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue