Files
nvim-config/lua/plugins/editor.lua
T
Super_Z 8ad2067a64 feat: VSCode 风格 Neovim 配置
- 分层架构:config/{options,keymaps,lazy} + plugins/
- 保留:blink.cmp, oil.nvim, runner.lua, cmake-tools, diffview, tokyonight
- 新增 UI:bufferline, lualine, noice, nvim-notify, dashboard, dressing
- 新增编辑器:Comment, nvim-surround, vim-illuminate, toggleterm, flash
- 新增视觉:indent-blankline, nvim-ufo, rainbow-delimiters
- 新增 Git:lazygit 集成
- 新增 DAP:persistent-breakpoints, nvim-dap-virtual-text
- 修复:which-key 启用, rustaceanvim 填充, 键位冲突解决
- 语法检查:22/22 文件全部通过 luajit -b
2026-07-16 11:45:07 +08:00

127 lines
4.9 KiB
Lua

-- =============================================================================
-- editor.lua — 编辑器增强插件
-- =============================================================================
-- 【全新文件】补全你缺少的编辑器功能插件。
return {
-- ─────────────────────────────────────────────
-- Comment.nvim: 注释快捷键 gcc / gc
-- ─────────────────────────────────────────────
{
"numToStr/Comment.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {},
},
-- ─────────────────────────────────────────────
-- nvim-surround: 环绕操作 ysiw" / cs"' / ds"
-- ─────────────────────────────────────────────
{
"kylechui/nvim-surround",
event = { "BufReadPre", "BufNewFile" },
version = "*",
opts = {},
},
-- ─────────────────────────────────────────────
-- vim-illuminate: 高亮光标下相同单词
-- ─────────────────────────────────────────────
{
"RRethy/vim-illuminate",
event = { "BufReadPre", "BufNewFile" },
opts = {
delay = 200,
large_file_cutoff = 2000,
},
config = function(_, opts)
require("illuminate").configure(opts)
end,
},
-- ─────────────────────────────────────────────
-- toggleterm.nvim: 集成终端
-- ─────────────────────────────────────────────
{
"akinsho/toggleterm.nvim",
version = "*",
keys = { "<C-\\" },
opts = {
size = function(term)
if term.direction == "horizontal" then
return vim.o.lines * 0.3
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
direction = "float",
float_opts = {
border = "curved",
winblend = 0,
},
shell = vim.o.shell,
},
},
-- ─────────────────────────────────────────────
-- flash.nvim: 快速跳转
-- ─────────────────────────────────────────────
{
"folke/flash.nvim",
event = "VeryLazy",
opts = {},
},
-- ─────────────────────────────────────────────
-- indent-blankline: 缩进参考线
-- ─────────────────────────────────────────────
{
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" },
main = "ibl",
opts = {
indent = { char = "│" },
scope = { enabled = true },
},
},
-- ─────────────────────────────────────────────
-- nvim-ufo: 代码折叠
-- ─────────────────────────────────────────────
{
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
event = { "BufReadPost", "BufNewFile" },
config = function()
vim.o.foldmethod = "expr"
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
})
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "关闭所有折叠" })
vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "展开所有折叠" })
end,
},
-- ─────────────────────────────────────────────
-- rainbow-delimiters: 彩虹括号
-- ─────────────────────────────────────────────
{
"HiPhish/rainbow-delimiters.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
local rainbow_delimiters = require("rainbow-delimiters")
vim.g.rainbow_delimiters = {
strategy = { [''] = rainbow_delimiters.strategy.global },
query = { [''] = 'rainbow-delimiters' },
}
end,
},
}