I am using vanilla Vim and syntime reports the following costly patterns:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
3.526224 3751 1542 0.036641 0.000940 rubySymbol []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@=
1.278366 3465 1254 0.012201 0.000369 rubySymbol \%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!
0.730820 2211 0 0.008430 0.000331 rubyPredefinedConstant \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!
0.626906 2211 0 0.006168 0.000284 rubyPredefinedConstant \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!
0.515706 2211 0 0.004109 0.000233 rubyPredefinedConstant \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!
0.337235 2211 0 0.007179 0.000153 rubyPredefinedConstant \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|E
NGI
Where do I go to disable one or more of these from being searched? I do not want to install any plugins if possible.
Update: for more clarification, where the above syntime figures aren't specific, I encountered this in a ~1200 line .rb file. Whether or not this file is too long as an aside, such a task as inserting a new blank line in vim was painfully slow (several seconds before a visual response). Comparing this to Rubymine with the same file and not noticing any lag, I hoped there was a solution to improve this performance under vim. Disabling syntax highlighting altogether makes everything extremely snappy, but much harder to read.
Put the following into a file ~/.vim/after/syntax/ruby.vim:
syntax clear rubySymbol
The after directory will ensure that this is called after the original $VIMRUNTIME/syntax/ruby.vim has been sourced, and the command removes the slow syntax definition.
Note that this may interfere with the operation of the syntax plugin; you may see wrong highlighting, and it may even completely mess up the parsing!
An alternative would be disabling syntax for the current file (:setlocal syntax=), or entirely (:syntax off).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With