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

Lag on GVim #6

Open
adelarsq opened this issue Aug 22, 2016 · 23 comments · Fixed by #10
Open

Lag on GVim #6

adelarsq opened this issue Aug 22, 2016 · 23 comments · Fixed by #10

Comments

@adelarsq
Copy link

Commits between Aug 19, 2016 and Aug 22, 2016 makes Vim lag.

Using:
GVim 7.4.2216
Windows 10

Configs:

set regexpengine=1
@tiagofumo
Copy link
Owner

tiagofumo commented Aug 22, 2016

The newest fix should make it faster. Let me know if it worked

@adelarsq
Copy link
Author

Nice. It worked 👍

@adelarsq
Copy link
Author

After the last update there is some delay, so I'm reopening the same issue.

@adelarsq adelarsq reopened this Aug 25, 2016
@tiagofumo
Copy link
Owner

tiagofumo commented Aug 25, 2016

The approach I took to solve this problem is sort of a hack, and will always result in some lag. I don't feel it so much in my setup here, but nerdtree does scroll a little bit faster when I disable the plugin. I found neovim to be faster than vim in general, you should take a look at it. If you are using windows you can try the new bash on windows 10. Also neovim has an experimental mode for windows using qt instead of a terminal, if you are on windows and can't get the new bash. Another thing you can do is to disable part of the plugin. For example, if you only want to use highlight based on file extensions, you can use these commands:

let g:NERDTreeDisableExactMatchHighlight = 1
let g:NERDTreeDisablePatternMatchHighlight = 1

I will try to find ways to minimize lag in the future, but for now I have no idea how to do so. I have tried many kinds of regular expressions and the ones that I ended up using look to be the fastest.

@adelarsq
Copy link
Author

adelarsq commented Aug 25, 2016

How did you know that I'm using Windows? 😄 Actually I have no choice but use Windows 😨 I use Vim on Windows, Linux and OS X. 😄 I trying to migrate to Neovim (with Nyavim) but there is so many stuff to do (my vimrc have 6k lines for example).

I did use the config but still lags. For now I will disable the plugin on Windows.

Thanks. I will close the issue 👍

@tiagofumo
Copy link
Owner

tiagofumo commented Aug 25, 2016

I pushed an update that limits the amount of extensions processed and significantly improves performance. To use it, add this line:

let g:NERDTreeLimitedSyntax = 1 " limit syntax for the most popular extensions

Take a look at some of your projects and see if there are some extensions you would like to be highlighted. I added the most common ones by default, but I want a feedback on my definition of "most common", to find out if there are some other stuff that people are using and I didn't add. Some will be too specific and you can still add them with this on your .vimrc:

let g:NERDTreeSyntaxEnabledExtensions = ['pl', 'sql', 'hs'] " enables syntax for.pl, .sql and .hs files

@adelarsq
Copy link
Author

I did create a custom list for each current project. At the time I'm using these extensions:

let g:NERDTreeExtensionHighlightColor = {}
let g:NERDTreeExtensionHighlightColor['bat'        ] =  'ff8b52' 
let g:NERDTreeExtensionHighlightColor['class'      ] =  '80cbc4' 
let g:NERDTreeExtensionHighlightColor['conf'       ] =  '8cffba' 
let g:NERDTreeExtensionHighlightColor['css'        ] =  'ffcde6' 
let g:NERDTreeExtensionHighlightColor['deb'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['odt'        ] =  '7FFF00' 
let g:NERDTreeExtensionHighlightColor['doc'        ] =  '7FFF00' 
let g:NERDTreeExtensionHighlightColor['docx'       ] =  '7FFF00' 
let g:NERDTreeExtensionHighlightColor['dtd'        ] =  'ff2c4b' 
let g:NERDTreeExtensionHighlightColor['ear'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['fxml'       ] =  'ff2c4b' 
let g:NERDTreeExtensionHighlightColor['frxml'      ] =  'ff2c4b' 
let g:NERDTreeExtensionHighlightColor['gif'        ] =  'F5C06F' 
let g:NERDTreeExtensionHighlightColor['gradle'     ] =  '00c489'
let g:NERDTreeExtensionHighlightColor['groovy'     ] =  '4298b8' 
let g:NERDTreeExtensionHighlightColor['gz'         ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['html'       ] =  '85FF66' 
let g:NERDTreeExtensionHighlightColor['iml'        ] =  'AD8FCC' 
let g:NERDTreeExtensionHighlightColor['jar'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['java'       ] =  '80cbc4' 
let g:NERDTreeExtensionHighlightColor['jnlp'       ] =  'ad8fcc' 
let g:NERDTreeExtensionHighlightColor['jpeg'       ] =  'F5C06F' 
let g:NERDTreeExtensionHighlightColor['jpg'        ] =  'F5C06F' 
let g:NERDTreeExtensionHighlightColor['js'         ] =  'ffa500' 
let g:NERDTreeExtensionHighlightColor['lock'       ] =  'FFFF00' 
let g:NERDTreeExtensionHighlightColor['markdown'   ] =  'B973FF' 
let g:NERDTreeExtensionHighlightColor['md'         ] =  'B973FF' 
let g:NERDTreeExtensionHighlightColor['mkd'        ] =  'B973FF' 
let g:NERDTreeExtensionHighlightColor['php'        ] =  'ff00ff' 
let g:NERDTreeExtensionHighlightColor['png'        ] =  'F5C06F' 
let g:NERDTreeExtensionHighlightColor['properties' ] =  '8cffba' 
let g:NERDTreeExtensionHighlightColor['py'         ] =  '70d080' 
let g:NERDTreeExtensionHighlightColor['rar'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['rpm'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['rs'         ] =  'FF7033' 
let g:NERDTreeExtensionHighlightColor['rst'        ] =  'B973FF' 
let g:NERDTreeExtensionHighlightColor['sql'        ] =  '66A3FF' 
let g:NERDTreeExtensionHighlightColor['tags'       ] =  'ff6070' 
let g:NERDTreeExtensionHighlightColor['ttf'        ] =  'd0eeff' 
let g:NERDTreeExtensionHighlightColor['txt'        ] =  'ffffff' 
let g:NERDTreeExtensionHighlightColor['vim'        ] =  'afd700' 
let g:NERDTreeExtensionHighlightColor['war'        ] =  'FFB340' 
let g:NERDTreeExtensionHighlightColor['xml'        ] =  'ff2c4b' 
let g:NERDTreeExtensionHighlightColor['xls'        ] =  'ffff7d' 
let g:NERDTreeExtensionHighlightColor['xlsx'       ] =  'ffff7d' 
let g:NERDTreeExtensionHighlightColor['xsd'        ] =  'ff2c4b' 
let g:NERDTreeExtensionHighlightColor['yaml'       ] =  'c8c8c8' 
let g:NERDTreeExtensionHighlightColor['yml'        ] =  'c8c8c8' 
let g:NERDTreeExtensionHighlightColor['zip'        ] =  'FFB340' 

I only still didn't figure out how to configure for g:WebDevIconsUnicodeDecorateFileNodesExactSymbols and g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols icons.

@tiagofumo
Copy link
Owner

I see, thanks for the list. Did you notice any performance improvement with the options I mentioned?

@adelarsq
Copy link
Author

@tiagofumo No. Same behavior as before.

@tiagofumo tiagofumo reopened this Sep 1, 2016
@HerringtonDarkholme
Copy link
Contributor

HerringtonDarkholme commented Oct 22, 2016

Hi, I have some suggestions on performance improvement.

First, because an icon is a stable and unique unicode character, we can change syn match to syn keyword. This makes Vim to match icon in a faster plain text search mode.

Second, if a user does not turns on full name highligh, we can skip matching label_identifier. This gains a lot of performance boost.

Third, we can group all icons with same color into one syn keyword command to minimize new syntax rules. As done here. But I have not tested this. So I have no idea about performance impact.

Wish this is helpful.

@tiagofumo
Copy link
Owner

tiagofumo commented Oct 23, 2016

@HerringtonDarkholme Sounds good. I will try to check those in the future. You can make a pull request if you want.

@tiagofumo
Copy link
Owner

@HerringtonDarkholme I had to revert the pull request because the keyword match doesn't allow two different colors for the same icon. For example, if you look at the screenshot on the README you can see that html icon is orange while the erb icon is red, even thought they have the same unicode value.

@HerringtonDarkholme
Copy link
Contributor

Well, if you insist on correctness I'm afraid there is no easy way to optimization.

@wclr
Copy link

wclr commented Jan 22, 2017

Yes, it is really slow on my Windows 10 ubuntu bash shell wsltty terminal.
preservim/nerdtree#654

g:NERDTreeLimitedSyntax doesn't help, have to disable the plugin (

@tiagofumo
Copy link
Owner

tiagofumo commented Jan 23, 2017

@whitecolor Sorry, I don't have a Windows 10 ubuntu bash shell to test that right now. Will try to take a look in the future.

Thank you.

@tiagofumo
Copy link
Owner

tiagofumo commented Jan 23, 2017

@whitecolor try to disable all default extensions, exact match, and pattern match highlights and see if the lag disappears. If it does (it should) add your most used extensions using the g:NERDTreeSyntaxEnabledExtensions like this:

let g:NERDTreeSyntaxDisableDefaultExtensions = 1
let g:NERDTreeDisableExactMatchHighlight = 1
let g:NERDTreeDisablePatternMatchHighlight = 1
let g:NERDTreeSyntaxEnabledExtensions = ['c', 'h', 'c++', 'php', 'rb', 'js', 'css'] " example

Try adding just a few and see if the lag is bearable.

@asilvadesigns
Copy link

asilvadesigns commented Mar 14, 2017

@tiagofumo thank you for your work on this, awesome. My setup is tmux + neovim on alacritty. Screenshot here. I was experiencing the scroll lag, but totally gone with the above settings.
screen shot 2017-03-14 at 10 44 23 am

@wclr
Copy link

wclr commented Mar 14, 2017

@asilvadesigns can you make gist with your nvim/init.vim?

@asilvadesigns
Copy link

@wclr
Copy link

wclr commented Mar 15, 2017

@asilvadesigns thanks)

@tam5
Copy link

tam5 commented Jan 4, 2018

Just wanted to share this related find:

I was experiencing lots of lag with this plugin turned on, to the point that I almost abandoned it, even after trying the above.

Then I removed CursorLine highlighting from NERDTree (which is on by default), and it seems to have solved all my problems, scrolling is now super fast.

Added this to .vimrc:

let NERDTreeHighlightCursorline = 0

@tiagofumo
Copy link
Owner

Oh, Interesting. Thanks for the info, I will add this to the README.

@julientechdev
Copy link

I bisected vim versions until isolating the one which make it so slow.

It appears to be 8.0.1275, very slow for me while 8.0.1274 was ok.

The commit is really small: vim/vim@c9e9c71

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

Successfully merging a pull request may close this issue.

7 participants