nvim-navic
nvim-navic copied to clipboard
Highlight not applied for last character
As shown in the above image, There is a last character to which the highlight isn't applied to. Moreover, it seems to apply some other color. This color doesn't show up when navic is removed. I have set bg for all highlights mentioned in the readme as black.
Can you share which statusline plugin are you using?
Also share the output of set statusline?
I'm using lualine along with navarasu/onedark.nvim theme.
Output of set statusline
:
statusline=%{%v:lua.require'lualine'.statusline()%}
Hey!
Are you still facing this issue? Try keeping only nvim-navic as a component in lualine and then see if it is occuring?
What is the output for lua require'lualine'.statusline()
?
This still happens for me. I tried deleting all components after nvim-navic (so it is the only component on the line) and it still appears.
I'm seeing this issue as well with lualine. It seems related to the padding. I have temporarily fixed this by applying a 0 padding on the right side after the navic output:
lualine_c = {
{ 'filetype' },
{ 'filename' },
{
navic.get_location,
cond = navic.is_available,
padding = { left = 1, right = 0 },
}
}
issue is apparent specially on slanted styles
Sorry for being so late, but I looked into this... And yep, its an issue with how lualine is handling the padding. For some reason it is applying incorrect colour for the space character in padding. Should be issue on lualine's repo.
I had the same issue, the string that nvim-navic get_location() returns for the statusline includes "%* <some_text> %*" at the end, that is used to reset the highlighting to the default one, which is named "StatusLine". That different color is the "guibg" field of this "StatusLine" global highlight. I don't know if there's a better fix, for now I simply set this bg field to the required color, in your case, since you're making the background black, it would be like this:
vim.cmd("highlight StatusLine guibg=#000000")
For those who'd like to make it blend with lualine's background:
-- Get current lualine theme
local curr_theme = require('lualine.themes.your_theme_name')
-- Get the background color for the section that you put nvim-navic into,
-- here I am getting it for the normal mode since for me it's the same
-- for all modes, you can adjust accordingly if yours differ
local sec_bg = curr_theme.normal.c.bg
-- Update StatusLine highlight's guibg field
vim.cmd(string.format("highlight StatusLine guibg=%s", sec_bg))