comparison runtime/doc/syntax.txt @ 4764:f824cb97eb92 v7.3.1129

updated for version 7.3.1129 Problem: Can't see what pattern in syntax highlighting is slow. Solution: Add the ":syntime" command.
author Bram Moolenaar <bram@vim.org>
date Thu, 06 Jun 2013 14:01:46 +0200
parents 2eb30f341e8d
children 2b11ac90d9e9
comparison
equal deleted inserted replaced
4763:1b5ca3e53566 4764:f824cb97eb92
35 13. Linking groups |:highlight-link| 35 13. Linking groups |:highlight-link|
36 14. Cleaning up |:syn-clear| 36 14. Cleaning up |:syn-clear|
37 15. Highlighting tags |tag-highlight| 37 15. Highlighting tags |tag-highlight|
38 16. Window-local syntax |:ownsyntax| 38 16. Window-local syntax |:ownsyntax|
39 17. Color xterms |xterm-color| 39 17. Color xterms |xterm-color|
40 18. When syntax is slow |:syntime|
40 41
41 {Vi does not have any of these commands} 42 {Vi does not have any of these commands}
42 43
43 Syntax highlighting is not available when the |+syntax| feature has been 44 Syntax highlighting is not available when the |+syntax| feature has been
44 disabled at compile time. 45 disabled at compile time.
5084 set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm 5085 set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm
5085 Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure 5086 Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure
5086 that Setup / Font / Enable Bold is NOT enabled. 5087 that Setup / Font / Enable Bold is NOT enabled.
5087 (info provided by John Love-Jensen <eljay@Adobe.COM>) 5088 (info provided by John Love-Jensen <eljay@Adobe.COM>)
5088 5089
5090
5091 ==============================================================================
5092 18. When syntax is slow *:syntime*
5093
5094 This is aimed at authors of a syntax file.
5095
5096 If your syntax causes redrawing to be slow, here are a few hints on making it
5097 faster. To see slowness switch on some features that usually interfere, such
5098 as 'relativenumber' and |folding|.
5099
5100 To find out what patterns are consuming most time, get an overview with this
5101 sequence: >
5102 :syntime on
5103 [ redraw the text at least once with CTRL-L ]
5104 :syntime report
5105
5106 This will display a list of syntax patterns that were used, sorted by the time
5107 it took to match them against the text.
5108
5109 :syntime on Start measuring syntax times. This will add some
5110 overhead to compute the time spent on syntax pattern
5111 matching.
5112
5113 :syntime off Stop measuring syntax times.
5114
5115 :syntime clear Set all the counters to zero, restart measuring.
5116
5117 :syntime report Show the syntax items used since ":syntime on" in the
5118 current window. Use a wider display to see more of
5119 the output.
5120
5121 The list is sorted by total time. The columns are:
5122 TOTAL Total time in seconds spent on
5123 matching this pattern.
5124 COUNT Number of times the pattern was used.
5125 MATCH Number of times the pattern actually
5126 matched
5127 SLOWEST The longest time for one try.
5128 AVERAGE The average time for one try.
5129 NAME Name of the syntax item. Note that
5130 this is not unique.
5131 PATTERN The pattern being used.
5132
5133 Pattern matching gets slow when it has to try many alternatives. Try to
5134 include as much literal text as possible to reduce the number of ways a
5135 pattern does NOT match.
5136
5137 When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at
5138 all positions in the current and previous line. For example, if the item is
5139 literal text specify the size of that text (in bytes):
5140
5141 "<\@<=span" Matches "span" in "<span". This tries matching with "<" in
5142 many places.
5143 "<\@1<=span" Matches the same, but only tries one byte before "span".
5144
5145
5089 vim:tw=78:sw=4:ts=8:ft=help:norl: 5146 vim:tw=78:sw=4:ts=8:ft=help:norl: