comparison runtime/doc/syntax.txt @ 2250:1bac28a53fae vim73

Add the conceal patch from Vince Negri.
author Bram Moolenaar <bram@vim.org>
date Sat, 05 Jun 2010 23:22:07 +0200
parents dc2e5ec0500d
children 4620acaf4814
comparison
equal deleted inserted replaced
2249:6d3d35ff2c2b 2250:1bac28a53fae
33 11. Listing syntax items |:syntax| 33 11. Listing syntax items |:syntax|
34 12. Highlight command |:highlight| 34 12. Highlight command |:highlight|
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. Color xterms |xterm-color| 38 16. Window-local syntax |:ownsyntax|
39 17. Color xterms |xterm-color|
39 40
40 {Vi does not have any of these commands} 41 {Vi does not have any of these commands}
41 42
42 Syntax highlighting is not available when the |+syntax| feature has been 43 Syntax highlighting is not available when the |+syntax| feature has been
43 disabled at compile time. 44 disabled at compile time.
3113 and may be mixed with patterns. 3114 and may be mixed with patterns.
3114 3115
3115 Not all commands accept all arguments. This table shows which arguments 3116 Not all commands accept all arguments. This table shows which arguments
3116 can not be used for all commands: 3117 can not be used for all commands:
3117 *E395* *E396* 3118 *E395* *E396*
3118 contains oneline fold display extend ~ 3119 contains oneline fold display extend concealends~
3119 :syntax keyword - - - - - 3120 :syntax keyword - - - - - -
3120 :syntax match yes - yes yes yes 3121 :syntax match yes - yes yes yes -
3121 :syntax region yes yes yes yes yes 3122 :syntax region yes yes yes yes yes yes
3122 3123
3123 These arguments can be used for all three commands: 3124 These arguments can be used for all three commands:
3125 conceal
3126 cchar
3124 contained 3127 contained
3125 containedin 3128 containedin
3126 nextgroup 3129 nextgroup
3127 transparent 3130 transparent
3128 skipwhite 3131 skipwhite
3129 skipnl 3132 skipnl
3130 skipempty 3133 skipempty
3131 3134
3135 conceal *conceal* *:syn-conceal*
3136
3137 When the "conceal" argument is given, the item is marked as concealable.
3138 Whether or not it is actually concealed depends on the setting on the
3139 'conceallevel' option.
3140
3141 concealends *:syn-concealends*
3142
3143 When the "concealends" argument is given, the start and end matches of
3144 the region, but not the contents of the region, are marked as concealable.
3145 Whether or not they are actually concealed depends on the setting on the
3146 'conceallevel' option. The ends of a region can only be concealed separately
3147 in this way when they have their own highlighting via "matchgroup"
3148
3149 cchar *:syn-cchar*
3150
3151 The "cchar" argument defines the character shown in place of the item
3152 when it is concealed (setting "cchar" only makes sense when the conceal
3153 argument is given.) If "cchar" is not set then the default conceal
3154 character defined in the 'listchars' option is used. Example: >
3155 :syntax match Entity "&amp;" conceal cchar=&
3132 3156
3133 contained *:syn-contained* 3157 contained *:syn-contained*
3134 3158
3135 When the "contained" argument is given, this item will not be recognized at 3159 When the "contained" argument is given, this item will not be recognized at
3136 the top level, but only when it is mentioned in the "contains" field of 3160 the top level, but only when it is mentioned in the "contains" field of
3382 match "endif". Therefore the "endif" match is put last, so that it takes 3406 match "endif". Therefore the "endif" match is put last, so that it takes
3383 precedence. 3407 precedence.
3384 Note that this example doesn't work for nested "if"s. You need to add 3408 Note that this example doesn't work for nested "if"s. You need to add
3385 "contains" arguments to make that work (omitted for simplicity of the 3409 "contains" arguments to make that work (omitted for simplicity of the
3386 example). 3410 example).
3411
3412 IMPLICIT CONCEAL *:syn-conceal-implicit*
3413
3414 :sy[ntax] conceal [on|off]
3415 This defines if the following ":syntax" commands will define keywords,
3416 matches or regions with the "conceal" flag set. After ":syn conceal
3417 on", all subsequent ":syn keyword", ":syn match" or ":syn region"
3418 defined will have the "conceal" flag set implicitly. ":syn conceal
3419 off" returns to the normal state where the "conceal" flag must be
3420 given explicitly.
3387 3421
3388 ============================================================================== 3422 ==============================================================================
3389 7. Syntax patterns *:syn-pattern* *E401* *E402* 3423 7. Syntax patterns *:syn-pattern* *E401* *E402*
3390 3424
3391 In the syntax commands, a pattern must be surrounded by two identical 3425 In the syntax commands, a pattern must be surrounded by two identical
4167 *highlight-groups* *highlight-default* 4201 *highlight-groups* *highlight-default*
4168 These are the default highlighting groups. These groups are used by the 4202 These are the default highlighting groups. These groups are used by the
4169 'highlight' option default. Note that the highlighting depends on the value 4203 'highlight' option default. Note that the highlighting depends on the value
4170 of 'background'. You can see the current settings with the ":highlight" 4204 of 'background'. You can see the current settings with the ":highlight"
4171 command. 4205 command.
4206 *hl-Conceal*
4207 Conceal placeholder characters substituted for concealed
4208 text (see 'conceallevel')
4172 *hl-Cursor* 4209 *hl-Cursor*
4173 Cursor the character under the cursor 4210 Cursor the character under the cursor
4174 *hl-CursorIM* 4211 *hl-CursorIM*
4175 CursorIM like Cursor, but used when in IME mode |CursorIM| 4212 CursorIM like Cursor, but used when in IME mode |CursorIM|
4176 *hl-CursorColumn* 4213 *hl-CursorColumn*
4470 autocmd BufRead,BufNewFile *.[ch] if filereadable(fname) 4507 autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
4471 autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname 4508 autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname
4472 autocmd BufRead,BufNewFile *.[ch] endif 4509 autocmd BufRead,BufNewFile *.[ch] endif
4473 4510
4474 ============================================================================== 4511 ==============================================================================
4512 16. Window-local syntax *:ownsyntax*
4513
4514 Normally all windows on a buffer share the same syntax settings. It is
4515 possible, however, to set a particular window on a file to have its own
4516 private syntax setting. A possible example would be to edit LaTeX source
4517 with conventional highlighting in one window, while seeing the same source
4518 highlighted differently (so as to hide control sequences and indicate bold,
4519 italic etc regions) in another. The 'scrollbind' option is useful here.
4520
4521 To set the current window to have the syntax "foo", separately from all other
4522 windows on the buffer: >
4523 :ownsyntax foo
4524
4525 Once a window has its own syntax, syntax commands executed from other windows
4526 on the same buffer (including :syntax clear) have no effect. Conversely,
4527 syntax commands executed from that window do not effect other windows on the
4528 same buffer.
4529
4530 A window with its own syntax reverts to normal behaviour when another buffer
4531 is loaded into that window.
4532
4533 ==============================================================================
4475 16. Color xterms *xterm-color* *color-xterm* 4534 16. Color xterms *xterm-color* *color-xterm*
4476 4535
4477 Most color xterms have only eight colors. If you don't get colors with the 4536 Most color xterms have only eight colors. If you don't get colors with the
4478 default setup, it should work with these lines in your .vimrc: > 4537 default setup, it should work with these lines in your .vimrc: >
4479 :if &term =~ "xterm" 4538 :if &term =~ "xterm"