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

Cursor line changes the highlight of folded text. #161

Closed
anthony-S93 opened this issue Mar 1, 2023 · 3 comments
Closed

Cursor line changes the highlight of folded text. #161

anthony-S93 opened this issue Mar 1, 2023 · 3 comments
Assignees

Comments

@anthony-S93
Copy link
Contributor

Issue/Question/Enhancement

I'm not really sure if this is an issue, but for some reason the cursor line doesn't seem to respect the "Folded" highlight group.

cursorline

@olimorris
Copy link
Owner

This is the desired behaviour unfortunately. If I recall, the reason for this is that when you fold a line, Vim does the calculations to determine what code should be hidden and what the folded line should display. So it doesn't see the fold as lua code and as such doesn't know how to apply the syntax highlighting.

You do have the Folded highlight group available to you to change the gray foreground.

Or...I highly recommend nvim-ufo. As you can see from my fold highlighting below:

Screen Shot 2023-03-01 at 09 33 15@2x

@olimorris
Copy link
Owner

Sorry, I completely misread your question and that it relates to CursorLine. What Neovim version are you using? I see that neovim/neovim#22242 applies cursorline colors to folds.

Also, I'd say nvim-ufo could still be the way to go.

@olimorris olimorris reopened this Mar 1, 2023
@anthony-S93
Copy link
Contributor Author

anthony-S93 commented Mar 1, 2023

What Neovim version are you using?

I'm using v0.8.3.

You do have the Folded highlight group available to you to change the gray foreground.

Indeed, I'm aware of this. The orange color you saw in the gif I shared was the color I set with vim.api.nvim_set_hl(0, "Folded", {fg = "#FF7518"}). When I moved the cursor away, it showed the color did change to orange, but not when the cursor line was active. Somehow, the highlight group only works when the cursorline isn't there.

Also, I'd say nvim-ufo could still be the way to go.

I saw your screenshots. Looks very promising. I'm going to go ahead and give nvim-ufo a try. Thanks for the recommendation.

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

2 participants