I use only Vim to edit my files everywhere. Today I tried to open a keystore file with vim inside Xarchiver. My XFCE froze and didn't recover from it without reboot. I tried it again and got the same results. Vim is fun.
Vim always ended up frozen on me when opening big XML files, one big verbose line each. Just had to delete my tmux session though, not restart everything.
It could be the syntax highlighting if you have that on; Vim loves to throw regexes to long lines to highlight them. Thankfully it stops at one point. I don't think treesitter using Neovim has this problem, I should test that.
I struggle to imagine how that could slow it down. In the end it shouldn't matter whether you have dozens of lines or one long wrapped line, it's still roughly the same number of tokens to parse/highlight. Though admittedly I haven't yet tried with syntax highlighting turned off to see if that's the issue.
I don’t know how the highlight engine is coded, but I do know that it’s regex based. You moslty have to try every regex on every line. And for some lines you have to try it more than once (think tags).
When it doesn’t match, it’s ok. When it does match you jave to create new structures, adjust their priorities. And for the renderer, every scrolling means reissuing the ansi excape code according to some theme.
All of this are probably bound to the number n of characters in a line. And for big n, that means a lot of operations. Emacs also struggle with long lines.
Regexes are line-based most of the time. And so the more characters you have on the line, the more work the engine has to do to parse it. I guess with greedy quantifiers you need to go to the end of the line and then match from there, and I don't think that's free. Multiply that by the crazy amount of regexes Vim native highlighting uses and the engine begins to struggle.
That being said, I didn't look at the code of the engine itself, so I don't know for sure. But I know that disabling the highlighting get rid of these kind of issues most of the time.
For what it's worth, Vim is nowhere near as bad with long lines as typical GUI text editors in my experience (currently I have access to Xed and... yeah.)
Replies (1)
Vim always ended up frozen on me when opening big XML files, one big verbose line each. Just had to delete my tmux session though, not restart everything.
Replies (1)
Replies (2)
Replies (1)
Replies (2)
When it doesn’t match, it’s ok. When it does match you jave to create new structures, adjust their priorities. And for the renderer, every scrolling means reissuing the ansi excape code according to some theme.
All of this are probably bound to the number n of characters in a line. And for big n, that means a lot of operations. Emacs also struggle with long lines.
That being said, I didn't look at the code of the engine itself, so I don't know for sure. But I know that disabling the highlighting get rid of these kind of issues most of the time.