Skip to content

Commit 36db241

Browse files
committed
fix(status): fix number column when signcolumn=number
1 parent fbcb83d commit 36db241

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lua/astroui/status/provider.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ end
4141
-- @see astroui.status.utils.stylize
4242
function M.numbercolumn(opts)
4343
opts = extend_tbl({ thousands = false, culright = true, escape = false }, opts)
44-
return function()
44+
return function(self)
4545
local lnum, rnum, virtnum = vim.v.lnum, vim.v.relnum, vim.v.virtnum
4646
local num, relnum = vim.opt.number:get(), vim.opt.relativenumber:get()
47+
local signs = vim.opt.signcolumn:get():find "nu"
48+
and vim.fn.sign_getplaced(self.bufnr or vim.api.nvim_get_current_buf(), { group = "*", lnum = lnum })[1].signs
4749
local str
48-
if not num and not relnum then
49-
str = ""
50-
elseif virtnum ~= 0 then
50+
if virtnum ~= 0 then
51+
str = "%="
52+
elseif signs and #signs > 0 then
53+
local sign = vim.fn.sign_getdefined(signs[1].name)[1]
54+
str = "%=%#" .. sign.texthl .. "#" .. sign.text .. "%*"
55+
elseif not num and not relnum then
5156
str = "%="
5257
else
5358
local cur = relnum and (rnum > 0 and rnum or (num and lnum or 0)) or lnum

0 commit comments

Comments
 (0)