Skip to content

Instantly share code, notes, and snippets.

@Arniiiii
Last active June 7, 2026 09:26
Show Gist options
  • Select an option

  • Save Arniiiii/1fe38b9f8499c29ae164a5f41b5a830b to your computer and use it in GitHub Desktop.

Select an option

Save Arniiiii/1fe38b9f8499c29ae164a5f41b5a830b to your computer and use it in GitHub Desktop.
Absolutely minimalistic, incredibly fast and fine looking neovim statusline, using only neovim API

It will give something like this, depending on file:

n packages/ecs-registry/src/enums.ts  [null-ls, ts_ls]     [E: 1 W: 0 I: 0 H: 0]  [typescript] 1% 1:1
n src/main.rs  [rust_analyzer]                                                          [rust] 0% 1:1
n init.lua  [lua_ls]                                           [E: 0 W: 2 I: 2 H: 1]  [lua] 78% 241:1
n main.cpp  [clangd]                                          [E: 4 W: 37 I: 0 H: 0]  [cpp] 42% 326:5

source:

function get_lsp_client()
   local msg = "No LSP"
   local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 })
   local clients = vim.lsp.get_clients { bufnr = 0 }
   if next(clients) == nil then return msg end
   local client_names = {}
   for _, client in pairs(clients) do
      table.insert(client_names, client.name)
   end
   return "[" .. table.concat(client_names, ", ") .. "]"
end

_G.lsp_msg = "" -- Initialize globally

vim.api.nvim_create_autocmd("LspProgress", {
   callback = function(ev)
      local value = ev.data.params.value
      if not value then return end

      if value.kind == "end" then
         _G.lsp_msg = ""
      else
         local map = {
            title = value.title,
            message = value.message,
            percentage = value.percentage,
         }
         local parts = {}
         if map.title then table.insert(parts, map.title) end
         if map.message then table.insert(parts, map.message) end
         if map.percentage then table.insert(parts, map.percentage .. "%") end

         _G.lsp_msg = table.concat(parts, " ")
      end
      vim.cmd "redrawstatus"
   end,
})
function _G.get_lsp_status() return _G.lsp_msg end

function get_lint_status()
   local diagnostics = vim.diagnostic.get(0)
   local counts = { E = 0, W = 0, I = 0, H = 0 }

   for _, d in ipairs(diagnostics) do
      if d.severity == vim.diagnostic.severity.ERROR then
         counts.E = counts.E + 1
      elseif d.severity == vim.diagnostic.severity.WARN then
         counts.W = counts.W + 1
      elseif d.severity == vim.diagnostic.severity.INFO then
         counts.I = counts.I + 1
      elseif d.severity == vim.diagnostic.severity.HINT then
         counts.H = counts.H + 1
      end
   end

   if (counts.E + counts.W + counts.I + counts.H) == 0 then return "" end

   return string.format(
      "[E: %d W: %d I: %d H: %d]",
      counts.E,
      counts.W,
      counts.I,
      counts.H
   )
end
vim.opt.statusline =
   "%{mode()} %f %m %{v:lua.get_lsp_client()} %{v:lua.get_lsp_status()} %= %{v:lua.get_lint_status()}  %y %p%% %l:%c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment