From 1a295c5ef8cab02c6054067c35ca805a3e4ccf72 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:42:34 +0300 Subject: [PATCH] fix(statuscolumn): `%r` deprecated in nightly and `%l` handles everything (#3719) ## What is this PR for? Fix correctly showing relative numbers in `statuscolumn` after recent breaking changes on [nightly](https://github.com/neovim/neovim/pull/29357). Please feel free to disregard this PR if a better solution is possible. ## Does this PR fix an existing issue? Fixes #3721 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/util/ui.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 1ad2b6f0..f14096db 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -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