Skip to content

Commit

Permalink
fix(status): fix number column when signcolumn=number
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Oct 10, 2023
1 parent fbcb83d commit 36db241
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lua/astroui/status/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ end
-- @see astroui.status.utils.stylize
function M.numbercolumn(opts)
opts = extend_tbl({ thousands = false, culright = true, escape = false }, opts)
return function()
return function(self)
local lnum, rnum, virtnum = vim.v.lnum, vim.v.relnum, vim.v.virtnum
local num, relnum = vim.opt.number:get(), vim.opt.relativenumber:get()
local signs = vim.opt.signcolumn:get():find "nu"
and vim.fn.sign_getplaced(self.bufnr or vim.api.nvim_get_current_buf(), { group = "*", lnum = lnum })[1].signs
local str
if not num and not relnum then
str = ""
elseif virtnum ~= 0 then
if virtnum ~= 0 then
str = "%="
elseif signs and #signs > 0 then
local sign = vim.fn.sign_getdefined(signs[1].name)[1]
str = "%=%#" .. sign.texthl .. "#" .. sign.text .. "%*"
elseif not num and not relnum then
str = "%="
else
local cur = relnum and (rnum > 0 and rnum or (num and lnum or 0)) or lnum
Expand Down

0 comments on commit 36db241

Please sign in to comment.