fix(statuscolumn): %r deprecated in nightly and %l handles everything

This commit is contained in:
Iordanis Petkakis 2024-06-18 13:23:27 +03:00
parent bdca1e95ff
commit 2d40cb5f40

View file

@ -140,10 +140,14 @@ function M.statuscolumn()
local is_num = vim.wo[win].number
local is_relnum = vim.wo[win].relativenumber
if (is_num or is_relnum) and vim.v.virtnum == 0 then
if vim.v.relnum == 0 then
components[2] = is_num and "%l" or "%r" -- the current line
if vim.fn.has("nvim-0.11") == 1 then
components[2] = "%l" -- 0.11 handles both the current and other lines with %l
else
components[2] = is_relnum and "%r" or "%l" -- other lines
if vim.v.relnum == 0 then
components[2] = is_num and "%l" or "%r" -- the current line
else
components[2] = is_relnum and "%r" or "%l" -- other lines
end
end
components[2] = "%=" .. components[2] .. " " -- right align
end