diff options
Diffstat (limited to 'runtime/doc/syntax.txt')
-rw-r--r-- | runtime/doc/syntax.txt | 88 |
1 files changed, 45 insertions, 43 deletions
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index d1875fc62..29fae2c3f 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 8.1. Last change: 2018 Apr 30 +*syntax.txt* For Vim version 8.1. Last change: 2018 Dec 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -23,21 +23,22 @@ In the User Manual: 1. Quick start |:syn-qstart| 2. Syntax files |:syn-files| 3. Syntax loading procedure |syntax-loading| -4. Syntax file remarks |:syn-file-remarks| -5. Defining a syntax |:syn-define| -6. :syntax arguments |:syn-arguments| -7. Syntax patterns |:syn-pattern| -8. Syntax clusters |:syn-cluster| -9. Including syntax files |:syn-include| -10. Synchronizing |:syn-sync| -11. Listing syntax items |:syntax| -12. Highlight command |:highlight| -13. Linking groups |:highlight-link| -14. Cleaning up |:syn-clear| -15. Highlighting tags |tag-highlight| -16. Window-local syntax |:ownsyntax| -17. Color xterms |xterm-color| -18. When syntax is slow |:syntime| +4. Converting to HTML |2html.vim| +5. Syntax file remarks |:syn-file-remarks| +6. Defining a syntax |:syn-define| +7. :syntax arguments |:syn-arguments| +8. Syntax patterns |:syn-pattern| +9. Syntax clusters |:syn-cluster| +10. Including syntax files |:syn-include| +11. Synchronizing |:syn-sync| +12. Listing syntax items |:syntax| +13. Highlight command |:highlight| +14. Linking groups |:highlight-link| +15. Cleaning up |:syn-clear| +16. Highlighting tags |tag-highlight| +17. Window-local syntax |:ownsyntax| +18. Color xterms |xterm-color| +19. When syntax is slow |:syntime| {Vi does not have any of these commands} @@ -368,20 +369,9 @@ Upon loading a file, Vim finds the relevant syntax file as follows: syntax. ============================================================================== -4. Syntax file remarks *:syn-file-remarks* +4. Conversion to HTML *2html.vim* *convert-to-HTML* - *b:current_syntax-variable* -Vim stores the name of the syntax that has been loaded in the -"b:current_syntax" variable. You can use this if you want to load other -settings, depending on which syntax is active. Example: > - :au BufReadPost * if b:current_syntax == "csh" - :au BufReadPost * do-some-things - :au BufReadPost * endif - - -2HTML *2html.vim* *convert-to-HTML* - -This is not a syntax file itself, but a script that converts the current +2html is not a syntax file itself, but a script that converts the current window into HTML. Vim opens a new window in which it builds the HTML file. After you save the resulting file, you can view it with any browser. The @@ -773,6 +763,18 @@ When 1, generate XHTML 1.0 instead (XML compliant HTML). > :let g:html_use_xhtml = 1 < +============================================================================== +5. Syntax file remarks *:syn-file-remarks* + + *b:current_syntax-variable* +Vim stores the name of the syntax that has been loaded in the +"b:current_syntax" variable. You can use this if you want to load other +settings, depending on which syntax is active. Example: > + :au BufReadPost * if b:current_syntax == "csh" + :au BufReadPost * do-some-things + :au BufReadPost * endif + + ABEL *abel.vim* *ft-abel-syntax* @@ -3484,7 +3486,7 @@ The syntax script for zsh allows for syntax-based folding: > :let g:zsh_fold_enable = 1 ============================================================================== -5. Defining a syntax *:syn-define* *E410* +6. Defining a syntax *:syn-define* *E410* Vim understands three types of syntax items: @@ -3843,7 +3845,7 @@ DEFINING REGIONS *:syn-region* *:syn-start* *:syn-skip* *:syn-end* The maximum number of syntax groups is 19999. ============================================================================== -6. :syntax arguments *:syn-arguments* +7. :syntax arguments *:syn-arguments* The :syntax commands that define syntax items take a number of arguments. The common ones are explained here. The arguments may be given in any order @@ -4164,7 +4166,7 @@ IMPLICIT CONCEAL *:syn-conceal-implicit* Show either "syntax conceal on" or "syntax conceal off" (translated). ============================================================================== -7. Syntax patterns *:syn-pattern* *E401* *E402* +8. Syntax patterns *:syn-pattern* *E401* *E402* In the syntax commands, a pattern must be surrounded by two identical characters. This is like it works for the ":s" command. The most common to @@ -4342,7 +4344,7 @@ Note that only matches within a single line can be used. Multi-line matches cannot be referred to. ============================================================================== -8. Syntax clusters *:syn-cluster* *E400* +9. Syntax clusters *:syn-cluster* *E400* :sy[ntax] cluster {cluster-name} [contains={group-name}..] [add={group-name}..] @@ -4388,7 +4390,7 @@ This also has implications for nested clusters: > The maximum number of clusters is 9767. ============================================================================== -9. Including syntax files *:syn-include* *E397* +10. Including syntax files *:syn-include* *E397* It is often useful for one language's syntax file to include a syntax file for a related language. Depending on the exact relationship, this can be done in @@ -4429,7 +4431,7 @@ two different ways: The maximum number of includes is 999. ============================================================================== -10. Synchronizing *:syn-sync* *E403* *E404* +11. Synchronizing *:syn-sync* *E403* *E404* Vim wants to be able to start redrawing in any position in the document. To make this possible it needs to know the syntax state at the position where @@ -4621,7 +4623,7 @@ You can clear specific sync patterns with: > :syntax sync clear {sync-group-name} .. ============================================================================== -11. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* +12. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* This command lists all the syntax items: > @@ -4641,7 +4643,7 @@ Note that the ":syntax" command can be abbreviated to ":sy", although ":syn" is mostly used, because it looks better. ============================================================================== -12. Highlight command *:highlight* *:hi* *E28* *E411* *E415* +13. Highlight command *:highlight* *:hi* *E28* *E411* *E415* There are three types of highlight groups: - The ones used for specific languages. For these the name starts with the @@ -5134,7 +5136,7 @@ Tooltip Current font, background and foreground of the tooltips. set. ============================================================================== -13. Linking groups *:hi-link* *:highlight-link* *E412* *E413* +14. Linking groups *:hi-link* *:highlight-link* *E412* *E413* When you want to use the same highlighting for several syntax groups, you can do this more easily by linking the groups into one common highlight @@ -5172,7 +5174,7 @@ Without the "default" in the C syntax file, the highlighting would be overruled when the syntax file is loaded. ============================================================================== -14. Cleaning up *:syn-clear* *E391* +15. Cleaning up *:syn-clear* *E391* If you want to clear the syntax stuff for the current buffer, you can use this command: > @@ -5263,7 +5265,7 @@ syntax/syncolor.vim files are loaded: them. ============================================================================== -15. Highlighting tags *tag-highlight* +16. Highlighting tags *tag-highlight* If you want to highlight all the tags in your file, you can use the following mappings. @@ -5298,7 +5300,7 @@ And put these lines in your .vimrc: > autocmd BufRead,BufNewFile *.[ch] endif ============================================================================== -16. Window-local syntax *:ownsyntax* +17. Window-local syntax *:ownsyntax* Normally all windows on a buffer share the same syntax settings. It is possible, however, to set a particular window on a file to have its own @@ -5328,7 +5330,7 @@ is loaded into that window or the file is reloaded. When splitting the window, the new window will use the original syntax. ============================================================================== -17. Color xterms *xterm-color* *color-xterm* +18. Color xterms *xterm-color* *color-xterm* Most color xterms have only eight colors. If you don't get colors with the default setup, it should work with these lines in your .vimrc: > @@ -5472,7 +5474,7 @@ that Setup / Font / Enable Bold is NOT enabled. ============================================================================== -18. When syntax is slow *:syntime* +19. When syntax is slow *:syntime* This is aimed at authors of a syntax file. |