-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Feature Request: cache syntax highlighting to improve 'relativenumber' scroll performance #1735
Comments
Ok, I don't know the internals of cursorline or vim's syntax highlighting, but it seems to me that it should be possible to completely separate cursorline highlighting from syntax highlighting? Usually, the cursorline just changes the background colour for the current line. So...
I don't understand why the entire screen's syntax highlighting needs to be recalculated because the background colour of one line gets toggled. |
For instance, the screen's syntax highlighting does not seem to need to be recalculated every time a visual text selection changes. |
The enhancement needs to happen inside Vim & Neovim, so for now there is not much you can do except disable |
Having relative line numbers enabled and using regex engine 0 or 2 causes high latency in ruby files. There is an open issue to track this: vim/vim#1735. This sets the regex engine to 1, which allows for relative line numbers.
If you comb through the various postings about this issue across the internet these suggestions come up frequently as a fix:
However these I suspect are actually just fixing people's issues with 3rd party plugins. The real fix for this is:
I think this feature is simply broken when applied to ruby filetypes due to what @bluz71 and @brammool already mentioned. Hopefully this helps others as it took me some time to find the culprit. Cheers. |
@her, I agree with: set ttyfast
set regexpengine=1 However, enabling I also recommend this setting: set synmaxcol=200 Only syntax highlight the first 200 chars of a line. Very long lines are a killer with The Ruby syntax highlighter contains hundreds of regexps, multiple by the number of visible lines can equal very bad scroll performance with |
I have this issue and do not do pgp or ruby syntax highlighting. It also just started happening recently, so might have come from an update. |
I noticed that #282 has been closed due to patches 8.1.0372 - 8.1.0374 Commit bd9a53c (patch 8.1.0374) implements a I have updated and tested, and indeed when scrolling within a page, with Note, scrolling off the top or bottom of the page, via long-pressing Thanks to the Vim maintainers, very much appreciate the enhancement. Resolving. |
Oh that’s awesome @bluz71, thanks for the update! |
- whereas - `regexpengine=1` - is incompatible with fennel.vim - e.g. ``` Error detected while processing /Users/user/.vim/plugged/fennel.vim/syntax/fennel.vim: line 241: E945: Range too large in character class E475: Invalid argument: FennelSymbol "\v<%([\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])%([0 &\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])*>" line 242: E945: Range too large in character class E475: Invalid argument: FennelKeyword "\v<:%([0-9\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF] ``` - is mostly obsolete - e.g. - vim 8 rendering slowness should be bearable in all but the most extreme cases - switching to neovim could solve rendering slowness otherwise - see - vim/vim#1735 - vim-ruby/vim-ruby#243 - unset `regexpengine=1` - decrease `synmaxcol` - for good measure - per @bluz71 recommendations
- whereas - `regexpengine=1` - is incompatible with fennel.vim - e.g. ``` Error detected while processing /Users/user/.vim/plugged/fennel.vim/syntax/fennel.vim: line 241: E945: Range too large in character class E475: Invalid argument: FennelSymbol "\v<%([\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])%([0 &\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])*>" line 242: E945: Range too large in character class E475: Invalid argument: FennelKeyword "\v<:%([0-9\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF] ``` - is mostly obsolete - e.g. - vim 8 rendering slowness should be bearable in all but the most extreme cases - switching to neovim could solve rendering slowness otherwise - see - vim/vim#1735 - vim-ruby/vim-ruby#243 - unset `regexpengine=1` - decrease `synmaxcol` - for good measure - per @bluz71 recommendations
- whereas - `regexpengine=1` - is incompatible with fennel.vim - e.g. ``` Error detected while processing /Users/user/.vim/plugged/fennel.vim/syntax/fennel.vim: line 241: E945: Range too large in character class E475: Invalid argument: FennelSymbol "\v<%([\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])%([0 &\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])*>" line 242: E945: Range too large in character class E475: Invalid argument: FennelKeyword "\v<:%([0-9\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF] ``` - is mostly obsolete - e.g. - vim 8 rendering slowness should be bearable in all but the most extreme cases - switching to neovim could solve rendering slowness otherwise - see - vim/vim#1735 - vim-ruby/vim-ruby#243 - unset `regexpengine=1` - decrease `synmaxcol` - for good measure - per @bluz71 recommendations
- whereas - `regexpengine=1` - is incompatible with fennel.vim - e.g. ``` Error detected while processing /Users/user/.vim/plugged/fennel.vim/syntax/fennel.vim: line 241: E945: Range too large in character class E475: Invalid argument: FennelSymbol "\v<%([\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])%([0 &\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF])*>" line 242: E945: Range too large in character class E475: Invalid argument: FennelKeyword "\v<:%([0-9\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF] ``` - is mostly obsolete - e.g. - vim 8 rendering slowness should be bearable in all but the most extreme cases - switching to neovim could solve rendering slowness otherwise - see - vim/vim#1735 - vim-ruby/vim-ruby#243 - unset `regexpengine=1` - decrease `synmaxcol` - for good measure - per @bluz71 recommendations
Hello Vim team,
Spawning a new feature request from the existing Ruby high CPU usage #282 issue. Note, the vim-ruby #243 issue is fundamentally the same issue as well.
Basically the issue boils down to syntax highlighting needing to be calculated for every visible line when scrolling up or down with relativenumber enabled. The more lines visible and the slower the host CPU the worse the performance hit especially for languages with complex syntax highlighters such as Ruby.
In issue #282 Bram said this (Dec 2015):
I suspect, if implemented, that this suggestion indeed would greatly help scroll performance for those of us who enable relativenumber. A new setting possibly? cachesyntax?
I leave it to the Vim masters to either: do this, or not do this, or schedule later, or close if too hard.
Thank you.
The text was updated successfully, but these errors were encountered: