Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Flickering" and missing headlines #41

Open
refaelsh opened this issue Jul 28, 2022 · 15 comments
Open

"Flickering" and missing headlines #41

refaelsh opened this issue Jul 28, 2022 · 15 comments

Comments

@refaelsh
Copy link

Hard to describe in words, please see the attached screenshot, and then I will try to explain in words.
Saw the screenshot? Great.

WhatsApp Image 2022-07-27 at 8 13 21 PM

  1. There are some headings missing, between lines 76 and 298. They are definitely there, I remember entering them and I can see them when doing cat file.org.
  2. Line 298, the background of the heading looks "garbled" on the left side.
  3. After line 311 there are some strange thingies.
  4. And many more strange "flickering" that are hard to describe in words.

Here the org file to reproduce it: https://pastebin.pl/view/6d3fc321.

Neovim version 0.7.2.

A requested, I am reopening this issue from here: nvim-orgmode/orgmode#378.

@lukas-reineke
Copy link
Owner

For 2 and 3 please see what I wrote in the other ticket.

For 1, this is actually a bug in Neovim. I have reported it here neovim/neovim#19557
I suspect it also causes 4

@refaelsh
Copy link
Author

For 2 and 3 please see what I wrote in the other ticket.

I will do it asap today.

For 1, this is actually a bug in Neovim. I have reported it here neovim/neovim#19557 I suspect it also causes 4

Very interesting! It seems like something that should have been discovered as a bug in Neovim a long time ago, as soon as this feature was introduced in Neovim. Very interesting.

@refaelsh
Copy link
Author

  1. This happens because your font does not support the default character for headlines.nvim. You can either change/patch your font, or use a different character.

I prefer to change the font I am using.

  1. Can you please provide a font name that you know that definitely works?
  2. I should change the font in my terminal settings, right? Not in Neovim, correct?
    This is what I currently have in my Alacritty config:
font:
  normal:
    family: Consolas
    style: Regular

@lukas-reineke
Copy link
Owner

Yes, the font in the terminal.
I am using the nerd font patched version of Fira Code.
https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode

@refaelsh
Copy link
Author

Yes, the font in the terminal. I am using the nerd font patched version of Fira Code. https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode

Interestingly, their README says that my terminal of choice, Alacritty, is not supported. Here is the link: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode#terminal-compatibility-list.

Perhaps, maybe, you know of some other font that will work with headlines.nvim?

@lukas-reineke
Copy link
Owner

I think it's only the ligatures that won't work, alacritty just doesn't support those.

alacritty/alacritty#50

You should still be able to use the font

@refaelsh
Copy link
Author

refaelsh commented Jul 28, 2022

This happens because your org headline highlight groups have a background color. https://github.com/akinsho/org-bullets.nvim uses that color for the bullets, but the background color of virtual text overwrites the highlight of the headline from headlines.nvim.

I am sorry, I don't understand any of it. Can you please explain it again using different words?

P.S.

your org headline highlight groups have a background color

  1. They do? Well, I don't know what I have in my init.vim that does that. It is the first time I am hearing the term org headline highlight groups.
  2. Wait, this plugin supposes to add the background color to the headlines, is it not?

As can be seen from the above, I am thoroughly confused :-)

@refaelsh
Copy link
Author

refaelsh commented Jul 28, 2022

  1. This happens because your font does not support the default character for headlines.nvim. You can either change/patch your font, or use a different character.
  1. I configured Alacritty to use Fira Code and problem number 3 still occurs.
  2. I just tried it with kitty without changing any setting (its the first time I installed kitty), and problem number 3 no longer exists. Interesting, it seems to be the fault lies with Alacritty?

@lukas-reineke
Copy link
Owner

  1. They do?

orgmode.nvim takes the colors from your colorsheme. So if that has background colors, it will have too.

  1. Wait, this plugin supposes to add the background color to the headlines, is it not?

It is. This is a bit complicated. You have the first level of highlights from your colorscheme. Then this plugin adds highlights to change the background color of the headline. But then, org-bullets adds the bullets to the headlines, and they have background color too. org-bullets has the highest priority, so it overwrites the background color from this plugin.
To fix this, you have to remove the background highlight from those highlight groups.


I don't use Alacritty myself, it's possible it just can't display that character. You can still just use a different character, like the one I posted in the original issue.

@refaelsh
Copy link
Author

  1. This happens because your font does not support the default character for headlines.nvim. You can either change/patch your font, or use a different character.

I've decided to permanently move to kitty+Fira Code, and problem number 3 is gone. Thank you :-)

@refaelsh
Copy link
Author

for i = 1, 40, 1 do
    vim.cmd(string.format("highlight OrgHeadlineLevel%d guibg=NONE", i))
end

I did that, and problem number 2 still exists. Suggestions please :-)

@lukas-reineke
Copy link
Owner

Location matters, you need to do this after your colorscheme loads, but before org-bullets setup

@refaelsh
Copy link
Author

Location matters, you need to do this after your colorscheme loads, but before org-bullets setup

Problem number 2 still remains, but much less in quantity. I will blame the Neovim bug you mentioned :-)

@nyngwang
Copy link

nyngwang commented Feb 27, 2023

I also see some squares under the headings in my notes:

@agoodshort
Copy link

@nyngwang the squares are related to the font used in your terminal. Seems that FiraCode would work.

I personally use Nerd Font Hack and configured like this to get rid of the squares (using lazy.nvim):

return {
	"lukas-reineke/headlines.nvim",
	dependencies = "nvim-treesitter/nvim-treesitter",
	opts = {
		markdown = {
			fat_headline_lower_string = "",
		},
	},
}

@lukas-reineke Thanks for the plugin! May I suggest to mention the font "requirement" somewhere in the README.md?

sukantamaikap added a commit to sukantamaikap/my.lazyvim that referenced this issue Jan 18, 2024
marcus-grant added a commit to marcus-grant/lazyvim that referenced this issue Jun 5, 2024
- Uses this fix:
  - lukas-reineke/headlines.nvim#41
- Added to `lua/plugins/headline.lua` new config overrider
- Full spec from lazyvim inclusion is here:
  - https://www.lazyvim.org/extras/lang/markdown#headlinesnvim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants