- Disable unused built-in plugins at top of init.lua - Defer treesitter and lsp to VimEnter - Use packadd for on-demand plugin loading (conform, lspconfig, fugitive) - Defer clipboard initialization to avoid provider check blocking - Wrap LSP/diagnostic keymaps in functions to defer module loading - Defer mini.icons setup to VimEnter Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
54 lines
1.3 KiB
Lua
54 lines
1.3 KiB
Lua
vim.g.netrw_banner = 0
|
||
|
||
vim.opt.nu = true
|
||
vim.opt.relativenumber = true
|
||
vim.opt.cursorline = true
|
||
vim.opt.cursorlineopt = "both"
|
||
vim.opt.autoread = true
|
||
|
||
vim.opt.tabstop = 4
|
||
vim.opt.softtabstop = 4
|
||
vim.opt.shiftwidth = 4
|
||
vim.opt.expandtab = true
|
||
|
||
vim.opt.smartindent = true
|
||
vim.opt.inccommand = "split"
|
||
|
||
vim.opt.splitbelow = true
|
||
vim.opt.splitright = true
|
||
|
||
vim.opt.ignorecase = true
|
||
vim.opt.smartcase = true
|
||
vim.opt.laststatus = 3
|
||
|
||
vim.opt.swapfile = false
|
||
vim.opt.backup = false
|
||
vim.opt.undodir = vim.fn.stdpath("data") .. "/undodir"
|
||
vim.opt.undofile = true
|
||
|
||
vim.opt.completeopt = "menuone,noselect,fuzzy,nosort"
|
||
vim.opt.shortmess:append("c")
|
||
-- 延迟初始化 clipboard,避免启动时 provider 检测阻塞(SSH 环境尤其明显)
|
||
vim.schedule(function()
|
||
vim.opt.clipboard:append("unnamedplus")
|
||
end)
|
||
vim.opt.isfname:append("@-@")
|
||
vim.opt.scrolloff = 8
|
||
|
||
vim.opt.colorcolumn = "0"
|
||
vim.opt.signcolumn = "yes"
|
||
vim.opt.termguicolors = true
|
||
|
||
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { link = "DiffAdd" })
|
||
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { link = "DiffChange" })
|
||
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { link = "DiffDelete" })
|
||
|
||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||
desc = "Highlight when yanking (copying) text",
|
||
callback = function()
|
||
vim.hl.on_yank()
|
||
end,
|
||
})
|
||
|
||
vim.opt.foldlevel = 99 -- 打开文件时默认展开所有折叠
|