comparison runtime/doc/syntax.txt @ 4992:ceb5f21cda79

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Mon, 24 Jun 2013 22:22:18 +0200
parents 2b11ac90d9e9
children ad6996a23e3e
comparison
equal deleted inserted replaced
4991:eb75dbe39621 4992:ceb5f21cda79
1 *syntax.txt* For Vim version 7.3. Last change: 2013 Jun 06 1 *syntax.txt* For Vim version 7.3. Last change: 2013 Jun 24
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1316 1316
1317 FORTRAN *fortran.vim* *ft-fortran-syntax* 1317 FORTRAN *fortran.vim* *ft-fortran-syntax*
1318 1318
1319 Default highlighting and dialect ~ 1319 Default highlighting and dialect ~
1320 Highlighting appropriate for Fortran 2008 is used by default. This choice 1320 Highlighting appropriate for Fortran 2008 is used by default. This choice
1321 should be appropriate for most users most of the time because Fortran 2008 is 1321 should be appropriate for most users most of the time because Fortran 2008 is
1322 almost a superset of previous versions (Fortran 2003, 95, 90, and 77). 1322 almost a superset of previous versions (Fortran 2003, 95, 90, and 77).
1323 1323
1324 Fortran source code form ~ 1324 Fortran source code form ~
1325 Fortran code can be in either fixed or free source form. Note that the 1325 Fortran code can be in either fixed or free source form. Note that the
1326 syntax highlighting will not be correct if the form is incorrectly set. 1326 syntax highlighting will not be correct if the form is incorrectly set.
1327 1327
1408 deleted or declared obsolescent in the 2008 standard are highlighted as todo 1408 deleted or declared obsolescent in the 2008 standard are highlighted as todo
1409 items. 1409 items.
1410 1410
1411 If you use F, the advantage of setting the dialect appropriately is that 1411 If you use F, the advantage of setting the dialect appropriately is that
1412 other legacy features excluded from F will be highlighted as todo items and 1412 other legacy features excluded from F will be highlighted as todo items and
1413 that free source form will be assumed. 1413 that free source form will be assumed.
1414 1414
1415 The dialect can be selected in various ways. If all your fortran files use 1415 The dialect can be selected in various ways. If all your fortran files use
1416 the same dialect, set the global variable fortran_dialect in your .vimrc prior 1416 the same dialect, set the global variable fortran_dialect in your .vimrc prior
1417 to your syntax on statement. The case-sensitive, permissible values of 1417 to your syntax on statement. The case-sensitive, permissible values of
1418 fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are 1418 fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are
1442 ! fortran_dialect=F 1442 ! fortran_dialect=F
1443 1443
1444 For previous versions of the syntax, you may have set fortran_dialect to the 1444 For previous versions of the syntax, you may have set fortran_dialect to the
1445 now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be 1445 now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be
1446 silently handled as "f08". Users of "elf" may wish to experiment with "F" 1446 silently handled as "f08". Users of "elf" may wish to experiment with "F"
1447 instead. 1447 instead.
1448 1448
1449 The syntax/fortran.vim script contains embedded comments that tell you how to 1449 The syntax/fortran.vim script contains embedded comments that tell you how to
1450 comment and/or uncomment some lines to (a) activate recognition of some 1450 comment and/or uncomment some lines to (a) activate recognition of some
1451 non-standard, vendor-supplied intrinsics and (b) to prevent features deleted 1451 non-standard, vendor-supplied intrinsics and (b) to prevent features deleted
1452 or declared obsolescent in the 2008 standard from being highlighted as todo 1452 or declared obsolescent in the 2008 standard from being highlighted as todo
1453 items. 1453 items.
1454 1454
1455 Limitations ~ 1455 Limitations ~
1456 Parenthesis checking does not catch too few closing parentheses. Hollerith 1456 Parenthesis checking does not catch too few closing parentheses. Hollerith
1457 strings are not recognized. Some keywords may be highlighted incorrectly 1457 strings are not recognized. Some keywords may be highlighted incorrectly
1458 because Fortran90 has no reserved words. 1458 because Fortran90 has no reserved words.
2195 2195
2196 PERL *perl.vim* *ft-perl-syntax* 2196 PERL *perl.vim* *ft-perl-syntax*
2197 2197
2198 There are a number of possible options to the perl syntax highlighting. 2198 There are a number of possible options to the perl syntax highlighting.
2199 2199
2200 If you use POD files or POD segments, you might: > 2200 Inline POD highlighting is now turned on by default. If you don't wish
2201 2201 to have the added complexity of highlighting POD embedded within Perl
2202 :let perl_include_pod = 1 2202 files, you may set the 'perl_include_pod' option to 0: >
2203
2204 :let perl_include_pod = 0
2203 2205
2204 The reduce the complexity of parsing (and increase performance) you can switch 2206 The reduce the complexity of parsing (and increase performance) you can switch
2205 off two elements in the parsing of variable names and contents. > 2207 off two elements in the parsing of variable names and contents. >
2206 2208
2207 To handle package references in variable and function names not differently 2209 To handle package references in variable and function names not differently
2250 2252
2251 If you want to fold blocks in if statements, etc. as well set the following: > 2253 If you want to fold blocks in if statements, etc. as well set the following: >
2252 2254
2253 :let perl_fold_blocks = 1 2255 :let perl_fold_blocks = 1
2254 2256
2255 To avoid folding packages or subs when perl_fold is let, let the appropriate 2257 Subroutines are folded by default if 'perl_fold' is set. If you do not want
2256 variable(s): > 2258 this, you can set 'perl_nofold_subs': >
2257 2259
2258 :unlet perl_nofold_packages 2260 :let perl_nofold_subs = 1
2259 :unlet perl_nofold_subs 2261
2260 2262 Anonymous subroutines are not folded by default; you may enable their folding
2261 2263 via 'perl_fold_anonymous_subs': >
2264
2265 :let perl_fold_anonymous_subs = 1
2266
2267 Packages are also folded by default if 'perl_fold' is set. To disable this
2268 behavior, set 'perl_nofold_packages': >
2269
2270 :let perl_nofold_packages = 1
2262 2271
2263 PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax* 2272 PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax*
2264 2273
2265 [note: previously this was called "php3", but since it now also supports php4 2274 [note: previously this was called "php3", but since it now also supports php4
2266 it has been renamed to "php"] 2275 it has been renamed to "php"]
2479 2488
2480 If you want all possible Python highlighting (the same as setting the 2489 If you want all possible Python highlighting (the same as setting the
2481 preceding last option and unsetting all other ones): > 2490 preceding last option and unsetting all other ones): >
2482 :let python_highlight_all = 1 2491 :let python_highlight_all = 1
2483 2492
2484 Note: only existence of these options matter, not their value. You can replace 2493 Note: only existence of these options matter, not their value. You can replace
2485 1 above with anything. 2494 1 above with anything.
2486 2495
2487 2496
2488 QUAKE *quake.vim* *ft-quake-syntax* 2497 QUAKE *quake.vim* *ft-quake-syntax*
2489 2498
2872 synchronization is done from the start of the file. The default value for 2881 synchronization is done from the start of the file. The default value for
2873 tcsh_minlines is 100. The disadvantage of using a larger number is that 2882 tcsh_minlines is 100. The disadvantage of using a larger number is that
2874 redrawing can become slow. 2883 redrawing can become slow.
2875 2884
2876 2885
2877 TEX *tex.vim* *ft-tex-syntax* 2886 TEX *tex.vim* *ft-tex-syntax* *latex-syntax*
2878 2887
2879 *tex-folding* 2888 Tex Contents~
2889 Tex: Want Syntax Folding? |tex-folding|
2890 Tex: No Spell Checking Wanted |g:tex_nospell|
2891 Tex: Don't Want Spell Checking In Comments? |tex-nospell|
2892 Tex: Want Spell Checking in Verbatim Zones? |tex-verb|
2893 Tex: Run-on Comments or MathZones |tex-runon|
2894 Tex: Slow Syntax Highlighting? |tex-slow|
2895 Tex: Want To Highlight More Commands? |tex-morecommands|
2896 Tex: Excessive Error Highlighting? |tex-error|
2897 Tex: Need a new Math Group? |tex-math|
2898 Tex: Starting a New Style? |tex-style|
2899 Tex: Taking Advantage of Conceal Mode |tex-conceal|
2900 Tex: Selective Conceal Mode |g:tex_conceal|
2901 Tex: Controlling iskeyword |g:tex_isk|
2902
2903 *tex-folding* *g:tex_fold_enabled*
2880 Tex: Want Syntax Folding? ~ 2904 Tex: Want Syntax Folding? ~
2881 2905
2882 As of version 28 of <syntax/tex.vim>, syntax-based folding of parts, chapters, 2906 As of version 28 of <syntax/tex.vim>, syntax-based folding of parts, chapters,
2883 sections, subsections, etc are supported. Put > 2907 sections, subsections, etc are supported. Put >
2884 let g:tex_fold_enabled=1 2908 let g:tex_fold_enabled=1
2885 in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a 2909 in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a
2886 modeline at the end of your LaTeX file: > 2910 modeline at the end of your LaTeX file: >
2887 % vim: fdm=syntax 2911 % vim: fdm=syntax
2888 If your system becomes too slow, then you might wish to look into > 2912 If your system becomes too slow, then you might wish to look into >
2889 http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text 2913 https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7
2890 < 2914 <
2891 *tex-nospell* 2915 *g:tex_nospell*
2916 Tex: No Spell Checking Wanted~
2917
2918 If you don't want spell checking anywhere in your LaTeX document, put >
2919 let g:tex_nospell=1
2920 into your .vimrc. If you merely wish to suppress spell checking inside
2921 comments only, see |g:tex_comment_nospell|.
2922
2923 *tex-nospell* *g:tex_comment_nospell*
2892 Tex: Don't Want Spell Checking In Comments? ~ 2924 Tex: Don't Want Spell Checking In Comments? ~
2893 2925
2894 Some folks like to include things like source code in comments and so would 2926 Some folks like to include things like source code in comments and so would
2895 prefer that spell checking be disabled in comments in LaTeX files. To do 2927 prefer that spell checking be disabled in comments in LaTeX files. To do
2896 this, put the following in your <.vimrc>: > 2928 this, put the following in your <.vimrc>: >
2897 let g:tex_comment_nospell= 1 2929 let g:tex_comment_nospell= 1
2898 The comment lines > 2930 If you want to suppress spell checking everywhere inside your LaTeX document,
2899 % nospell{ 2931 see |g:tex_nospell|.
2900 ... 2932
2901 % nospell} 2933 *tex-verb* *g:tex_verbspell*
2902 will suppress spell checking between them. These comment lines spelling
2903 control are known to be fragile; for example, don't include any of the section
2904 commands (\part, \chapter, \section, \paragraph, etc) inside nospell blocks
2905 or interleave environments (such as math) across nospell blocks.
2906 *tex-verb*
2907 Tex: Want Spell Checking in Verbatim Zones?~ 2934 Tex: Want Spell Checking in Verbatim Zones?~
2908 2935
2909 Often verbatim regions are used for things like source code; seldom does 2936 Often verbatim regions are used for things like source code; seldom does
2910 one want source code spell-checked. However, for those of you who do 2937 one want source code spell-checked. However, for those of you who do
2911 want your verbatim zones spell-checked, put the following in your <.vimrc>: > 2938 want your verbatim zones spell-checked, put the following in your <.vimrc>: >
2912 let g:tex_verbspell= 1 2939 let g:tex_verbspell= 1
2913 < 2940 <
2914 *tex-runon* 2941 *tex-runon* *tex-stopzone*
2915 Tex: Run-on Comments or MathZones ~ 2942 Tex: Run-on Comments or MathZones ~
2916 2943
2917 The <syntax/tex.vim> highlighting supports TeX, LaTeX, and some AmsTeX. The 2944 The <syntax/tex.vim> highlighting supports TeX, LaTeX, and some AmsTeX. The
2918 highlighting supports three primary zones/regions: normal, texZone, and 2945 highlighting supports three primary zones/regions: normal, texZone, and
2919 texMathZone. Although considerable effort has been made to have these zones 2946 texMathZone. Although considerable effort has been made to have these zones
2922 special "TeX comment" has been provided > 2949 special "TeX comment" has been provided >
2923 %stopzone 2950 %stopzone
2924 which will forcibly terminate the highlighting of either a texZone or a 2951 which will forcibly terminate the highlighting of either a texZone or a
2925 texMathZone. 2952 texMathZone.
2926 2953
2927 *tex-slow* 2954 *tex-slow* *tex-sync*
2928 Tex: Slow Syntax Highlighting? ~ 2955 Tex: Slow Syntax Highlighting? ~
2929 2956
2930 If you have a slow computer, you may wish to reduce the values for > 2957 If you have a slow computer, you may wish to reduce the values for >
2931 :syn sync maxlines=200 2958 :syn sync maxlines=200
2932 :syn sync minlines=50 2959 :syn sync minlines=50
2964 V : allow texNewEnv and texNewCmd syntax 2991 V : allow texNewEnv and texNewCmd syntax
2965 < 2992 <
2966 As an example, let g:tex_fast= "M" will allow math-associated highlighting 2993 As an example, let g:tex_fast= "M" will allow math-associated highlighting
2967 but suppress all the other region-based syntax highlighting. 2994 but suppress all the other region-based syntax highlighting.
2968 2995
2969 *tex-morecommands* *tex-package* 2996 Another cause of slow highlighting is due to syntax-driven folding; see
2997 |tex-folding| for a way around this.
2998
2999 *g:tex_fast*
3000
3001 Finally, if syntax highlighting is still too slow, you may set >
3002
3003 :let g:tex_fast= ""
3004
3005 in your .vimrc. Used this way, the g:tex_fast variable causes the syntax
3006 highlighting script to avoid defining any regions and associated
3007 synchronization. The result will be much faster syntax highlighting; the
3008 price: you will no longer have as much highlighting or any syntax-based
3009 folding, and you will be missing syntax-based error checking.
3010
3011 You may decide that some syntax is acceptable; you may use the following table
3012 selectively to enable just some syntax highlighting: >
3013
3014 b : allow bold and italic syntax
3015 c : allow texComment syntax
3016 m : allow texMatcher syntax (ie. {...} and [...])
3017 M : allow texMath syntax
3018 p : allow parts, chapter, section, etc syntax
3019 r : allow texRefZone syntax (nocite, bibliography, label, pageref, eqref)
3020 s : allow superscript/subscript regions
3021 S : allow texStyle syntax
3022 v : allow verbatim syntax
3023 V : allow texNewEnv and texNewCmd syntax
3024 <
3025 As an example, let g:tex_fast= "M" will allow math-associated highlighting
3026 but suppress all the other region-based syntax highlighting.
3027
3028 *tex-morecommands* *tex-package*
2970 Tex: Want To Highlight More Commands? ~ 3029 Tex: Want To Highlight More Commands? ~
2971 3030
2972 LaTeX is a programmable language, and so there are thousands of packages full 3031 LaTeX is a programmable language, and so there are thousands of packages full
2973 of specialized LaTeX commands, syntax, and fonts. If you're using such a 3032 of specialized LaTeX commands, syntax, and fonts. If you're using such a
2974 package you'll often wish that the distributed syntax/tex.vim would support 3033 package you'll often wish that the distributed syntax/tex.vim would support
2976 techniques in |mysyntaxfile-add| to extend or modify the highlighting provided 3035 techniques in |mysyntaxfile-add| to extend or modify the highlighting provided
2977 by syntax/tex.vim. Please consider uploading any extensions that you write, 3036 by syntax/tex.vim. Please consider uploading any extensions that you write,
2978 which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to 3037 which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to
2979 http://vim.sf.net/. 3038 http://vim.sf.net/.
2980 3039
2981 *tex-error* 3040 *tex-error* *g:tex_no_error*
2982 Tex: Excessive Error Highlighting? ~ 3041 Tex: Excessive Error Highlighting? ~
2983 3042
2984 The <tex.vim> supports lexical error checking of various sorts. Thus, 3043 The <tex.vim> supports lexical error checking of various sorts. Thus,
2985 although the error checking is ofttimes very useful, it can indicate 3044 although the error checking is ofttimes very useful, it can indicate
2986 errors where none actually are. If this proves to be a problem for you, 3045 errors where none actually are. If this proves to be a problem for you,
2987 you may put in your <.vimrc> the following statement: > 3046 you may put in your <.vimrc> the following statement: >
2988 let tex_no_error=1 3047 let g:tex_no_error=1
2989 and all error checking by <syntax/tex.vim> will be suppressed. 3048 and all error checking by <syntax/tex.vim> will be suppressed.
2990 3049
2991 *tex-math* 3050 *tex-math*
2992 Tex: Need a new Math Group? ~ 3051 Tex: Need a new Math Group? ~
2993 3052
3001 You'll need to change "mathzone" to the name of your new math group, 3060 You'll need to change "mathzone" to the name of your new math group,
3002 and then to the call to it in .vim/after/syntax/tex.vim. 3061 and then to the call to it in .vim/after/syntax/tex.vim.
3003 The "starform" variable, if true, implies that your new math group 3062 The "starform" variable, if true, implies that your new math group
3004 has a starred form (ie. eqnarray*). 3063 has a starred form (ie. eqnarray*).
3005 3064
3006 *tex-style* 3065 *tex-style* *b:tex_stylish*
3007 Tex: Starting a New Style? ~ 3066 Tex: Starting a New Style? ~
3008 3067
3009 One may use "\makeatletter" in *.tex files, thereby making the use of "@" in 3068 One may use "\makeatletter" in *.tex files, thereby making the use of "@" in
3010 commands available. However, since the *.tex file doesn't have one of the 3069 commands available. However, since the *.tex file doesn't have one of the
3011 following suffices: sty cls clo dtx ltx, the syntax highlighting will flag 3070 following suffices: sty cls clo dtx ltx, the syntax highlighting will flag
3028 In fact, only a few characters are supported as subscripts. 3087 In fact, only a few characters are supported as subscripts.
3029 3088
3030 One way to use this is to have vertically split windows (see |CTRL-W_v|); one 3089 One way to use this is to have vertically split windows (see |CTRL-W_v|); one
3031 with |'conceallevel'| at 0 and the other at 2; and both using |'scrollbind'|. 3090 with |'conceallevel'| at 0 and the other at 2; and both using |'scrollbind'|.
3032 3091
3033 *g:tex_conceal* 3092 *g:tex_conceal*
3034 Tex: Selective Conceal Mode~ 3093 Tex: Selective Conceal Mode~
3035 3094
3036 You may selectively use conceal mode by setting g:tex_conceal in your 3095 You may selectively use conceal mode by setting g:tex_conceal in your
3037 <.vimrc>. By default it is set to "admgs" to enable conceal for the 3096 <.vimrc>. By default, g:tex_conceal is set to "admgs" to enable concealment
3038 following sets of characters: > 3097 for the following sets of characters: >
3039 3098
3040 a = accents/ligatures 3099 a = accents/ligatures
3041 b = bold and italic 3100 b = bold and italic
3042 d = delimiters 3101 d = delimiters
3043 m = math symbols 3102 m = math symbols
3056 with one that works for LaTeX. 3115 with one that works for LaTeX.
3057 3116
3058 However, one may override this iskeyword re-setting by setting the 3117 However, one may override this iskeyword re-setting by setting the
3059 variable, g:tex_isk, in one's .vimrc to whatever one wishes and 3118 variable, g:tex_isk, in one's .vimrc to whatever one wishes and
3060 it will be used instead. 3119 it will be used instead.
3061 3120
3062 3121
3063 TF *tf.vim* *ft-tf-syntax* 3122 TF *tf.vim* *ft-tf-syntax*
3064 3123
3065 There is one option for the tf syntax highlighting. 3124 There is one option for the tf syntax highlighting.
3066 3125
3067 For syncing, minlines defaults to 100. If you prefer another value, you can 3126 For syncing, minlines defaults to 100. If you prefer another value, you can
3068 set "tf_minlines" to the value you desire. Example: > 3127 set "tf_minlines" to the value you desire. Example: >
3069 3128
3070 :let tf_minlines = your choice 3129 :let tf_minlines = your choice
3130
3131 *g:tex_isk* *g:tex_stylish*
3132 Tex: Controlling iskeyword~
3133
3134 Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex
3135 keywords don't support the underscore - except when in *.sty files. The
3136 syntax highlighting script handles this with the following logic:
3137
3138 * If g:tex_stylish exists and is 1
3139 then the file will be treated as a "sty" file, so the "_"
3140 will be allowed as part of keywords
3141 (irregardless of g:tex_isk)
3142 * Else if the file's suffix is sty, cls, clo, dtx, or ltx,
3143 then the file will be treated as a "sty" file, so the "_"
3144 will be allowed as part of keywords
3145 (irregardless of g:tex_isk)
3146
3147 * If g:tex_isk exists, then it will be used for the local 'iskeyword'
3148 * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255
3149
3071 3150
3072 3151
3073 VIM *vim.vim* *ft-vim-syntax* 3152 VIM *vim.vim* *ft-vim-syntax*
3074 *g:vimsyn_minlines* *g:vimsyn_maxlines* 3153 *g:vimsyn_minlines* *g:vimsyn_maxlines*
3075 There is a trade-off between more accurate syntax highlighting versus screen 3154 There is a trade-off between more accurate syntax highlighting versus screen
4934 restoring "b:current_syntax", since the syntax files do set 5013 restoring "b:current_syntax", since the syntax files do set
4935 "b:current_syntax". The value set by the syntax file is assigned to 5014 "b:current_syntax". The value set by the syntax file is assigned to
4936 "w:current_syntax". 5015 "w:current_syntax".
4937 5016
4938 Once a window has its own syntax, syntax commands executed from other windows 5017 Once a window has its own syntax, syntax commands executed from other windows
4939 on the same buffer (including :syntax clear) have no effect. Conversely, 5018 on the same buffer (including :syntax clear) have no effect. Conversely,
4940 syntax commands executed from that window do not affect other windows on the 5019 syntax commands executed from that window do not affect other windows on the
4941 same buffer. 5020 same buffer.
4942 5021
4943 A window with its own syntax reverts to normal behavior when another buffer 5022 A window with its own syntax reverts to normal behavior when another buffer
4944 is loaded into that window or the file is reloaded. 5023 is loaded into that window or the file is reloaded.
5139 5218
5140 When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at 5219 When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at
5141 all positions in the current and previous line. For example, if the item is 5220 all positions in the current and previous line. For example, if the item is
5142 literal text specify the size of that text (in bytes): 5221 literal text specify the size of that text (in bytes):
5143 5222
5144 "<\@<=span" Matches "span" in "<span". This tries matching with "<" in 5223 "<\@<=span" Matches "span" in "<span". This tries matching with "<" in
5145 many places. 5224 many places.
5146 "<\@1<=span" Matches the same, but only tries one byte before "span". 5225 "<\@1<=span" Matches the same, but only tries one byte before "span".
5147 5226
5148 5227
5149 vim:tw=78:sw=4:ts=8:ft=help:norl: 5228 vim:tw=78:sw=4:ts=8:ft=help:norl: