Files
lua-nvim/lua/cargdev/plugins/lualine.lua
Carlos Gutierrez 0066ac1441 Fix keymap conflicts and add improvements
- Fix duplicate git conflict keymaps (centralized in gitconflict.lua)
- Fix duplicate Copilot keymaps (centralized in copilot.lua)
- Change insert mode escape from 'jk' to 'jj' to avoid typing conflicts
- Add word counter to statusline (lualine)
- Disable Copilot by default for .tex files
- Remove textwidth limits for visual wrapping based on window width
- Add comprehensive improvements documentation (IMPROVEMENTS.md)
- Update README with links to documentation
2026-01-10 16:31:17 -05:00

120 lines
3.4 KiB
Lua

return {
"nvim-lualine/lualine.nvim",
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 colors = {
blue = "#65D1FF",
green = "#3EFFDC",
violet = "#FF61EF",
yellow = "#FFDA7B",
red = "#FF4A4A",
fg = "#c3ccdc",
bg = "#112638",
inactive_bg = "#2c3043",
}
local my_lualine_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 },
},
insert = {
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
b = { bg = colors.bg, fg = colors.fg },
c = { bg = colors.bg, fg = colors.fg },
},
visual = {
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
b = { bg = colors.bg, fg = colors.fg },
c = { bg = colors.bg, fg = colors.fg },
},
command = {
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
b = { bg = colors.bg, fg = colors.fg },
c = { bg = colors.bg, fg = colors.fg },
},
replace = {
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
b = { bg = colors.bg, fg = colors.fg },
c = { bg = colors.bg, fg = colors.fg },
},
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 },
},
}
-- Custom word/character 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
return ""
end
local words = 0
local chars = 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
-- Count characters (excluding newline)
chars = chars + #line
end
end
-- Format: show words and characters
return string.format("%d words, %d chars", words, chars)
end
-- configure lualine with modified theme
lualine.setup({
options = {
theme = my_lualine_theme,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = {
{
lazy_status.updates,
cond = lazy_status.has_updates,
color = { fg = "#ff9e64" },
},
{ "encoding" },
{ "fileformat" },
{ "filetype" },
},
lualine_y = { "progress" },
lualine_z = {
{
word_count,
color = { fg = colors.fg },
},
{ "location" },
},
},
inactive_sections = {
lualine_a = { "filename" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { "location" },
},
})
end,
}