177 lines
6.0 KiB
Lua
177 lines
6.0 KiB
Lua
-- =============================================================================
|
||
-- ui.lua — UI 美化套件
|
||
-- =============================================================================
|
||
|
||
return {
|
||
-- bufferline: 顶部标签栏
|
||
{
|
||
"akinsho/bufferline.nvim",
|
||
version = "*",
|
||
event = "BufAdd",
|
||
dependencies = {
|
||
"nvim-tree/nvim-web-devicons",
|
||
"famiu/bufdelete.nvim",
|
||
},
|
||
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,
|
||
offsets = {
|
||
{ filetype = "oil", text = "文件浏览器", highlight = "Directory", text_align = "left" },
|
||
{ filetype = "NvimTree", 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" } },
|
||
-- 隐藏非文件 buffer(quickfix/终端/help 等),避免 cmake 输出污染标签栏
|
||
custom_filter = function(bufnr)
|
||
return vim.bo[bufnr].buftype == ""
|
||
end,
|
||
},
|
||
})
|
||
end,
|
||
},
|
||
|
||
-- lualine: 底部状态栏
|
||
{
|
||
"nvim-lualine/lualine.nvim",
|
||
event = "BufAdd",
|
||
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,
|
||
},
|
||
-- 禁用 vim.ui.input 的补全,避免 nvim-tree 文件操作时回车误触发补全
|
||
input = {
|
||
enabled = false,
|
||
},
|
||
},
|
||
dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" },
|
||
},
|
||
|
||
-- nvim-notify: 通知美化
|
||
{
|
||
"rcarriga/nvim-notify",
|
||
event = "BufAdd",
|
||
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",
|
||
lazy = false,
|
||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||
config = function()
|
||
require("dashboard").setup({
|
||
theme = "doom",
|
||
config = {
|
||
header = {
|
||
"",
|
||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗ ██╗██╗███╗ ███╗",
|
||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║ ██║██║████╗ ████║",
|
||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║ ██║██║██╔████╔██║",
|
||
" ██║╚██╗██║██╔════╝██║ ██║╚██╗ ██╔╝╚██╗ ██╔╝██║██║╚██╔╝██║",
|
||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║",
|
||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
|
||
"",
|
||
},
|
||
center = {
|
||
{ icon = " ", key = "f", desc = "f 查找文件", action = "Telescope find_files" },
|
||
{ icon = " ", key = "r", desc = "r 最近文件", action = "Telescope oldfiles" },
|
||
{ icon = " ", key = "g", desc = "g 全局搜索", action = "Telescope live_grep" },
|
||
{ icon = " ", key = "l", desc = "l 插件管理", action = "Lazy" },
|
||
{ icon = " ", key = "m", desc = "m LSP 管理", action = "Mason" },
|
||
{ icon = " ", key = "q", desc = "q 退出", action = "qa" },
|
||
},
|
||
footer = { " type :help for help · :q to exit" },
|
||
vertical_center = true, -- 官方垂直居中选项
|
||
},
|
||
})
|
||
end,
|
||
},
|
||
|
||
-- 通用依赖
|
||
{ "nvim-lua/plenary.nvim", lazy = true },
|
||
{ "MunifTanjim/nui.nvim", lazy = true },
|
||
} |