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

Not dimming anything #19

Closed
nicolimo86 opened this issue Dec 4, 2021 · 16 comments
Closed

Not dimming anything #19

nicolimo86 opened this issue Dec 4, 2021 · 16 comments

Comments

@nicolimo86
Copy link

nicolimo86 commented Dec 4, 2021

Hi,
it seems that twilight is not dimming the text that I'm not editing. I have the impression that the plugin is not doing anything (see screenshot).

INFO:
neovim: v0.5.1
plugins:

Plug 'folke/zen-mode.nvim'
Plug 'folke/twilight.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

The command :PlugInstall has been runned succesfully and neovim was restarted.
Zen-mode and twilight are configure as follow:
image

I'm trying to edit a bash script while being in zen-mode:

image

what am I doing wrong?

@adlrwbr
Copy link

adlrwbr commented Dec 14, 2021

I am experiencing this same issue

@folke
Copy link
Owner

folke commented Dec 14, 2021

Can you see if using another colorscheme fixes it?

@nicolimo86
Copy link
Author

nicolimo86 commented Dec 14, 2021

I've just became aware that not all colorschemes have the tree-sitter support, including mine. I haven't tried yet to install a diffirent colorscheme with such TS support...but I suspect that the issue should be related to that. Feel free to close the issue.

@brotherkaif
Copy link

I have been experiencing the same issue. I don't use a colourscheme, I just use the default theme that ships with neovim.

If there is a requirement to use a specific colourscheme that is compatible with twilight, then it might be worth indicating this in the documentation and giving some examples of known colourschemes that work well with the plugin.

Also, is it not possible for this to work with the default scheme at all?

@folke
Copy link
Owner

folke commented Dec 21, 2021

It should work with any color scheme, but something might go wrong with some colorschemes.

Can you give me the output for:

:hi Twilight
:hi Normal

@nicolimo86
Copy link
Author

nicolimo86 commented Dec 21, 2021

The result for the 2 commands is the following:

:hi Twilight --> E411: highlight group not found: Twilight
:hi Normal --> Normal         xxx ctermfg=223 ctermbg=235 guifg=#ebdbb2 guibg=#282828

@folke
Copy link
Owner

folke commented Dec 22, 2021

Did you run twilight setup? The colorgroup should be defined

@folke
Copy link
Owner

folke commented Dec 22, 2021

I think I know why it's not working for you. You probably change your colorscheme after twilight setup. That would clear any hl groups set by Twilight.

@lilibyte
Copy link

also had this issue, and can confirm that it works after moving twilight setup towards the top of my config. before :hi Twilight didn't find the group until after :Twilight was run, but at that point the highlight group was empty.

@brotherkaif
Copy link

@folke Thanks for the troubleshooting steps. Unfortunately the issue is still present.

Output of :hi Twilight:

:hi Twilight
Twilight       xxx guifg=#404040 guibg=#000000

Output of :hi Normal:

:hi Normal
Normal         xxx cleared

Some additional context:

  • Nvim version is 6.0
  • Terminals tested are Terminal.app on macOS Big Sur 11.6.1 & Terminal on Chrome OS (Debian container)
  • Nvim config handled via init.lua and is completely Lua based
  • Config structure for neovim can be found here
  • Your other plugin, Zenmode, has also been installed
  • Twilight plugin setup occurs before any other options are set
  • No colourscheme is set in this config, the default neovim theme is used

Hopefully that helps with tracking this bug down! Please let me know if there's any other information I can provide and I'll be more than happy to assist.

@pflakus
Copy link

pflakus commented Jan 2, 2022

I've encountered the same issue as @brotherkaif (same neovim version, same issue, just on Manjaro/KDE). But I found the cause of the issue on my end:
Turns out that I didn't have termguicolors enabled in my config. (I've recently switched to a neovim-config repo to build my own configs around...) After I enabled the vim-option and reopened neovim, Twilight worked as intended again.

I hope this works for Kaif, too. Maybe this deserves a mention in the requirements-section of the README, @folke?

@lilibyte
Copy link

lilibyte commented Jan 2, 2022

Turns out that I didn't have termguicolors enabled in my config.
I hope this works for Kaif, too. Maybe this deserves a mention in the requirements-section of the README, @folke?

in my opinion that's not a good move because it's not really a requirement. termguicolors is only used if it's enabled, like you said, but also only if cterm isn't set. for example, i use hi Twilight ctermfg=8 and it works as expected. a better change would be adding a ctermfg option to the highlight definition so termguicolors doesn't need to be enabled for console users.

@pflakus
Copy link

pflakus commented Jan 2, 2022

Fair enough, I'm not really partial to either option, so I'll defer to the maintainer. :)

@yistarostin
Copy link

Hi, I had the same issue and basically the same situation as @brotherkaif, and setting hi Twilight ctermfg=8 fix the problem for me! (termguicolors are not set). Tnx @lilibyte for mentioning it and everyone else for investigating the problem.

@brotherkaif
Copy link

Hi everyone, I have tested out the fix mentioned by @lilibyte and @yistarostin and can confirm that this has resolved the issue.

Is this something that should be considered a bug (i.e. should the plugin attempt to set hi Twilight ctermfg=8 itself? Or should this be an update to the documentation and considered as user configuration?

Either way, setting hi Twilight ctermfg=8 has fixed the problem. Thanks everyone for the help :-)

@nicolimo86
Copy link
Author

Turns out that I didn't have termguicolors enabled in my config.
I hope this works for Kaif, too. Maybe this deserves a mention in the requirements-section of the README, @folke?

in my opinion that's not a good move because it's not really a requirement. termguicolors is only used if it's enabled, like you said, but also only if cterm isn't set. for example, i use hi Twilight ctermfg=8 and it works as expected. a better change would be adding a ctermfg option to the highlight definition so termguicolors doesn't need to be enabled for console users.

I confirm this fixed the issue for me. Thanks for the hint!

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

7 participants