feat(ui): modernize nvim with fzf-lua, snacks dashboard, and p10k-style statusline
- Replace Snacks picker with fzf-lua for LSP navigation (gd, gr, gi, gt) - Add fzf-lua plugin with LSP-optimized settings - Fix Mason inconsistencies (add eslint, gopls to ensure_installed) - Replace alpha-nvim with Snacks dashboard (shared config) - Create dashboard_config.lua for DRY dashboard settings - Modernize lualine with p10k-rainbow style and solid backgrounds - Enhance bufferline with LSP diagnostics and modern styling - Update noice with centered cmdline/search and modern icons - Add global rounded borders for floating windows - Improve indent-blankline with scope highlighting - Add return-to-dashboard on last buffer close - Create performance_monitor module Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,114 +3,150 @@ return {
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
local lazy_status = require("lazy.status")
|
||||
|
||||
-- Rainbow colors similar to p10k-rainbow
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
red = "#FF4A4A",
|
||||
fg = "#c3ccdc",
|
||||
bg = "#112638",
|
||||
inactive_bg = "#2c3043",
|
||||
blue = "#61afef",
|
||||
cyan = "#56b6c2",
|
||||
green = "#98c379",
|
||||
magenta = "#c678dd",
|
||||
orange = "#d19a66",
|
||||
red = "#e06c75",
|
||||
yellow = "#e5c07b",
|
||||
fg = "#abb2bf",
|
||||
bg = "#282c34",
|
||||
bg_dark = "#21252b",
|
||||
white = "#ffffff",
|
||||
black = "#000000",
|
||||
}
|
||||
|
||||
local my_lualine_theme = {
|
||||
-- P10k rainbow style theme with solid backgrounds
|
||||
local theme = {
|
||||
normal = {
|
||||
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
a = { bg = colors.blue, fg = colors.black, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.blue },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
z = { bg = colors.blue, fg = colors.black, gui = "bold" },
|
||||
},
|
||||
insert = {
|
||||
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.green },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
z = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
},
|
||||
visual = {
|
||||
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
a = { bg = colors.magenta, fg = colors.black, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.magenta },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
z = { bg = colors.magenta, fg = colors.black, gui = "bold" },
|
||||
},
|
||||
command = {
|
||||
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
a = { bg = colors.yellow, fg = colors.black, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.yellow },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
z = { bg = colors.yellow, fg = colors.black, gui = "bold" },
|
||||
},
|
||||
replace = {
|
||||
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
a = { bg = colors.red, fg = colors.black, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.red },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
z = { bg = colors.red, fg = colors.black, gui = "bold" },
|
||||
},
|
||||
inactive = {
|
||||
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
||||
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
a = { bg = colors.bg_dark, fg = colors.fg },
|
||||
b = { bg = colors.bg_dark, fg = colors.fg },
|
||||
c = { bg = colors.bg_dark, fg = colors.fg },
|
||||
},
|
||||
}
|
||||
|
||||
-- Custom word counter function
|
||||
local function word_count()
|
||||
-- Skip for very large files to avoid performance issues
|
||||
local line_count = vim.api.nvim_buf_line_count(0)
|
||||
if line_count > 10000 then
|
||||
-- LSP client name
|
||||
local function lsp_client()
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
if #clients == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
local words = 0
|
||||
|
||||
-- Get all lines at once for better performance
|
||||
local all_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
|
||||
for _, line in ipairs(all_lines) do
|
||||
if line and #line > 0 then
|
||||
-- Count words (non-whitespace sequences)
|
||||
for _ in line:gmatch("%S+") do
|
||||
words = words + 1
|
||||
end
|
||||
end
|
||||
local names = {}
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(names, client.name)
|
||||
end
|
||||
|
||||
-- Format: show only word count
|
||||
return string.format("%d words", words)
|
||||
return " " .. table.concat(names, ", ")
|
||||
end
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = my_lualine_theme,
|
||||
theme = theme,
|
||||
globalstatus = true,
|
||||
-- Powerline angled separators like p10k
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = { "dashboard", "alpha", "snacks_dashboard" },
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_a = {
|
||||
{ "mode", icon = "" },
|
||||
},
|
||||
lualine_b = {
|
||||
{ "branch", icon = "" },
|
||||
{
|
||||
"diff",
|
||||
symbols = { added = " ", modified = " ", removed = " " },
|
||||
colored = true,
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.yellow },
|
||||
removed = { fg = colors.red },
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||
diagnostics_color = {
|
||||
error = { fg = colors.red },
|
||||
warn = { fg = colors.yellow },
|
||||
info = { fg = colors.cyan },
|
||||
hint = { fg = colors.green },
|
||||
},
|
||||
},
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ "filename", path = 1, symbols = { modified = " ●", readonly = " ", unnamed = " " } },
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
lazy_status.updates,
|
||||
cond = lazy_status.has_updates,
|
||||
color = { fg = "#ff9e64" },
|
||||
color = { fg = colors.orange, bg = colors.bg_dark },
|
||||
},
|
||||
{ "encoding" },
|
||||
{ "fileformat" },
|
||||
{ "filetype" },
|
||||
{ lsp_client, color = { fg = colors.cyan, bg = colors.bg_dark } },
|
||||
},
|
||||
lualine_y = {
|
||||
{ "encoding", icon = "" },
|
||||
{ "fileformat", icons_enabled = true },
|
||||
{ "filetype", colored = true, icon_only = false },
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{
|
||||
word_count,
|
||||
color = { fg = colors.fg },
|
||||
},
|
||||
{ "location" },
|
||||
{ "progress", icon = "" },
|
||||
{ "location", icon = "" },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = { "filename" },
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_c = { { "filename", path = 1 } },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = { "location" },
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = { "nvim-tree", "lazy", "fzf", "trouble", "quickfix" },
|
||||
})
|
||||
|
||||
-- Ensure statusline has solid background
|
||||
vim.opt.laststatus = 3
|
||||
vim.api.nvim_set_hl(0, "StatusLine", { bg = colors.bg_dark })
|
||||
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = colors.bg_dark })
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user