"foo", separately from all other
windows on the buffer: >
:ownsyntax foo
< *w:current_syntax*
This will set the "w:current_syntax" variable to "foo". The value of
"b:current_syntax" does not change. This is implemented by saving and
restoring "b:current_syntax", since the syntax files do set
"b:current_syntax". The value set by the syntax file is assigned to
"w:current_syntax".
Note: This resets the 'spell', 'spellcapcheck', 'spellfile' and 'spelloptions'
options.
Once a window has its own syntax, syntax commands executed from other windows
on the same buffer (including :syntax clear) have no effect. Conversely,
syntax commands executed from that window do not affect other windows on the
same buffer.
A window with its own syntax reverts to normal behavior when another buffer
is loaded into that window or the file is reloaded.
When splitting the window, the new window will use the original syntax.
==============================================================================
18. Color xterms *xterm-color* *color-xterm*
*colortest.vim*
To test your color setup, a file has been included in the Vim distribution.
To use it, execute this command: >
:runtime syntax/colortest.vim
Nvim uses 256-color and |true-color| terminal capabilities wherever possible.
==============================================================================
19. When syntax is slow *:syntime*
This is aimed at authors of a syntax file.
If your syntax causes redrawing to be slow, here are a few hints on making it
faster. To see slowness switch on some features that usually interfere, such
as 'relativenumber' and |folding|.
To find out what patterns are consuming most time, get an overview with this
sequence: >
:syntime on
[ redraw the text at least once with CTRL-L ]
:syntime report
This will display a list of syntax patterns that were used, sorted by the time
it took to match them against the text.
:syntime on Start measuring syntax times. This will add some
overhead to compute the time spent on syntax pattern
matching.
:syntime off Stop measuring syntax times.
:syntime clear Set all the counters to zero, restart measuring.
:syntime report Show the syntax items used since ":syntime on" in the
current window. Use a wider display to see more of
the output.
The list is sorted by total time. The columns are:
TOTAL Total time in seconds spent on
matching this pattern.
COUNT Number of times the pattern was used.
MATCH Number of times the pattern actually
matched
SLOWEST The longest time for one try.
AVERAGE The average time for one try.
NAME Name of the syntax item. Note that
this is not unique.
PATTERN The pattern being used.
Pattern matching gets slow when it has to try many alternatives. Try to
include as much literal text as possible to reduce the number of ways a
pattern does NOT match.
When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at
all positions in the current and previous line. For example, if the item is
literal text specify the size of that text (in bytes):
"<\@<=span" Matches "span" in "<span". This tries matching with "<" in
many places.
"<\@1<=span" Matches the same, but only tries one byte before "span".
vim:tw=78:sw=4:ts=8:noet:ft=help:norl: