feat: 上传我的配置

This commit is contained in:
2026-02-06 17:17:48 +08:00
parent 5ae578a012
commit ac517ad717
126 changed files with 15159 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
-- ==========================================================================
-- 1. 自动安装插件管理器 (Lazy.nvim)
-- ==========================================================================
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- ==========================================================================
-- 2. 加载插件 (已替换为更稳定的源)
-- ==========================================================================
require("lazy").setup({
{
-- 【关键修改】换成了官方社区版,更稳定,不会报错
"RRethy/base16-nvim",
lazy = false,
priority = 1000,
},
})
-- ==========================================================================
-- 3. Matugen 热更新逻辑
-- ==========================================================================
local function source_matugen()
local matugen_path = vim.fn.stdpath('config') .. "/generated.lua"
local f = io.open(matugen_path, "r")
if f ~= nil then
io.close(f)
-- 尝试执行生成的文件
local ok, err = pcall(dofile, matugen_path)
if not ok then
-- 如果加载出错,只打印提示,不阻断启动
print("Matugen Load Error: " .. err)
end
else
-- 如果还没有生成过文件,使用内置主题兜底
vim.cmd.colorscheme('habamax')
end
end
-- 热重载函数
local function matugen_reload()
-- 重新加载颜色
source_matugen()
-- 如果你有 lualine可以在这里刷新
-- package.loaded['lualine'] = nil
-- require('lualine').setup({ options = { theme = 'base16' } })
-- 修复一些高亮丢失
vim.api.nvim_set_hl(0, "Comment", { italic = true })
end
-- 监听 Matugen 发出的信号
vim.api.nvim_create_autocmd("Signal", {
pattern = "SIGUSR1",
callback = function()
matugen_reload()
print("Matugen 颜色已更新!")
end,
})
-- 启动时加载一次
source_matugen()

View File

@@ -0,0 +1,59 @@
-- Auto-generated by Matugen
require('base16-colorscheme').setup({
base00 = '{{colors.background.default.hex}}', -- 背景
base01 = '{{colors.surface_container_lowest.default.hex}}', --较浅的背景色
base02 = '{{colors.surface_container_low.default.hex}}',
base03 = '{{colors.primary.default.hex}}', -- 键盘字符,匹配大括号
base04 = '{{colors.on_surface_variant.default.hex}}',
base05 = '{{colors.primary.default.hex}}', -- 括号,运算符
base06 = '{{colors.inverse_on_surface.default.hex}}',
base07 = '{{colors.surface_bright.default.hex}}',
base08 = '{{colors.tertiary.default.hex}}',-- 变量名
base09 = '{{colors.secondary_fixed.default.hex}}', -- 整数、布尔值 (True/False)。
base0A = '{{colors.secondary.default.hex}}', --类名 (Class)、搜索匹配到的背景
base0B = '{{colors.primary_fixed_dim.default.hex}}', -- 字符串
base0C = '{{colors.tertiary_fixed_dim.default.hex}}',
base0D = '{{colors.primary_container.default.hex}}', -- 函数名
base0E = '{{colors.secondary_fixed_dim.default.hex}}', -- 关键词 (if, else, return, import)。
base0F = '{{colors.error.default.hex}}',
})
-- We first theme base16, but we also need to fix some other colors that don't
-- contrast well by default
-- Helper function to set multiple highlight groups at once
local function set_hl_mutliple(groups, value)
for _, v in pairs(groups) do
vim.api.nvim_set_hl(0, v, value)
end
end
-- Make selected text stand out more
vim.api.nvim_set_hl(0, 'Visual', {
bg = '{{colors.on_surface.default.hex}}', -- 选中文字背景
fg = '{{colors.surface.default.hex}}', -- 选中文字颜色
})
set_hl_mutliple({ 'TSComment', 'Comment' }, {
fg = '{{colors.outline.default.hex}}', -- 注释
})
set_hl_mutliple({ 'TSMethod', 'Method' }, {
fg = '{{colors.tertiary.default.hex}}',
})
set_hl_mutliple({ 'TSFunction', 'Function' }, {
fg = '{{colors.secondary.default.hex}}',
})
vim.api.nvim_set_hl(0, 'Keyword', {
fg = '{{colors.inverse_primary.default.hex}}',
})
vim.api.nvim_set_hl(0, 'MsgArea', {
bg = '{{colors.surface_container.default.hex}}', --底边
fg = '{{colors.primary.default.hex}}',
})