rohit-px2 / nvui

A modern frontend for Neovim.
MIT License
1.72k stars 49 forks source link

lag on 4k display #149

Open adriancostin6 opened 2 years ago

adriancostin6 commented 2 years ago

Hello devs,

I have just tried this amazing frontend for neovim and I must say, I am impressed with the quality.

That being said, the only downside is that it is extremely laggy on a 4k display. I cand easily reproduce this by shrinking down the nvui window and it works as expected and is fast, so I know for syre the resolution is the problem.

I have encountered this problem when trying neovide as well (see: https://github.com/neovide/neovide/issues/1299) and initially thought it was a problem related to their implementation, but now I am not so sure, because it might be something deeper than the UI. The only frontend that has fast performance for me on a 4k display up until now is nvim-qt.

Could we maybe somehow coordinate between these three (your project, neovide and nvim-qt) to try and find a solution to this?

dseeni commented 2 years ago

I'm not super experienced with this repo as of yet nor do I have a 4k display, but could you try disabling all animations as well as multigrid in the INI file? It might be useful to know for whomever is trying to fix this issue

[General]
multigrid=false
popupmenu=false
cmdline=false

[window]
geometry=@Rect(1288 31 1264 1401) #whatever position is fine
frameless=false
fullscreen=false
maximized=false

Test with you settings in init.vim set to:

NvuiAnimationsEnabled 0

Is there still lag?

adriancostin6 commented 1 year ago

@dseeni I got around to doing what you suggested right now, and I must say it is a big improvement over the previous state (lag is gone 90%). still get it while scrolling through files, but not at first. if I keep 'j' pressed to scroll down, it starts just fine (nice and smooth while on the first page), then gradually becomes slower when it scrolls into the next page of text.

dseeni commented 1 year ago

Nice, glad that helped. Try this: Stick this on the top of your init.vim|lua

function! NvuiGetTitle()
  return "nvui"
endfunction
NvuiTitlebarFontSize 10
NvuiTitlebarSeparator ''
NvuiVsync 0
NvuiOpacity 1
NvuiSnapshotLimit 0
NvuiAnimationsEnabled 0
NvuiIMEDisable
NvuiSecondsBeforeIdle 0
NvuiScrollAnimationDuration 0.0
NvuiMoveAnimationDuration 0.0
NvuiCursorAnimationDuration 0.0
NvuiCursorFrametime -1
NvuiCursorEffectFrametime -1
NvuiCursorEffect ''
NvuiCursorEffectDuration -1.0
NvuiCursorHideWhileTyping 1
NvuiScrollFrametime 0
NvuiScrollScaler identity
NvuiMoveScaler identity
NvuiCaretExtendTop 0
NvuiCursorScaler identity
NvuiCursorEffectScaler identity
NvuiCharspace 0.0
NvuiCaretExtendBottom 0
NvuiMoveAnimationFrametime 0

For the nvui config add:

 [General]
 multigrid=false
 popupmenu=false
 cmdline=false

 [window]
 frameless=true
 geometry=@Rect(1280 0 1280 1440)
 fullscreen=false
 maximized=false

Using frameless set through the .ini file and turning off vsync seems to help for me. The rest of the stuff is just me trying to reduce latency as much as possible.

I seem to get the most performance when I set those things.. (older OS though). For me this is the best front end for Nvim, I get the lowest latency when I shut all the animations even on Windows 8 Things are much better on Linux I think. I'm not sure why but for windows Nvim-Qt is a bit slower / startups up way slower IME.

In terms of nvim performance enable lazy redraw turn off treesitter set synmax column to -1 your window width set completions='' "NONE or i (lsp should do most of this) set the regexengine=1