Closed lampewebdev closed 1 year ago
@lampewebdev Thanks for reporting this issue and for providing a video! 🎉
Not quite sure what's causing this, although I have a sense on what the issue could be. This plugin creates a couple autocmd
s to change the Visual
highlight group on FocusGained
and on FocusLost
:
vim.api.nvim_create_autocmd({ "FocusGained" }, {
pattern = "*",
command = "hi! link Visual VisualActive",
})
vim.api.nvim_create_autocmd({ "FocusLost" }, {
pattern = "*",
command = "hi! link Visual VisualInactive",
})
Based on what you're showing I think either something is going on with those events or something else is also changing those highlight groups.
To help debug this further can you please share the following details? I'd love to fix this for you.
Visual
highlight group by any chance?autocmd
s on FocusGained
or on FocusLost
?:verbose hi Visual
, :verbose hi VisualActive
, and :verbose hi VisualInactive
before unfocusing your terminal?:verbose hi Visual
, :verbose hi VisualActive
, and :verbose hi VisualInactive
after unfocusing your terminal?@lampewebdev also, do you get the same issue if you disable all other themes and just enable this one?
:verbose hi Visual
Visual xxx ctermfg=234 ctermbg=109 guifg=#1c1c1c guibg=#87afaf
links to VisualActive
Last set from Lua
:verbose hi VisualActive
VisualActive xxx cleared
:verbose hi VisualInactive
VisualInactive xxx cleared
- What do you get when running :verbose hi Visual, :verbose hi VisualActive, and :verbose hi VisualInactive after unfocusing your terminal?
It shows the same
- do you get the same issue if you disable all other themes and just enable this one?
yes
Just some things I tried:
I'm pretty sure that this is the problem here https://github.com/oxfist/night-owl.nvim/blob/a6d84aa32b3708bc32397aa86b26317441bbd1d5/after/plugin/autocmds.lua#L3
Not sure how neovim works here but this code should only run when the night owl theme is active and set this back to the default option once the theme is changed.
@lampewebdev thanks so much for your updates. I'll be able to dive into this this week and should have an update for you soon.
Just FYI, you can check the autocommands currently defined by running :autocmd FocusGained
and :autocmd FocusLost
. For me it shows this:
FocusGained
* hi! link Visual VisualActive
But I think you're on the right path, the autocommand shouldn't be set if the theme is not active. So I'll try to reproduce this and work on a fix.
I only see this
:autocmd FocusGained
--- Autocommands ---
FocusGained
* hi! link Visual VisualActive
Press ENTER or type command to continue
:autocmd FocusLost
--- Autocommands ---
FocusLost
* hi! link Visual VisualInactive
Press ENTER or type command to continue
It's also messing up Lunar Vim's toggle term config, the cursor is not visible.
@kmlopez-hhl I'm not very familiar with LunarVim, can you show me how that looks like? I'm trying to fix this and want to make sure the solution will include your setup or create a separate issue to track that separately. 🙏🏼
I'm experiencing that problem as well. Having the package loaded (Packer use
) seems to be enough for this problem to happen.
@oxfist I think the issue is that the autocmd
commands are in the after/
directory, which according to the Neovim docs are run when the plugin is loaded, not when the colorscheme is activated.
Perhaps you can use the ColorScheme
autocmd to detect when the night-owl
colorscheme gets (de)activated and use that to (un)register the FocusGained
/ FocusLost
autocmds?
@denisw @lampewebdev @kmlopez-hhl I was able to set the FocusGained
and FocusLost
highlight groups only when colorscheme is night-owl
. Tested this on a minimal lazy.nvim
config on my local environment and can confirm it works as expected ONLY when this theme is loaded.
Please let me know if you still have any issues! 🙏🏼
@all-contributors please add @denisw for bug. please add @lampewebdev for bug.
@oxfist
@denisw already contributed before to bug
I've put up a pull request to add @lampewebdev! :tada:
@all-contributors please add @denisw for bug
@oxfist
I've put up a pull request to add @denisw! :tada:
@oxfist thank you!
I just installed the latest, but it is still happening.
The cursor is not visible after f
@kmlopez-hhl thanks so much for the follow-up, I created a separate issue to track that. I haven't installed toggleterm
on my local environment yet but I'll reproduce the issue so I can fix it and support that plugin too.
@oxfist I hate to possibly open up an old issue. However, I think this issue is occurring again. I don't mind opening another issue, but figured for historical purposes I'd add it here initially. I'm able to replicate the issue by using the basic kickstart.nvim (a lovely starter point from T.J.!) and replacing the color scheme block with:
{
'oxfist/night-owl.nvim',
lazy = false,
priority = 1000,
config = function()
vim.cmd.colorscheme 'night-owl'
end,
},
And here is the answers the questions you've asked previously:
Which Neovim version are you running?
0.9.1
Do you have any plugins installed that might be setting the Visual highlight group by any chance? I don't understand enough about Visual highlight groups to know if any of the standard plugins within kickstart.nvim do this. I'm sorry.
Do you have any plugins installed that might also be creating autocmds on FocusGained or on FocusLost? Unfortunately, I have the same answer as the previous question. I don't know enough to confidently answer this question.
What do you get when running :verbose hi Visual
, :verbose hi VisualActive
, and :verbose hi VisualInactive
before unfocusing your terminal?
:verbose hi Visual
, :verbose hi VisualActive
, and :verbose hi VisualInactive
after unfocusing your terminal?
Hej,
I'm loading your theme with lazy.
When I have this theme loaded the first selection works in visual mode.
When I then un focus the window the selection is gone and selecting new text is not visible.
https://github.com/oxfist/night-owl.nvim/assets/44268468/92a0ed33-00bc-4558-ad52-59672d62849a