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
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
-- =============================================================================
|
||||
-- ui.lua — UI 美化套件(VSCode 风格核心)
|
||||
-- =============================================================================
|
||||
-- 【全新文件】这是从参考配置提取 + 定制的 UI 套件。
|
||||
-- 包含:bufferline(标签栏)、lualine(状态栏)、noice(命令行)、
|
||||
-- nvim-notify(通知)、dashboard(启动页)、dressing(输入框)。
|
||||
|
||||
return {
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- bufferline: 顶部标签栏(VSCode 核心)
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
version = "*",
|
||||
event = "BufReadPre",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers",
|
||||
style_preset = require("bufferline").style_preset.default,
|
||||
themable = true,
|
||||
numbers = "none",
|
||||
close_command = "Bdelete!",
|
||||
right_mouse_command = "Bdelete!",
|
||||
indicator = { style = "icon", icon = "▎" },
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "●",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15,
|
||||
truncate_names = true,
|
||||
tab_size = 18,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = false,
|
||||
-- ✅ 适配 oil.nvim:左侧文件浏览器偏移
|
||||
offsets = {
|
||||
{
|
||||
filetype = "oil",
|
||||
text = "文件浏览器",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
color_icons = true,
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = false,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true,
|
||||
separator_style = "thin",
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { "close" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- lualine: 底部状态栏(VSCode 核心)
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
globalstatus = true,
|
||||
theme = "tokyonight",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { { "filename", path = 1 } },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- noice.nvim: 命令行美化
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
cmdline = {
|
||||
view = "cmdline_popup",
|
||||
format = {
|
||||
search_down = { icon = " " },
|
||||
search_up = { icon = " " },
|
||||
},
|
||||
},
|
||||
messages = {
|
||||
enabled = true,
|
||||
view = "notify",
|
||||
view_error = "notify",
|
||||
view_warn = "notify",
|
||||
},
|
||||
popupmenu = {
|
||||
enabled = true,
|
||||
backend = "nui",
|
||||
},
|
||||
presets = {
|
||||
bottom_search = false,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = true,
|
||||
lsp_doc_border = true,
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- nvim-notify: 通知美化
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
opts = {
|
||||
timeout = 3000,
|
||||
max_width = 50,
|
||||
render = "compact",
|
||||
stages = "fade",
|
||||
},
|
||||
config = function(_, opts)
|
||||
local notify = require("notify")
|
||||
notify.setup(opts)
|
||||
vim.notify = notify
|
||||
end,
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- dressing.nvim: 输入框美化
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- dashboard-nvim: 启动首页
|
||||
-- ─────────────────────────────────────────────
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
theme = "doom",
|
||||
config = {
|
||||
header = {
|
||||
"",
|
||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗ ██╗██╗███╗ ███╗",
|
||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║ ██║██║████╗ ████║",
|
||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║ ██║██║██╔████╔██║",
|
||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝╚██╗ ██╔╝██║██║╚██╔╝██║",
|
||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║",
|
||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
|
||||
"",
|
||||
},
|
||||
center = {
|
||||
{ icon = " ", key = "f", desc = "查找文件", action = "Telescope find_files" },
|
||||
{ icon = " ", key = "r", desc = "最近文件", action = "Telescope oldfiles" },
|
||||
{ icon = " ", key = "g", desc = "全局搜索", action = "Telescope live_grep" },
|
||||
{ icon = " ", key = "l", desc = "插件管理", action = "Lazy" },
|
||||
{ icon = " ", key = "m", desc = "LSP 管理", action = "Mason" },
|
||||
{ icon = " ", key = "q", desc = "退出", action = "qa" },
|
||||
},
|
||||
footer = { " atdunbg · Neovim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- ─────────────────────────────────────────────
|
||||
-- 通用依赖(多个插件共用)
|
||||
-- ─────────────────────────────────────────────
|
||||
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||
}
|
||||
Reference in New Issue
Block a user