all repos

init.lua @ 121f9a7

my nvim config
4 files changed, 57 insertions(+), 44 deletions(-)
refactor: switch to ruler instead of lualine
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2025-09-15 23:30:00 +0300
Parent: 24780b5
M init.lua

@@ -2,9 +2,9 @@ require "core.options"

require "core.lazy" require "core.keymaps" require "core.autocmd" +require "core.ruler" require "core.lsp" --- enable new experimental ui -pcall(function() +if vim.fn.has "nvim-0.12" == 1 then require("vim._extui").enable { enable = true } -end) +end
M lazy-lock.json

@@ -6,7 +6,6 @@ "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },

"gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, "mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" }, "neogit": { "branch": "master", "commit": "43fa47fb61773b0d90a78ebc2521ea8faaeebd86" }, "neotest": { "branch": "master", "commit": "35a59c1f59dbb954d92b74ab64a966a668cea495" },
A lua/core/ruler.lua

@@ -0,0 +1,54 @@

+vim.o.laststatus = 0 +vim.o.ruler = true + +---@param itms table<string> +local function join(itms) + return vim + .iter(itms) + :filter(function(e) + return e ~= "" + end) + :join " " +end + +local function diagnostics() + local counts = vim.diagnostic.count(vim.api.nvim_get_current_buf()) + local errors = counts[vim.diagnostic.severity.ERROR] or 0 + local warns = counts[vim.diagnostic.severity.WARN] or 0 + local info = counts[vim.diagnostic.severity.INFO] or 0 + local hint = counts[vim.diagnostic.severity.HINT] or 0 + + return join { + (errors > 0 and "%#DiagnosticError#" .. "󰅚 " .. errors .. "%*" or ""), + (warns > 0 and "%#DiagnosticWarn#" .. "󰀪 " .. warns .. "%*" or ""), + (info > 0 and "%#DiagnosticInfo#" .. "󰋽 " .. info .. "%*" or ""), + (hint > 0 and "%#DiagnosticHint#" .. "󰌶 " .. hint .. "%*" or ""), + } +end + +local function git_diff() + local diff = vim.b.gitsigns_status_dict + if diff == nil then + return "" + end + + -- stylua: ignore + return join { + (diff.added ~= nil and diff.added > 0) and ("%#GitSignsAdd#+" .. diff.added .. "%*") or "", + (diff.changed ~= nil and diff.changed > 0) and ("%#GitSignsChange#~" .. diff.changed .. "%*") or "", + (diff.removed ~= nil and diff.removed > 0) and ("%#GitSignsDelete#+" .. diff.removed .. "%*") or "", + } +end + +local function location() + return "%#TabLineSel# %l:%c %*" +end + +local function modified() + return "%m" +end + +vim.opt.rulerformat = "%27(%=%{%v:lua.require'core.ruler'()%}%)" +return function() + return join { git_diff(), diagnostics(), modified(), location() } +end
D

@@ -1,40 +0,0 @@

-local u = require "core.utils" -local c = { - mode = { - function() - return " " - end, - padding = 0, - }, - diagnostic = { "diagnostics", sources = { "nvim_diagnostic" } }, - location = { "location", padding = 1, colored = false }, - lsp = { - function() - local clients = table.concat(u.lsp.get_clients(), ", ") - return (#clients == 0 and "") or ("[" .. clients .. "]") - end, - }, -} - ----@type LazySpec -return { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = { - options = { - theme = "auto", - globalstatus = true, - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - disabled_filetypes = { "NeogitStatus", "lazy" }, - }, - sections = { - lualine_a = { c.mode }, - lualine_b = {}, - lualine_c = { "filename", "branch", c.diagnostic }, - lualine_x = { c.lsp, "diff" }, - lualine_y = {}, - lualine_z = { c.location }, - }, - }, -}