my current line number colors
I like to have a very visible line number coloring and I couldn't find a way to configure it in v0.8.2 of Neovim. I'm using tokionight-night as my color theme and would like to have more visible colors on the relative line numbers if possible i'd like to have the side above zero colored blue zero could be yellow/red and below zero pink. I'd like to change it to anything honestly I'm trying to move from vscode, where I changed my colors of line numbers to yellow and I enjoy the visibility very much.
I tried to make it work through this disscussion I've found https://stackoverflow.com/questions/237289/vim-configure-line-number-coloring , with no luck. I haven't found a way to do it in a .lua
configuration file and pasting :highlight LineNr ctermfg=grey
was no luck either.
You can use vim.api.nvim_set_hl() for this.
vim.api.nvim_set_hl(0, 'LineNrAbove', { fg='blue' })
vim.api.nvim_set_hl(0, 'LineNr', { fg='yellow' })
vim.api.nvim_set_hl(0, 'LineNrBelow', { fg='magenta' })
These need to be set after you set your colourscheme for them to not be immediately overwritten.
If you have cursorline
enabled, LineNr
should be replaced with CursorLineNr
.
Solution: This is a solution that worked for me (Using relative numbers):
-- Sets colors to line numbers Above, Current and Below in this order
function LineNumberColors()
vim.api.nvim_set_hl(0, 'LineNrAbove', { fg='#51B3EC', bold=true })
vim.api.nvim_set_hl(0, 'LineNr', { fg='white', bold=true })
vim.api.nvim_set_hl(0, 'LineNrBelow', { fg='#FB508F', bold=true })
end
Calling this function in colors.lua
right after a function for my neovim theme.
Like so:
SetTheme()
LineNumberColors()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.