Comments (16)
Hm. I can’t reproduce this on Linux in gvim 7.2. I opened a 1.6MB HTML file and a small text file; and I have :bnext<CR>
mapped to <C-N>
so I held Ctrl-N pressed. Vim switched buffers at at least a few dozen frames/sec, even after I held the key for half a minute. Plenty fast and no detectible slowdown.
Maybe the structure of the file is significant? Can you provide me with an example file that exhibits the problem for you? (Upload a gist or something.)
If you do syn list
after switching to the buffer with the HTML, does the output get longer every time?
from vim-css-color.
$ curl https://raw.github.com/gist/1914468/98e732655ac1c5cacd45220b1198b34ae25a0022/CSS3_Buttons.html > buttons.html
$ vi buttons.html blank
<C-N> *20
The output doesn't seem to get longer for syn list
(although I'm not sure how to get a line count). I also see a big entry for cssColors
which definitely doesn't grow.
More info
.vim directory contents
$ .vim tree
.
├── autoload
│ └── pathogen.vim
└── bundle
└── css-color
├── README.md
├── after
│ └── syntax
│ ├── css.vim
│ ├── sass.vim
│ └── stylus.vim
└── screenshot.png
5 directories, 6 files
.vimrc contents
call pathogen#infect()
syntax on
filetype plugin indent on
map <C-N> :bnext<CR>
from vim-css-color.
OK… on one hand that’s great to know, because it means the syntax rule rewriting code is not buggy. On the other hand it means I have no obvious culprit for this.
If you open css.vim
and change BufEnter
(near the bottom of the file) to BufAdd
, does that fix the slowdown for you?
from vim-css-color.
Thanks for the sample file. (Note for the record: not much markup, but a ton of inline CSS in the header <style>
tag.) I can see on my system that that is slow to switch to, but it’s not unduly so, and more importantly after a minute of holding the key it does not seem to get any slower.
I wonder if MacVim is allocating colours anew every time it switches buffers of something like that?
from vim-css-color.
Changing BufEnter
to BufAdd
fully fixed the slowdown; and also disabled css-color in a way that it only displays colors when I navigate to a line with a hex color.
from vim-css-color.
Strange. If I change to BufAdd
it makes no difference whatsoever on my system – neither speed nor correctness is affected. So for some reason it is clearing out the highlights… hmm. I’ll have to think about how that could be working.
I wish I had a Mac to test on…
from vim-css-color.
Heh, I won't be able to help with getting a mac, but if you create a few branches with ideas—I'll run them.
from vim-css-color.
Hi, just to chime in, I have the same issue on large css files (they should be split but right now it sits at around 9kloc).
While trying to debug step by step I see that PreviewCSSColorInBuffer seems to be called in a loop. Each call is quite fast (around .5 sec) but there's so many of them that it slows down everything.
And I get more or less the same behavior as georgecalm with BufAdd, no highlights until I pass over a line but some lines are still highlighted.
from vim-css-color.
Hi, can you give current master
a try and report results please.
from vim-css-color.
It seems to work much faster. I still have a ~1 sec delay but it's expected seeing how huge is this file. Much more bearable than the few 5-10 sec before. And all colors seems to be highlighted correctly.
Thanks!
from vim-css-color.
What about you, @georgecalm?
from vim-css-color.
It does feel faster with the same gist (above), but I now have a different issue (which does go away when css-color is disabled). When I page-dow (C-D) or page-up (C-U), after a few pages the syntax-highlighter becomes disabled. It is only enabled when I use the navigation keys (jkl;). Navigation is also a bit slower when the plugin is enabled.
from vim-css-color.
@georgecalm, @hlidotbe, @eMxyzptlk, can you try current master
and tell me what is the situation is now?
from vim-css-color.
@georgecalm, @hlidotbe, @eMxyzptlk – any news?
from vim-css-color.
Everything seems good for me. The 9kloc file opens a bit slower than smaller file (~1sec) but this is expected and probably not (entirely) related to css-color. Haven't had much time to test thoroughly but the bug mentionned by @georgecalm seems to be gone.
from vim-css-color.
Well then. Since I haven’t heard back from anyone else and, after my initial spate of performance work, haven’t had any further complaints in forever, I guess it’s time to consider this issue fixed. Thanks to everyone who participated.
from vim-css-color.
Related Issues (20)
- E121: Undefined variable: b:css_color_pat in netrw
- Neovim tree sitter support HOT 20
- support for svelte files HOT 2
- Plugin is not compatible with nvim-treesitter HOT 1
- No colors in .h files in neovim
- It would be nice to support SVG files HOT 2
- create_matches function takes 1.4 s on large nix files
- NeoVim tree sitter support HOT 1
- Error with files with no highlightable targets in Vim9 HOT 4
- Erroring in java file HOT 2
- Add support for LaTeX? HOT 1
- Add support for template strings
- Does not work HOT 5
- incompatible with nvim-treesitter HOT 2
- [Feature request]: provide a command to make it asynchronous.
- truecolor terminals and termguicolors HOT 5
- Incorrect Highlighting of C Macros
- How to enable color highlighting for strings in CSS
- Error in C comments
- Support CSS Color Module Level 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-css-color.