ecosse3 / nvim

A non-minimal Neovim config built to work most efficiently with Frontend Development
GNU General Public License v3.0
1.21k stars 109 forks source link

Blinking/Flickering cursor #86

Closed MatthewCushing closed 2 years ago

MatthewCushing commented 2 years ago

Great config! I have a current issue with the cursor being forced to blink. Whenever I move the cursor it also flickers. I've tried looking through the config, but I'm unsure where this is coming from. I don't have this issue in any of my personal configs or lunarvim. I thought it might be tabnine, so I tried disabling it but no success.

I'm on MacOS and I've tested this on Kitty, Alacritty, and iTerm2. It happens in all terminals. Would appreciate it if you could point me in the right direction.

Thanks!

EDIT: The blinking and flickering of the cursor does not occur when in nvim-tree. I have also turned off cursor blinking in Kitty, but my cursor still blinks when entering Neovim (not sure if this is neovim or the config)

EDIT2: The regular blinking of the cursor seems to be a Neovim thing. I had never noticed the blinking until the flickering started, so it's definitely attracting my eyes to it constantly haha.

hitfm00 commented 2 years ago

Same problem

MatthewCushing commented 2 years ago

Same problem

Ya I'm assuming it has to do with re-rendering and completion. I've only had the config for around 30min so I'm going to start sifting through it in regards to parts that have to do with completion and commenting them out. Hopefully I find the root cause unless the maintainer knows. I'll report back if I find any success.

MatthewCushing commented 2 years ago

Found the problem. It's with the cmp-calc plugin. If you go to their github page, the latest commits are trying to reduce flicker as well. So to remove the flicker, just comment out or remove entirely that plugin

MatthewCushing commented 2 years ago

Alright scratch that, it's a combination of tabnine and calc. It seems to do with putting one of these after = 'cmp-cmdline'. It seems to be doing too many things one after the other instead of async, causing it to flicker.

MatthewCushing commented 2 years ago

Not sure what's going on. Seems to keep occurring now. So, my previous solutions aren't working. At least not consistently. Bit of a bummer. Unfortunately, it's one of those things I can't deal with so I'm just going to go back to my personal config for now. Hopefully the maintainer knows the root cause and can pipe in here.

ecosse3 commented 2 years ago

I am experiencing the same problem. It only happens to me when I open a new file for a few seconds, then it stops. Thank you for investigating @MatthewCushing. I'll check and try to solve this issue asap.

ecosse3 commented 2 years ago

@MatthewCushing Could you check if disabling all lsp clients in buffer fixes that? To me, it stops occurring when I disable lsp via :LspStop. Then when I enable it with :LspStart cursor starts immediately flickering. I've checked with different lsp servers and it occurs in each of them (just sumneko_lua, tsserver etc.).

hitfm00 commented 2 years ago

@MatthewCushing Could you check if disabling all lsp clients in buffer fixes that? To me, it stops occurring when I disable lsp via :LspStop. Then when I enable it with :LspStart cursor starts immediately flickering. I've checked with different lsp servers and it occurs in each of them (just sumneko_lua, tsserver etc.).

I did this but it didn't work

MatthewCushing commented 2 years ago

@MatthewCushing Could you check if disabling all lsp clients in buffer fixes that? To me, it stops occurring when I disable lsp via :LspStop. Then when I enable it with :LspStart cursor starts immediately flickering. I've checked with different lsp servers and it occurs in each of them (just sumneko_lua, tsserver etc.).

Like @hitfm00 above, I went ahead and tried running it and nothing changed. Still getting the flickering.

MatthewCushing commented 2 years ago

@ecosse3 I've tried commenting out all completion plugins, nothing changed. I'm thinking this is occurring because of a single plugin. At least that's my guess. I tried commenting out the cinnamon plugin as smooth scrolling is known to cause visual issues but that doesn't solve it either. I think at this point it comes down to going one by one down the list until it stops haha. I find it odd that you aren't running into the same issues. Maybe different OS? I'm running on an M1 Max Macbook Pro.

pertrai1 commented 2 years ago

@MatthewCushing - can you try to disable galaxyline and see if this problems goes away? I was able to drill it down to only having to disable that one plugin and the flickering stopped.

MatthewCushing commented 2 years ago

@MatthewCushing - can you try to disable galaxyline and see if this problems goes away? I was able to drill it down to only having to disable that one plugin and the flickering stopped.

Ya I just got home so give me 5min and I'll jump on and give it a shot

MatthewCushing commented 2 years ago

@ecosse3

@MatthewCushing - can you try to disable galaxyline and see if this problems goes away? I was able to drill it down to only having to disable that one plugin and the flickering stopped.

Yup! That's it. Turning off that plugin removes the flickering. Have to jump into its config and see if there's something specific going on in there that's doing it because I really enjoyed that status line

MatthewCushing commented 2 years ago

Looking at this issue: https://github.com/glepnir/galaxyline.nvim/issues/210#issue-970741562 I see a lot of calls to the highlight function inside the galaxyline config file.

pertrai1 commented 2 years ago

If I comment out this check for path_enabled it stops flickering: https://github.com/ecosse3/nvim/blob/master/lua/plugins/galaxyline.lua#L449. Do you see the same by chance?

Edit: I drilled down a little more and only commented out this small if condition in path_enabled - https://github.com/ecosse3/nvim/blob/master/lua/plugins/galaxyline.lua#L461

MatthewCushing commented 2 years ago

If I comment out this check for path_enabled it stops flickering: https://github.com/ecosse3/nvim/blob/master/lua/plugins/galaxyline.lua#L449. Do you see the same by chance?

Edit: I drilled down a little more and only commented out this small if condition in path_enabled - https://github.com/ecosse3/nvim/blob/master/lua/plugins/galaxyline.lua#L461

Yep, it's that conditional. It seems to be having trouble when calculating the client's window width. Removing the path and just leaving it with the filename by commenting out the function and uncommenting the part that's commented out that just displays the filename itself removes the flickering issue while also being able to display the filename

if EcoVim.statusline.path_enabled then
  table.insert(gls.right, {
    FileName = {
          provider = 'FileName',
          separator_highlight = {'NONE', colors.typebg},
          highlight = {colors.typetext, colors.typebg}
      }
    --FileName = {
    --  provider = function()
    --    if #vim.fn.expand '%:p' == 0 then
    --      return ''
    --    end
    --    if EcoVim.statusline.path == 'relative' then
    --      return utils.get_relative_gitpath() .. ' '
    --    end
    --    if vim.fn.winwidth(0) > 150 then
    --      return vim.fn.expand '%:~' .. ' '
    --    else
    --      return vim.fn.expand '%:t' .. ' '
    --    end
    --  end,
    --  separator_highlight = { 'NONE', colors.typebg },
    --  highlight = { colors.typetext, colors.typebg }
    --}
  })
end
ecosse3 commented 2 years ago

Thank you @pertrai1 @MatthewCushing @hitfm00 for your investigation! I've checked as well and that was issued by calculation of winwidth. For now, I removed it and it's solved.