syntax.txt (262666B)
1 *syntax.txt* For Vim version 9.2. Last change: 2026 Sep 24 2 3 4 VIM REFERENCE MANUAL by Bram Moolenaar 5 6 7 Syntax highlighting *syntax* *syntax-highlighting* *coloring* 8 9 Syntax highlighting enables Vim to show parts of the text in another font or 10 color. Those parts can be specific keywords or text matching a pattern. Vim 11 doesn't parse the whole file (to keep it fast), so the highlighting has its 12 limitations. Lexical highlighting might be a better name, but since everybody 13 calls it syntax highlighting we'll stick with that. 14 15 Vim supports syntax highlighting on all terminals. But since most ordinary 16 terminals have very limited highlighting possibilities, it works best in the 17 GUI version, gvim. 18 19 In the User Manual: 20 |usr_06.txt| introduces syntax highlighting. 21 |usr_44.txt| introduces writing a syntax file. 22 23 1. Quick start |:syn-qstart| 24 2. Syntax files |:syn-files| 25 3. Syntax loading procedure |syntax-loading| 26 4. Converting to HTML |2html.vim| 27 5. Syntax file remarks |:syn-file-remarks| 28 6. Defining a syntax |:syn-define| 29 7. :syntax arguments |:syn-arguments| 30 8. Syntax patterns |:syn-pattern| 31 9. Syntax clusters |:syn-cluster| 32 10. Including syntax files |:syn-include| 33 11. Synchronizing |:syn-sync| 34 12. Listing syntax items |:syntax| 35 13. Colorschemes |color-schemes| 36 14. Highlight command |:highlight| 37 15. Linking groups |:highlight-link| 38 16. Cleaning up |:syn-clear| 39 17. Highlighting tags |tag-highlight| 40 18. Window-local syntax |:ownsyntax| 41 19. Color xterms |xterm-color| 42 20. When syntax is slow |:syntime| 43 44 {Vi does not have any of these commands} 45 46 Syntax highlighting is not available when the |+syntax| feature has been 47 disabled at compile time. 48 49 ============================================================================== 50 1. Quick start *:syn-qstart* 51 52 *:syn-enable* *:syntax-enable* 53 This command switches on syntax highlighting: > 54 55 :syntax enable 56 57 What this command actually does is to execute the command > 58 :source $VIMRUNTIME/syntax/syntax.vim 59 60 If the VIM environment variable is not set, Vim will try to find 61 the path in another way (see |$VIMRUNTIME|). Usually this works just 62 fine. If it doesn't, try setting the VIM environment variable to the 63 directory where the Vim stuff is located. For example, if your syntax files 64 are in the "/usr/vim/vim82/syntax" directory, set $VIMRUNTIME to 65 "/usr/vim/vim82". You must do this in the shell, before starting Vim. 66 This command also sources the |menu.vim| script when the GUI is running or 67 will start soon. See |'go-M'| about avoiding that. 68 69 *:syn-on* *:syntax-on* 70 The `:syntax enable` command will keep most of your current color settings. 71 This allows using `:highlight` commands to set your preferred colors before or 72 after using this command. If you want Vim to overrule your settings with the 73 defaults, use: > 74 :syntax on 75 < 76 *:hi-normal* *:highlight-normal* 77 If you are running in the GUI, you can get white text on a black background 78 with: > 79 :highlight Normal guibg=Black guifg=White 80 For a color terminal see |:hi-normal-cterm|. 81 For setting up your own colors syntax highlighting see |syncolor|. 82 83 NOTE: The syntax files on MS-Windows have lines that end in <CR><NL>. 84 The files for Unix end in <NL>. This means you should use the right type of 85 file for your system. Although on MS-Windows the right format is 86 automatically selected if the 'fileformats' option is not empty. 87 88 NOTE: When using reverse video ("gvim -fg white -bg black"), the default value 89 of 'background' will not be set until the GUI window is opened, which is after 90 reading the |gvimrc|. This will cause the wrong default highlighting to be 91 used. To set the default value of 'background' before switching on 92 highlighting, include the ":gui" command in the |gvimrc|: > 93 94 :gui " open window and set default for 'background' 95 :syntax on " start highlighting, use 'background' to set colors 96 97 NOTE: Using ":gui" in the |gvimrc| means that "gvim -f" won't start in the 98 foreground! Use ":gui -f" then. 99 100 *g:syntax_on* 101 You can toggle the syntax on/off with this command: > 102 :if exists("g:syntax_on") | syntax off | else | syntax enable | endif 103 104 To put this into a mapping, you can use: > 105 :map <F7> :if exists("g:syntax_on") <Bar> 106 \ syntax off <Bar> 107 \ else <Bar> 108 \ syntax enable <Bar> 109 \ endif <CR> 110 [using the |<>| notation, type this literally] 111 112 Details: 113 The ":syntax" commands are implemented by sourcing a file. To see exactly how 114 this works, look in the file: 115 command file ~ 116 :syntax enable $VIMRUNTIME/syntax/syntax.vim 117 :syntax on $VIMRUNTIME/syntax/syntax.vim 118 :syntax manual $VIMRUNTIME/syntax/manual.vim 119 :syntax off $VIMRUNTIME/syntax/nosyntax.vim 120 Also see |syntax-loading|. 121 122 NOTE: If displaying long lines is slow and switching off syntax highlighting 123 makes it fast, consider setting the 'synmaxcol' option to a lower value. 124 125 ============================================================================== 126 2. Syntax files *:syn-files* 127 128 The syntax and highlighting commands for one language are normally stored in 129 a syntax file. The name convention is: "{name}.vim". Where {name} is the 130 name of the language, or an abbreviation (to fit the name in 8.3 characters, 131 a requirement in case the file is used on a DOS filesystem). 132 Examples: 133 c.vim perl.vim java.vim html.vim 134 cpp.vim sh.vim csh.vim 135 136 The syntax file can contain any Ex commands, just like a vimrc file. But 137 the idea is that only commands for a specific language are included. When a 138 language is a superset of another language, it may include the other one, 139 for example, the cpp.vim file could include the c.vim file: > 140 :so $VIMRUNTIME/syntax/c.vim 141 142 The .vim files are normally loaded with an autocommand. For example: > 143 :au Syntax c runtime! syntax/c.vim 144 :au Syntax cpp runtime! syntax/cpp.vim 145 These commands are normally in the file $VIMRUNTIME/syntax/synload.vim. 146 147 148 MAKING YOUR OWN SYNTAX FILES *mysyntaxfile* 149 150 When you create your own syntax files, and you want to have Vim use these 151 automatically with ":syntax enable", do this: 152 153 1. Create your user runtime directory. You would normally use the first item 154 of the 'runtimepath' option. Example for Unix: > 155 mkdir ~/.vim 156 157 2. Create a directory in there called "syntax". For Unix: > 158 mkdir ~/.vim/syntax 159 160 3. Write the Vim syntax file. Or download one from the internet. Then write 161 it in your syntax directory. For example, for the "mine" syntax: > 162 :w ~/.vim/syntax/mine.vim 163 164 Now you can start using your syntax file manually: > 165 :set syntax=mine 166 You don't have to exit Vim to use this. 167 168 If you also want Vim to detect the type of file, see |new-filetype|. 169 170 If you are setting up a system with many users and you don't want each user 171 to add the same syntax file, you can use another directory from 'runtimepath'. 172 173 174 ADDING TO AN EXISTING SYNTAX FILE *mysyntaxfile-add* 175 176 If you are mostly satisfied with an existing syntax file, but would like to 177 add a few items or change the highlighting, follow these steps: 178 179 1. Create your user directory from 'runtimepath', see above. 180 181 2. Create a directory in there called "after/syntax". For Unix: > 182 mkdir -p ~/.vim/after/syntax 183 184 3. Write a Vim script that contains the commands you want to use. For 185 example, to change the colors for the C syntax: > 186 highlight cComment ctermfg=Green guifg=Green 187 188 4. Write that file in the "after/syntax" directory. Use the name of the 189 syntax, with ".vim" added. For our C syntax: > 190 :w ~/.vim/after/syntax/c.vim 191 192 That's it. The next time you edit a C file the Comment color will be 193 different. You don't even have to restart Vim. 194 195 If you have multiple files, you can use the filetype as the directory name. 196 All the "*.vim" files in this directory will be used, for example: 197 ~/.vim/after/syntax/c/one.vim 198 ~/.vim/after/syntax/c/two.vim 199 200 201 REPLACING AN EXISTING SYNTAX FILE *mysyntaxfile-replace* 202 203 If you don't like a distributed syntax file, or you have downloaded a new 204 version, follow the same steps as for |mysyntaxfile| above. Just make sure 205 that you write the syntax file in a directory that is early in 'runtimepath'. 206 Vim will only load the first syntax file found, assuming that it sets 207 b:current_syntax. 208 209 210 NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18* 211 212 A syntax group name is to be used for syntax items that match the same kind of 213 thing. These are then linked to a highlight group that specifies the color. 214 A syntax group name doesn't specify any color or attributes itself. 215 216 The name for a highlight or syntax group must consist of ASCII letters, 217 digits, underscores, dots, or hyphens. As a regexp: "[a-zA-Z0-9_.-]*". 218 However, Vim does not give an error when using other characters. The maximum 219 length of a group name is about 200 bytes. *E1249* 220 221 To be able to allow each user to pick their favorite set of colors, there must 222 be preferred names for highlight groups that are common for many languages. 223 These are the suggested group names (if syntax highlighting works properly 224 you can see the actual color, except for "Ignore"): 225 226 *Comment any comment 227 228 *Constant any constant 229 String a string constant: "this is a string" 230 Character a character constant: 'c', '\n' 231 Number a number constant: 234, 0xff 232 Boolean a boolean constant: TRUE, false 233 Regexp a regular expression constant: /ab*c/ 234 Float a floating point constant: 2.3e10 235 236 *Identifier any variable name 237 Function function name (also: methods for classes) 238 239 *Statement any statement 240 Conditional if, then, else, endif, switch, etc. 241 Repeat for, do, while, etc. 242 Label case, default, etc. 243 Operator "sizeof", "+", "*", etc. 244 Keyword any other keyword 245 Exception try, catch, throw 246 247 *PreProc generic Preprocessor 248 Include preprocessor #include 249 Define preprocessor #define 250 Macro same as Define 251 PreCondit preprocessor #if, #else, #endif, etc. 252 253 *Type int, long, char, etc. 254 StorageClass static, register, volatile, etc. 255 Structure struct, union, enum, etc. 256 Typedef A typedef 257 258 *Special any special symbol 259 SpecialChar special character in a constant 260 Tag you can use CTRL-] on this 261 Delimiter character that needs attention 262 SpecialComment special things inside a comment 263 Debug debugging statements 264 265 *Underlined text that stands out, HTML links 266 *Bold bold text 267 *Italic italic text 268 *BoldItalic bold and italic text 269 270 *Ignore left blank, hidden |hl-Ignore| 271 272 *Error any erroneous construct 273 274 *Todo anything that needs extra attention; mostly the 275 keywords TODO FIXME and XXX 276 277 *Added added line in a diff 278 *Changed changed line in a diff 279 *Removed removed line in a diff 280 281 The names marked with * are the preferred groups; the others are minor groups. 282 For the preferred groups, the "syntax.vim" file contains default highlighting. 283 The minor groups are linked to the preferred groups, so they get the same 284 highlighting. You can override these defaults by using ":highlight" commands 285 after sourcing the "syntax.vim" file. 286 287 Note that highlight group names are not case sensitive. "String" and "string" 288 can be used for the same group. 289 290 The following names are reserved and cannot be used as a group name: 291 NONE ALL ALLBUT contains contained 292 293 *hl-Ignore* 294 When using the Ignore group, you may also consider using the conceal 295 mechanism. See |conceal|. 296 297 ============================================================================== 298 3. Syntax loading procedure *syntax-loading* 299 300 This explains the details that happen when the command ":syntax enable" is 301 issued. When Vim initializes itself, it finds out where the runtime files are 302 located. This is used here as the variable |$VIMRUNTIME|. 303 304 ":syntax enable" and ":syntax on" do the following: 305 306 Source $VIMRUNTIME/syntax/syntax.vim 307 | 308 +- Clear out any old syntax by sourcing $VIMRUNTIME/syntax/nosyntax.vim 309 | 310 +- Source first syntax/synload.vim in 'runtimepath' 311 | | 312 | +- Setup the colors for syntax highlighting. If a color scheme is 313 | | defined it is loaded again with ":colors {name}". Otherwise 314 | | ":runtime! syntax/syncolor.vim" is used. ":syntax on" overrules 315 | | existing colors, ":syntax enable" only sets groups that weren't 316 | | set yet. 317 | | 318 | +- Set up syntax autocmds to load the appropriate syntax file when 319 | | the 'syntax' option is set. *synload-1* 320 | | 321 | +- Source the user's optional file, from the |mysyntaxfile| variable. 322 | This is for backwards compatibility with Vim 5.x only. *synload-2* 323 | 324 +- Do ":filetype on", which does ":runtime! filetype.vim". It loads any 325 | filetype.vim files found. It should always Source 326 | $VIMRUNTIME/filetype.vim, which does the following. 327 | | 328 | +- Install autocmds based on suffix to set the 'filetype' option 329 | | This is where the connection between file name and file type is 330 | | made for known file types. *synload-3* 331 | | 332 | +- Source the user's optional file, from the *myfiletypefile* 333 | | variable. This is for backwards compatibility with Vim 5.x only. 334 | | *synload-4* 335 | | 336 | +- Install one autocommand which sources scripts.vim when no file 337 | | type was detected yet. *synload-5* 338 | | 339 | +- Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. |menu.vim| 340 | 341 +- Install a FileType autocommand to set the 'syntax' option when a file 342 | type has been detected. *synload-6* 343 | 344 +- Execute syntax autocommands to start syntax highlighting for each 345 already loaded buffer. 346 347 348 Upon loading a file, Vim finds the relevant syntax file as follows: 349 350 Loading the file triggers the BufReadPost autocommands. 351 | 352 +- If there is a match with one of the autocommands from |synload-3| 353 | (known file types) or |synload-4| (user's file types), the 'filetype' 354 | option is set to the file type. 355 | 356 +- The autocommand at |synload-5| is triggered. If the file type was not 357 | found yet, then scripts.vim is searched for in 'runtimepath'. This 358 | should always load $VIMRUNTIME/scripts.vim, which does the following. 359 | | 360 | +- Source the user's optional file, from the *myscriptsfile* 361 | | variable. This is for backwards compatibility with Vim 5.x only. 362 | | 363 | +- If the file type is still unknown, check the contents of the file, 364 | again with checks like "getline(1) =~ pattern" as to whether the 365 | file type can be recognized, and set 'filetype'. 366 | 367 +- When the file type was determined and 'filetype' was set, this 368 | triggers the FileType autocommand |synload-6| above. It sets 369 | 'syntax' to the determined file type. 370 | 371 +- When the 'syntax' option was set above, this triggers an autocommand 372 | from |synload-1| (and |synload-2|). This find the main syntax file in 373 | 'runtimepath', with this command: 374 | runtime! syntax/<name>.vim 375 | 376 +- Any other user installed FileType or Syntax autocommands are 377 triggered. This can be used to change the highlighting for a specific 378 syntax. 379 380 ============================================================================== 381 4. Conversion to HTML *2html.vim* *convert-to-HTML* 382 383 2html is not a syntax file itself, but a script that converts the current 384 window into HTML. Vim opens a new window in which it builds the HTML file. 385 386 After you save the resulting file, you can view it with any browser. The 387 colors should be exactly the same as you see them in Vim. With 388 |g:html_line_ids| you can jump to specific lines by adding (for example) #L123 389 or #123 to the end of the URL in your browser's address bar. And with 390 |g:html_dynamic_folds| enabled, you can show or hide the text that is folded 391 in Vim. 392 393 You are not supposed to set the 'filetype' or 'syntax' option to "2html"! 394 Source the script to convert the current file: > 395 396 :runtime! syntax/2html.vim 397 < 398 Many variables affect the output of 2html.vim; see below. Any of the on/off 399 options listed below can be enabled or disabled by setting them explicitly to 400 the desired value, or restored to their default by removing the variable using 401 |:unlet|. 402 403 Remarks: 404 - Some truly ancient browsers may not show the background colors. 405 - From most browsers you can also print the file (in color)! 406 - Colors may be incorrect for Vim without GUI support compiled in. 407 - The latest TOhtml requires Vim 9.1 or later. 408 409 Here is an example how to run the script over all .c and .h files from a 410 Unix shell: > 411 for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done 412 < 413 *g:html_start_line* *g:html_end_line* 414 To restrict the conversion to a range of lines, use a range with the |:TOhtml| 415 command below, or set "g:html_start_line" and "g:html_end_line" to the first 416 and last line to be converted. Example, using the last set Visual area: > 417 418 :let g:html_start_line = line("'<") 419 :let g:html_end_line = line("'>") 420 :runtime! syntax/2html.vim 421 < 422 *:TOhtml* 423 :[range]TOhtml The ":TOhtml" command is defined in a standard plugin. 424 This command will source |2html.vim| for you. When a 425 range is given, this command sets |g:html_start_line| 426 and |g:html_end_line| to the start and end of the 427 range, respectively. Default range is the entire 428 buffer. 429 430 If the current window is part of a |diff|, unless 431 |g:html_diff_one_file| is set, :TOhtml will convert 432 all windows which are part of the diff in the current 433 tab and place them side-by-side in a <table> element 434 in the generated HTML. With |g:html_line_ids| you can 435 jump to lines in specific windows with (for example) 436 #W1L42 for line 42 in the first diffed window, or 437 #W3L87 for line 87 in the third. 438 439 Examples: > 440 441 :10,40TOhtml " convert lines 10-40 to html 442 :'<,'>TOhtml " convert current/last visual selection 443 :TOhtml " convert entire buffer 444 < 445 *g:html_diff_one_file* 446 Default: 0. 447 When 0, and using |:TOhtml| all windows involved in a |diff| in the current tab 448 page are converted to HTML and placed side-by-side in a <table> element. When 449 1, only the current buffer is converted. 450 Example: > 451 452 let g:html_diff_one_file = 1 453 < 454 *g:html_whole_filler* 455 Default: 0. 456 When 0, if |g:html_diff_one_file| is 1, a sequence of more than 3 filler lines 457 is displayed as three lines with the middle line mentioning the total number 458 of inserted lines. 459 When 1, always display all inserted lines as if |g:html_diff_one_file| were 460 not set. 461 > 462 :let g:html_whole_filler = 1 463 < 464 *TOhtml-performance* *g:html_no_progress* 465 Default: 0. 466 When 0, display a progress bar in the statusline for each major step in the 467 2html.vim conversion process. 468 When 1, do not display the progress bar. This offers a minor speed 469 improvement but you won't have any idea how much longer the conversion might 470 take; for big files it can take a long time! 471 Example: > 472 473 let g:html_no_progress = 1 474 < 475 You can obtain better performance improvements by also instructing Vim to not 476 run interactively, so that too much time is not taken to redraw as the script 477 moves through the buffer, switches windows, and the like: > 478 479 vim -E -s -c "let g:html_no_progress=1" -c "syntax on" -c "set ft=c" -c "runtime syntax/2html.vim" -cwqa myfile.c 480 < 481 Note that the -s flag prevents loading your .vimrc and any plugins, so you 482 need to explicitly source/enable anything that will affect the HTML 483 conversion. See |-E| and |-s-ex| for details. It is probably best to create a 484 script to replace all the -c commands and use it with the -u flag instead of 485 specifying each command separately. 486 487 *hl-TOhtmlProgress* *TOhtml-progress-color* 488 When displayed, the progress bar will show colored boxes along the statusline 489 as the HTML conversion proceeds. By default, the background color as the 490 current "DiffDelete" highlight group is used. If "DiffDelete" and 491 "StatusLine" have the same background color, TOhtml will automatically adjust 492 the color to differ. If you do not like the automatically selected colors, 493 you can define your own highlight colors for the progress bar. Example: > 494 495 hi TOhtmlProgress guifg=#c0ffee ctermbg=7 496 < 497 *g:html_number_lines* 498 Default: Current 'number' setting. 499 When 0, buffer text is displayed in the generated HTML without line numbering. 500 When 1, a column of line numbers is added to the generated HTML with the same 501 highlighting as the line number column in Vim (|hl-LineNr|). 502 Force line numbers even if 'number' is not set: > 503 :let g:html_number_lines = 1 504 Force to omit the line numbers: > 505 :let g:html_number_lines = 0 506 Go back to the default to use 'number' by deleting the variable: > 507 :unlet g:html_number_lines 508 < 509 *g:html_line_ids* 510 Default: 1 if |g:html_number_lines| is set, 0 otherwise. 511 When 1, adds an HTML id attribute to each line number, or to an empty <span> 512 inserted for that purpose if no line numbers are shown. This ID attribute 513 takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view 514 pages, and is used to jump to a specific line (in a specific window of a diff 515 view). Javascript is inserted to open any closed dynamic folds 516 (|g:html_dynamic_folds|) containing the specified line before jumping. The 517 javascript also allows omitting the window ID in the url, and the leading L. 518 For example: > 519 520 page.html#L123 jumps to line 123 in a single-buffer file 521 page.html#123 does the same 522 523 diff.html#W1L42 jumps to line 42 in the first window in a diff 524 diff.html#42 does the same 525 < 526 *g:html_use_css* 527 Default: 1. 528 When 1, generate valid HTML 5 markup with CSS styling, supported in all modern 529 browsers and many old browsers. 530 When 0, generate <font> tags and similar outdated markup. This is not 531 recommended but it may work better in really old browsers, email clients, 532 forum posts, and similar situations where basic CSS support is unavailable. 533 Example: > 534 :let g:html_use_css = 0 535 < 536 *g:html_ignore_conceal* 537 Default: 0. 538 When 0, concealed text is removed from the HTML and replaced with a character 539 from |:syn-cchar| or 'listchars' as appropriate, depending on the current 540 value of 'conceallevel'. 541 When 1, include all text from the buffer in the generated HTML, even if it is 542 |conceal|ed. 543 544 Either of the following commands will ensure that all text in the buffer is 545 included in the generated HTML (unless it is folded): > 546 :let g:html_ignore_conceal = 1 547 :setl conceallevel=0 548 < 549 *g:html_ignore_folding* 550 Default: 0. 551 When 0, text in a closed fold is replaced by the text shown for the fold in 552 Vim (|fold-foldtext|). See |g:html_dynamic_folds| if you also want to allow 553 the user to expand the fold as in Vim to see the text inside. 554 When 1, include all text from the buffer in the generated HTML; whether the 555 text is in a fold has no impact at all. |g:html_dynamic_folds| has no effect. 556 557 Either of these commands will ensure that all text in the buffer is included 558 in the generated HTML (unless it is concealed): > 559 zR 560 :let g:html_ignore_folding = 1 561 < 562 *g:html_dynamic_folds* 563 Default: 0. 564 When 0, text in a closed fold is not included at all in the generated HTML. 565 When 1, generate javascript to open a fold and show the text within, just like 566 in Vim. 567 568 Setting this variable to 1 causes 2html.vim to always use CSS for styling, 569 regardless of what |g:html_use_css| is set to. 570 571 This variable is ignored when |g:html_ignore_folding| is set. 572 > 573 :let g:html_dynamic_folds = 1 574 < 575 *g:html_no_foldcolumn* 576 Default: 0. 577 When 0, if |g:html_dynamic_folds| is 1, generate a column of text similar to 578 Vim's foldcolumn (|fold-foldcolumn|) the user can click on to toggle folds 579 open or closed. The minimum width of the generated text column is the current 580 'foldcolumn' setting. 581 When 1, do not generate this column; instead, hovering the mouse cursor over 582 folded text will open the fold as if |g:html_hover_unfold| were set. 583 > 584 :let g:html_no_foldcolumn = 1 585 < 586 *TOhtml-uncopyable-text* *g:html_prevent_copy* 587 Default: Empty string. 588 This option prevents certain regions of the generated HTML from being copied, 589 when you select all text in document rendered in a browser and copy it. 590 Useful for allowing users to copy-paste only the source text even if a fold 591 column or line numbers are shown in the generated content. Specify regions to 592 be affected in this way as follows: 593 f: fold column 594 n: line numbers (also within fold text) 595 t: fold text 596 d: diff filler 597 598 Example, to make the fold column and line numbers uncopyable: > 599 :let g:html_prevent_copy = "fn" 600 < 601 The method used to prevent copying in the generated page depends on the value 602 of |g:html_use_input_for_pc|. 603 604 *g:html_use_input_for_pc* 605 Default: "none" 606 If |g:html_prevent_copy| is non-empty, then: 607 608 When "all", read-only <input> elements are used in place of normal text for 609 uncopyable regions. In some browsers, especially older browsers, after 610 selecting an entire page and copying the selection, the <input> tags are not 611 pasted with the page text. If |g:html_no_invalid| is 0, the <input> tags have 612 invalid type; this works in more browsers, but the page will not validate. 613 Note: This method does NOT work in recent versions of Chrome and equivalent 614 browsers; the <input> tags get pasted with the text. 615 616 When "fallback" (default value), the same <input> elements are generated for 617 older browsers, but newer browsers (detected by CSS feature query) hide the 618 <input> elements and instead use generated content in an ::before 619 pseudoelement to display the uncopyable text. This method should work with 620 the largest number of browsers, both old and new. 621 622 When "none", the <input> elements are not generated at all. Only the 623 generated-content method is used. This means that old browsers, notably 624 Internet Explorer, will either copy the text intended not to be copyable, or 625 the non-copyable text may not appear at all. However, this is the most 626 standards-based method, and there will be much less markup. 627 628 *g:html_no_invalid* 629 Default: 0. 630 When 0, if |g:html_prevent_copy| is non-empty and |g:html_use_input_for_pc| is 631 not "none", an invalid attribute is intentionally inserted into the <input> 632 element for the uncopyable areas. This prevents pasting the <input> elements 633 in some applications. Specifically, some versions of Microsoft Word will not 634 paste the <input> elements if they contain this invalid attribute. When 1, no 635 invalid markup is inserted, and the generated page should validate. However, 636 <input> elements may be pasted into some applications and can be difficult to 637 remove afterward. 638 639 *g:html_hover_unfold* 640 Default: 0. 641 When 0, the only way to open a fold generated by 2html.vim with 642 |g:html_dynamic_folds| set, is to click on the generated fold column. 643 When 1, use CSS 2.0 to allow the user to open a fold by moving the mouse 644 cursor over the displayed fold text. This is useful to allow users with 645 disabled javascript to view the folded text. 646 647 Note that old browsers (notably Internet Explorer 6) will not support this 648 feature. Browser-specific markup for IE6 is included to fall back to the 649 normal CSS1 styling so that the folds show up correctly for this browser, but 650 they will not be openable without a foldcolumn. 651 > 652 :let g:html_hover_unfold = 1 653 < 654 *g:html_id_expr* 655 Default: "" 656 Dynamic folding and jumping to line IDs rely on unique IDs within the document 657 to work. If generated HTML is copied into a larger document, these IDs are no 658 longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can 659 evaluate to get a unique string to append to each ID used in a given document, 660 so that the full IDs will be unique even when combined with other content in a 661 larger HTML document. Example, to append _ and the buffer number to each ID: > 662 663 :let g:html_id_expr = '"_" .. bufnr("%")' 664 < 665 To append a string "_mystring" to the end of each ID: > 666 667 :let g:html_id_expr = '"_mystring"' 668 < 669 Note: When converting a diff view to HTML, the expression will only be 670 evaluated for the first window in the diff, and the result used for all the 671 windows. 672 673 *TOhtml-wrap-text* *g:html_pre_wrap* 674 Default: Current 'wrap' setting. 675 When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does 676 not wrap at the edge of the browser window. 677 When 1, if |g:html_use_css| is 1, the CSS 2.0 "white-space:pre-wrap" value is 678 used, causing the text to wrap at whitespace at the edge of the browser 679 window. 680 Explicitly enable text wrapping: > 681 :let g:html_pre_wrap = 1 682 Explicitly disable wrapping: > 683 :let g:html_pre_wrap = 0 684 Go back to default, determine wrapping from 'wrap' setting: > 685 :unlet g:html_pre_wrap 686 < 687 *g:html_no_pre* 688 Default: 0. 689 When 0, buffer text in the generated HTML is surrounded by <pre>...</pre> 690 tags. Series of whitespace is shown as in Vim without special markup, and tab 691 characters can be included literally (see |g:html_expand_tabs|). 692 When 1 (not recommended), the <pre> tags are omitted, and a plain <div> is 693 used instead. Whitespace is replaced by a series of character 694 references, and <br> is used to end each line. This is another way to allow 695 text in the generated HTML is wrap (see |g:html_pre_wrap|) which also works in 696 old browsers, but may cause noticeable differences between Vim's display and 697 the rendered page generated by 2html.vim. 698 > 699 :let g:html_no_pre = 1 700 < 701 *g:html_no_doc* 702 Default: 0. 703 When 1 it doesn't generate a full HTML document with a DOCTYPE, <head>, 704 <body>, etc. If |g:html_use_css| is enabled (the default) you'll have to 705 define the CSS manually. The |g:html_dynamic_folds| and |g:html_line_ids| 706 settings (off by default) also insert some JavaScript. 707 708 709 *g:html_no_links* 710 Default: 0. 711 Don't generate <a> tags for text that looks like an URL. 712 713 *g:html_no_modeline* 714 Default: 0. 715 Don't generate a modeline disabling folding. 716 717 *g:html_expand_tabs* 718 Default: 0 if 'tabstop' is 8, 'expandtab' is 0, 'vartabstop' is not in use, 719 and no fold column or line numbers occur in the generated HTML; 720 1 otherwise. 721 When 1, <Tab> characters in the buffer text are replaced with an appropriate 722 number of space characters, or references if |g:html_no_pre| is 1. 723 When 0, if |g:html_no_pre| is 0 or unset, <Tab> characters in the buffer text 724 are included as-is in the generated HTML. This is useful for when you want to 725 allow copy and paste from a browser without losing the actual whitespace in 726 the source document. Note that this can easily break text alignment and 727 indentation in the HTML, unless set by default. 728 729 Force |2html.vim| to keep <Tab> characters: > 730 :let g:html_expand_tabs = 0 731 < 732 Force tabs to be expanded: > 733 :let g:html_expand_tabs = 1 734 < 735 *TOhtml-encoding-detect* *TOhtml-encoding* 736 It is highly recommended to set your desired encoding with 737 |g:html_use_encoding| for any content which will be placed on a web server. 738 739 If you do not specify an encoding, |2html.vim| uses the preferred IANA name 740 for the current value of 'fileencoding' if set, or 'encoding' if not. 741 'encoding' is always used for certain 'buftype' values. 'fileencoding' will 742 be set to match the chosen document encoding. 743 744 Automatic detection works for the encodings mentioned specifically by name in 745 |encoding-names|, but TOhtml will only automatically use those encodings with 746 wide browser support. However, you can override this to support specific 747 encodings that may not be automatically detected by default (see options 748 below). See http://www.iana.org/assignments/character-sets for the IANA 749 names. 750 751 Note: By default all Unicode encodings are converted to UTF-8 with no BOM in 752 the generated HTML, as recommended by W3C: 753 754 http://www.w3.org/International/questions/qa-choosing-encodings 755 http://www.w3.org/International/questions/qa-byte-order-mark 756 757 *g:html_use_encoding* 758 Default: none, uses IANA name for current 'fileencoding' as above. 759 To overrule all automatic charset detection, set g:html_use_encoding to the 760 name of the charset to be used. It is recommended to set this variable to 761 something widely supported, like UTF-8, for anything you will be hosting on a 762 webserver: > 763 :let g:html_use_encoding = "UTF-8" 764 You can also use this option to omit the line that specifies the charset 765 entirely, by setting g:html_use_encoding to an empty string (NOT recommended): > 766 :let g:html_use_encoding = "" 767 To go back to the automatic mechanism, delete the |g:html_use_encoding| 768 variable: > 769 :unlet g:html_use_encoding 770 < 771 *g:html_encoding_override* 772 Default: none, autoload/tohtml.vim contains default conversions for encodings 773 mentioned by name at |encoding-names|. 774 This option allows |2html.vim| to detect the correct 'fileencoding' when you 775 specify an encoding with |g:html_use_encoding| which is not in the default 776 list of conversions. 777 778 This is a dictionary of charset-encoding pairs that will replace existing 779 pairs automatically detected by TOhtml, or supplement with new pairs. 780 781 Detect the HTML charset "windows-1252" as the encoding "8bit-cp1252": > 782 :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'} 783 < 784 *g:html_charset_override* 785 Default: none, autoload/tohtml.vim contains default conversions for encodings 786 mentioned by name at |encoding-names| and which have wide 787 browser support. 788 This option allows |2html.vim| to detect the HTML charset for any 789 'fileencoding' or 'encoding' which is not detected automatically. You can 790 also use it to override specific existing encoding-charset pairs. For 791 example, TOhtml will by default use UTF-8 for all Unicode/UCS encodings. To 792 use UTF-16 and UTF-32 instead, use: > 793 :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'} 794 795 Note that documents encoded in either UTF-32 or UTF-16 have known 796 compatibility problems with some major browsers. 797 798 *g:html_font* 799 Default: "monospace" 800 You can specify the font or fonts used in the converted document using 801 g:html_font. If this option is set to a string, then the value will be 802 surrounded with single quotes. If this option is set to a list then each list 803 item is surrounded by single quotes and the list is joined with commas. 804 Either way, "monospace" is added as the fallback generic family name and the 805 entire result used as the font family (using CSS) or font face (if not using 806 CSS). Examples: > 807 808 " font-family: 'Consolas', monospace; 809 :let g:html_font = "Consolas" 810 811 " font-family: 'DejaVu Sans Mono', 'Consolas', monospace; 812 :let g:html_font = ["DejaVu Sans Mono", "Consolas"] 813 < 814 *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml* 815 Default: 0. 816 When 0, generate standard HTML 4.01 (strict when possible). 817 When 1, generate XHTML 1.0 instead (XML compliant HTML). 818 > 819 :let g:html_use_xhtml = 1 820 < 821 ============================================================================== 822 5. Syntax file remarks *:syn-file-remarks* 823 824 *b:current_syntax-variable* 825 Vim stores the name of the syntax that has been loaded in the 826 "b:current_syntax" variable. You can use this if you want to load other 827 settings, depending on which syntax is active. Example: > 828 :au BufReadPost * if b:current_syntax == "csh" 829 :au BufReadPost * do-some-things 830 :au BufReadPost * endif 831 832 833 834 ABEL *abel.vim* *ft-abel-syntax* 835 836 ABEL highlighting provides some user-defined options. To enable them, assign 837 any value to the respective variable. Example: > 838 :let abel_obsolete_ok=1 839 To disable them use ":unlet". Example: > 840 :unlet abel_obsolete_ok 841 842 Variable Highlight ~ 843 abel_obsolete_ok obsolete keywords are statements, not errors 844 abel_cpp_comments_illegal do not interpret '//' as inline comment leader 845 846 847 ADA 848 849 See |ft-ada-syntax| 850 851 852 ALGOL 68 *algol68* *ft-algol68-syntax* 853 854 This syntax file currently targets the Algol 68 Genie project using the 855 default UPPER stropping regime. It should also be usable in other 856 environments using the UPPER stropping regime, though somewhat less complete. 857 858 Highlighting can be further configured with the following variables. 859 860 Variable Highlight ~ 861 *algol68_no_preludes* no prelude identifiers, procedures or 862 operators 863 864 865 ANT *ant.vim* *ft-ant-syntax* 866 867 The ant syntax file provides syntax highlighting for javascript and python 868 by default. Syntax highlighting for other script languages can be installed 869 by the function AntSyntaxScript(), which takes the tag name as first argument 870 and the script syntax file name as second argument. Example: > 871 872 :call AntSyntaxScript('perl', 'perl.vim') 873 874 will install syntax perl highlighting for the following ant code > 875 876 <script language = 'perl'><![CDATA[ 877 # everything inside is highlighted as perl 878 ]]></script> 879 880 See |mysyntaxfile-add| for installing script languages permanently. 881 882 883 APACHE *apache.vim* *ft-apache-syntax* 884 885 The apache syntax file provides syntax highlighting for Apache HTTP server 886 version 2.2.3. 887 888 889 *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k* 890 ASSEMBLY *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax* 891 *ft-masm-syntax* *ft-asm68k-syntax* *fasm.vim* 892 893 Files matching "*.i" could be Progress or Assembly. If the automatic 894 detection doesn't work for you, or you don't edit Progress at all, use this in 895 your startup vimrc: > 896 :let filetype_i = "asm" 897 Replace "asm" with the type of assembly you use. 898 899 There are many types of assembly languages that all use the same file name 900 extensions. Therefore you will have to select the type yourself, or add a 901 line in the assembly file that Vim will recognize. Currently these syntax 902 files are included: 903 asm GNU assembly (usually have .s or .S extension and were 904 already built using C compiler such as GCC or CLANG) 905 asm68k Motorola 680x0 assembly 906 asmh8300 Hitachi H-8300 version of GNU assembly 907 ia64 Intel Itanium 64 908 fasm Flat assembly (http://flatassembler.net) 909 masm Microsoft assembly (.masm files are compiled with 910 Microsoft's Macro Assembler. This is only supported 911 for x86, x86_64, ARM and AARCH64 CPU families) 912 nasm Netwide assembly 913 tasm Turbo Assembly (with opcodes 80x86 up to Pentium, and 914 MMX) 915 pic PIC assembly (currently for PIC16F84) 916 917 The most flexible is to add a line in your assembly file containing: > 918 asmsyntax=nasm 919 Replace "nasm" with the name of the real assembly syntax. This line must be 920 one of the first five lines in the file. No non-white text must be 921 immediately before or after this text. Note that specifying asmsyntax=foo is 922 equivalent to setting ft=foo in a |modeline|, and that in case of a conflict 923 between the two settings the one from the modeline will take precedence (in 924 particular, if you have ft=asm in the modeline, you will get the GNU syntax 925 highlighting regardless of what is specified as asmsyntax). 926 927 The syntax type can always be overruled for a specific buffer by setting the 928 b:asmsyntax variable: > 929 :let b:asmsyntax = "nasm" 930 931 If b:asmsyntax is not set, either automatically or by hand, then the value of 932 the global variable asmsyntax is used. This can be seen as a default assembly 933 language: > 934 :let asmsyntax = "nasm" 935 936 As a last resort, if nothing is defined, the "asm" syntax is used. 937 938 939 Netwide assembler (nasm.vim) optional highlighting ~ 940 941 To enable a feature: > 942 :let {variable}=1|set syntax=nasm 943 To disable a feature: > 944 :unlet {variable} |set syntax=nasm 945 946 Variable Highlight ~ 947 nasm_loose_syntax unofficial parser allowed syntax not as Error 948 (parser dependent; not recommended) 949 nasm_ctx_outside_macro contexts outside macro not as Error 950 nasm_no_warn potentially risky syntax not as ToDo 951 952 ASTRO *astro.vim* *ft-astro-syntax* 953 954 Configuration 955 956 The following variables control certain syntax highlighting features. 957 You can add them to your .vimrc. 958 959 To enable TypeScript and TSX for ".astro" files (default "disable"): > 960 let g:astro_typescript = "enable" 961 < 962 To enable Stylus for ".astro" files (default "disable"): > 963 let g:astro_stylus = "enable" 964 < 965 NOTE: You need to install an external plugin to support stylus in astro files. 966 967 968 ASPPERL *ft-aspperl-syntax* 969 ASPVBS *ft-aspvbs-syntax* 970 971 *.asp and *.asa files could be either Perl or Visual Basic script. Since it's 972 hard to detect this you can set two global variables to tell Vim what you are 973 using. For Perl script use: > 974 :let g:filetype_asa = "aspperl" 975 :let g:filetype_asp = "aspperl" 976 For Visual Basic use: > 977 :let g:filetype_asa = "aspvbs" 978 :let g:filetype_asp = "aspvbs" 979 980 ASYMPTOTE *asy.vim* *ft-asy-syntax* 981 982 By default, only basic Asymptote keywords are highlighted. To highlight 983 extended geometry keywords: > 984 985 :let g:asy_syn_plain = 1 986 987 and for highlighting keywords related to 3D constructions: > 988 989 :let g:asy_syn_three = 1 990 991 By default, Asymptote-defined colors (e.g: lightblue) are highlighted. To 992 highlight TeX-defined colors (e.g: BlueViolet) use: > 993 994 :let g:asy_syn_texcolors = 1 995 996 or for Xorg colors (e.g: AliceBlue): > 997 998 :let g:asy_syn_x11colors = 1 999 1000 BAAN *baan.vim* *baan-syntax* 1001 1002 The baan.vim gives syntax support for BaanC of release BaanIV up to SSA ERP LN 1003 for both 3 GL and 4 GL programming. Large number of standard 1004 defines/constants are supported. 1005 1006 Some special violation of coding standards will be signalled when one specify 1007 in ones |.vimrc|: > 1008 let baan_code_stds=1 1009 1010 *baan-folding* 1011 1012 Syntax folding can be enabled at various levels through the variables 1013 mentioned below (Set those in your |.vimrc|). The more complex folding on 1014 source blocks and SQL can be CPU intensive. 1015 1016 To allow any folding and enable folding at function level use: > 1017 let baan_fold=1 1018 Folding can be enabled at source block level as if, while, for ,... The 1019 indentation preceding the begin/end keywords has to match (spaces are not 1020 considered equal to a tab). > 1021 let baan_fold_block=1 1022 Folding can be enabled for embedded SQL blocks as SELECT, SELECTDO, 1023 SELECTEMPTY, ... The indentation preceding the begin/end keywords has to 1024 match (spaces are not considered equal to a tab). > 1025 let baan_fold_sql=1 1026 Note: Block folding can result in many small folds. It is suggested to |:set| 1027 the options 'foldminlines' and 'foldnestmax' in |.vimrc| or use |:setlocal| in 1028 .../after/syntax/baan.vim (see |after-directory|). Eg: > 1029 set foldminlines=5 1030 set foldnestmax=6 1031 1032 1033 BASIC *basic.vim* *vb.vim* *ft-basic-syntax* *ft-vb-syntax* 1034 1035 Both Visual Basic and "normal" BASIC use the extension ".bas". To detect 1036 which one should be used, Vim checks for the string "VB_Name" in the first 1037 five lines of the file. If it is not found, filetype will be "basic", 1038 otherwise "vb". Files with the ".frm" extension will always be seen as Visual 1039 Basic. 1040 1041 If the automatic detection doesn't work for you or you only edit, for 1042 example, FreeBASIC files, use this in your startup vimrc: > 1043 :let filetype_bas = "freebasic" 1044 1045 1046 C *c.vim* *ft-c-syntax* 1047 1048 A few things in C highlighting are optional. To enable them assign any value 1049 (including zero) to the respective variable. Example: > 1050 :let c_comment_strings = 1 1051 :let c_no_bracket_error = 0 1052 To disable them use `:unlet`. Example: > 1053 :unlet c_comment_strings 1054 Setting the value to zero doesn't work! 1055 1056 An alternative is to switch to the C++ highlighting: > 1057 :set filetype=cpp 1058 1059 Variable Highlight ~ 1060 *c_gnu* GNU gcc specific items 1061 *c_comment_strings* strings and numbers inside a comment 1062 *c_space_errors* trailing white space and spaces before a <Tab> 1063 *c_no_trail_space_error* ... but no trailing spaces 1064 *c_no_tab_space_error* ... but no spaces before a <Tab> 1065 *c_no_bracket_error* don't highlight {}; inside [] as errors 1066 *c_no_curly_error* don't highlight {}; inside [] and () as errors; 1067 ...except { and } in first column 1068 Default is to highlight them, otherwise you 1069 can't spot a missing ")". 1070 *c_curly_error* highlight a missing } by finding all pairs; this 1071 forces syncing from the start of the file, can be slow 1072 *c_no_ansi* don't do standard ANSI types and constants 1073 *c_ansi_typedefs* ... but do standard ANSI types 1074 *c_ansi_constants* ... but do standard ANSI constants 1075 *c_no_utf* don't highlight \u and \U in strings 1076 *c_syntax_for_h* use C syntax for *.h files instead of C++/ObjC/ObjC++ 1077 (NOTE: This variable is deprecated and no longer 1078 necessary, as *.h files now default to C, unless the 1079 file contains C++ or Objective-C syntax. If the 1080 automated detection fails, the default filetype can 1081 be adjusted using `g:filetype_h`.) 1082 *c_no_if0* don't highlight "#if 0" blocks as comments 1083 *c_no_cformat* don't highlight %-formats in strings 1084 *c_no_c99* don't highlight C99 standard items 1085 *c_no_c11* don't highlight C11 standard items 1086 *c_no_c23* don't highlight C23 standard items 1087 *c_no_c29* don't highlight C29 standard items 1088 *c_no_bsd* don't highlight BSD specific types 1089 *c_functions* highlight function calls and definitions 1090 *c_function_pointers* highlight function pointers definitions 1091 1092 When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will 1093 become a fold. If you don't want comments to become a fold use: > 1094 :let c_no_comment_fold = 1 1095 "#if 0" blocks are also folded, unless: > 1096 :let c_no_if0_fold = 1 1097 1098 If you notice highlighting errors while scrolling backwards, which are fixed 1099 when redrawing with CTRL-L, try setting the "c_minlines" internal variable 1100 to a larger number: > 1101 :let c_minlines = 100 1102 This will make the syntax synchronization start 100 lines before the first 1103 displayed line. The default value is 50 (15 when c_no_if0 is set). The 1104 disadvantage of using a larger number is that redrawing can become slow. 1105 1106 When using the "#if 0" / "#endif" comment highlighting, notice that this only 1107 works when the "#if 0" is within "c_minlines" from the top of the window. If 1108 you have a long "#if 0" construct it will not be highlighted correctly. 1109 1110 To match extra items in comments, use the cCommentGroup cluster. 1111 Example: > 1112 :au Syntax c call MyCadd() 1113 :function MyCadd() 1114 : syn keyword cMyItem contained Ni 1115 : syn cluster cCommentGroup add=cMyItem 1116 : hi link cMyItem Title 1117 :endfun 1118 1119 ANSI constants will be highlighted with the "cConstant" group. This includes 1120 "NULL", "SIG_IGN" and others. But not "TRUE", for example, because this is 1121 not in the ANSI standard. If you find this confusing, remove the cConstant 1122 highlighting: > 1123 :hi link cConstant NONE 1124 1125 If you see '{' and '}' highlighted as an error where they are OK, reset the 1126 highlighting for cErrInParen and cErrInBracket. 1127 1128 If you want to use folding in your C files, you can add these lines in a file 1129 in the "after" directory in 'runtimepath'. For Unix this would be 1130 ~/.vim/after/syntax/c.vim. > 1131 syn sync fromstart 1132 set foldmethod=syntax 1133 1134 CANGJIE *cangjie.vim* *ft-cangjie-syntax* 1135 1136 This file provides syntax highlighting for the Cangjie programming language, a 1137 new-generation language oriented to full-scenario intelligence. 1138 1139 All highlighting is enabled by default. To disable highlighting for a 1140 specific group, set the corresponding variable to 0 in your |vimrc|. 1141 All options to disable highlighting are: > 1142 :let g:cangjie_builtin_color = 0 1143 :let g:cangjie_comment_color = 0 1144 :let g:cangjie_identifier_color = 0 1145 :let g:cangjie_keyword_color = 0 1146 :let g:cangjie_macro_color = 0 1147 :let g:cangjie_number_color = 0 1148 :let g:cangjie_operator_color = 0 1149 :let g:cangjie_string_color = 0 1150 :let g:cangjie_type_color = 0 1151 1152 CH *ch.vim* *ft-ch-syntax* 1153 1154 C/C++ interpreter. Ch has similar syntax highlighting to C and builds upon 1155 the C syntax file. See |c.vim| for all the settings that are available for C. 1156 1157 By setting a variable you can tell Vim to use Ch syntax for *.h files, instead 1158 of C or C++: > 1159 :let g:filetype_h = 'ch' 1160 1161 NOTE: In previous versions of Vim, the following (now-deprecated) variable was 1162 used, but is no longer the preferred approach: > 1163 :let ch_syntax_for_h = 1 1164 1165 CHILL *chill.vim* *ft-chill-syntax* 1166 1167 Chill syntax highlighting is similar to C. See |c.vim| for all the settings 1168 that are available. Additionally there is: 1169 1170 chill_space_errors like c_space_errors 1171 chill_comment_string like c_comment_strings 1172 chill_minlines like c_minlines 1173 1174 1175 CHANGELOG *changelog.vim* *ft-changelog-syntax* 1176 1177 ChangeLog supports highlighting spaces at the start of a line. 1178 If you do not like this, add following line to your .vimrc: > 1179 let g:changelog_spacing_errors = 0 1180 This works the next time you edit a changelog file. You can also use 1181 "b:changelog_spacing_errors" to set this per buffer (before loading the syntax 1182 file). 1183 1184 You can change the highlighting used, e.g., to flag the spaces as an error: > 1185 :hi link ChangelogError Error 1186 Or to avoid the highlighting: > 1187 :hi link ChangelogError NONE 1188 This works immediately. 1189 1190 1191 CLOJURE *ft-clojure-syntax* 1192 1193 *g:clojure_syntax_keywords* 1194 1195 Syntax highlighting of public vars in "clojure.core" is provided by default, 1196 but additional symbols can be highlighted by adding them to the 1197 |g:clojure_syntax_keywords| variable. The value should be a |Dictionary| of 1198 syntax group names, each containing a |List| of identifiers. 1199 > 1200 let g:clojure_syntax_keywords = { 1201 \ 'clojureMacro': ["defproject", "defcustom"], 1202 \ 'clojureFunc': ["string/join", "string/replace"] 1203 \ } 1204 < 1205 Refer to the Clojure syntax script for valid syntax group names. 1206 1207 There is also *b:clojure_syntax_keywords* which is a buffer-local variant of 1208 this variable intended for use by plugin authors to highlight symbols 1209 dynamically. 1210 1211 By setting the *b:clojure_syntax_without_core_keywords* variable, vars from 1212 "clojure.core" will not be highlighted by default. This is useful for 1213 namespaces that have set `(:refer-clojure :only [])` 1214 1215 1216 *g:clojure_fold* 1217 1218 Setting |g:clojure_fold| to `1` will enable the folding of Clojure code. Any 1219 list, vector or map that extends over more than one line can be folded using 1220 the standard Vim |fold-commands|. 1221 1222 1223 *g:clojure_discard_macro* 1224 1225 Set this variable to `1` to enable basic highlighting of Clojure's "discard 1226 reader macro". 1227 > 1228 #_(defn foo [x] 1229 (println x)) 1230 < 1231 Note that this option will not correctly highlight stacked discard macros 1232 (e.g. `#_#_`). 1233 1234 1235 COBOL *cobol.vim* *ft-cobol-syntax* 1236 1237 COBOL highlighting has different needs for legacy code than it does for fresh 1238 development. This is due to differences in what is being done (maintenance 1239 versus development) and other factors. To enable legacy code highlighting, 1240 add this line to your .vimrc: > 1241 :let cobol_legacy_code = 1 1242 To disable it again, use this: > 1243 :unlet cobol_legacy_code 1244 1245 1246 COLD FUSION *coldfusion.vim* *ft-coldfusion-syntax* 1247 1248 The ColdFusion has its own version of HTML comments. To turn on ColdFusion 1249 comment highlighting, add the following line to your startup file: > 1250 1251 :let html_wrong_comments = 1 1252 1253 The ColdFusion syntax file is based on the HTML syntax file. 1254 1255 1256 CPP *cpp.vim* *ft-cpp-syntax* 1257 1258 Most things are the same as |ft-c-syntax|. 1259 1260 Variable Highlight ~ 1261 cpp_no_cpp11 don't highlight C++11 standard items 1262 cpp_no_cpp14 don't highlight C++14 standard items 1263 cpp_no_cpp17 don't highlight C++17 standard items 1264 cpp_no_cpp20 don't highlight C++20 standard items 1265 cpp_no_cpp23 don't highlight C++23 standard items 1266 cpp_no_cpp26 don't highlight C++26 standard items 1267 1268 1269 CSH *csh.vim* *ft-csh-syntax* 1270 1271 This covers the shell named "csh". Note that on some systems tcsh is actually 1272 used. 1273 1274 Detecting whether a file is csh or tcsh is notoriously hard. Some systems 1275 symlink /bin/csh to /bin/tcsh, making it almost impossible to distinguish 1276 between csh and tcsh. In case VIM guesses wrong you can set the 1277 "filetype_csh" variable. For using csh: *g:filetype_csh* 1278 > 1279 :let g:filetype_csh = "csh" 1280 1281 For using tcsh: > 1282 1283 :let g:filetype_csh = "tcsh" 1284 1285 Any script with a tcsh extension or a standard tcsh filename (.tcshrc, 1286 tcsh.tcshrc, tcsh.login) will have filetype tcsh. All other tcsh/csh scripts 1287 will be classified as tcsh, UNLESS the "filetype_csh" variable exists. If the 1288 "filetype_csh" variable exists, the filetype will be set to the value of the 1289 variable. 1290 1291 CSV *ft-csv-syntax* 1292 1293 If you change the delimiter of a CSV file, its syntax highlighting will no 1294 longer match the changed file content. You will need to unlet the following 1295 variable: > 1296 1297 :unlet b:csv_delimiter 1298 1299 And afterwards save and reload the file: > 1300 1301 :w 1302 :e 1303 1304 Now the syntax engine should determine the newly changed CSV delimiter. 1305 1306 1307 CYNLIB *cynlib.vim* *ft-cynlib-syntax* 1308 1309 Cynlib files are C++ files that use the Cynlib class library to enable 1310 hardware modelling and simulation using C++. Typically Cynlib files have a 1311 .cc or a .cpp extension, which makes it very difficult to distinguish them 1312 from a normal C++ file. Thus, to enable Cynlib highlighting for .cc files, 1313 add this line to your .vimrc file: > 1314 1315 :let cynlib_cyntax_for_cc=1 1316 1317 Similarly for cpp files (this extension is only usually used in Windows) > 1318 1319 :let cynlib_cyntax_for_cpp=1 1320 1321 To disable these again, use this: > 1322 1323 :unlet cynlib_cyntax_for_cc 1324 :unlet cynlib_cyntax_for_cpp 1325 < 1326 1327 CWEB *cweb.vim* *ft-cweb-syntax* 1328 1329 Files matching "*.w" could be Progress or cweb. If the automatic detection 1330 doesn't work for you, or you don't edit Progress at all, use this in your 1331 startup vimrc: > 1332 :let filetype_w = "cweb" 1333 1334 CSHARP *cs.vim* *ft-cs-syntax* 1335 1336 C# raw string literals may use any number of quote marks to encapsulate the 1337 block, and raw interpolated string literals may use any number of braces to 1338 encapsulate the interpolation, e.g. > 1339 1340 $$$""""Hello {{{name}}}"""" 1341 < 1342 By default, Vim highlights 3-8 quote marks, and 1-8 interpolation braces. 1343 The maximum numbers of quotes and braces recognized can configured using the 1344 following variables: 1345 1346 Variable Default ~ 1347 g:cs_raw_string_quote_count 8 1348 g:cs_raw_string_interpolation_brace_count 8 1349 1350 DART *dart.vim* *ft-dart-syntax* 1351 1352 Dart is an object-oriented, typed, class defined, garbage collected language 1353 used for developing mobile, desktop, web, and back-end applications. Dart 1354 uses a C-like syntax derived from C, Java, and JavaScript, with features 1355 adopted from Smalltalk, Python, Ruby, and others. 1356 1357 More information about the language and its development environment at the 1358 official Dart language website at https://dart.dev 1359 1360 dart.vim syntax detects and highlights Dart statements, reserved words, 1361 type declarations, storage classes, conditionals, loops, interpolated values, 1362 and comments. There is no support idioms from Flutter or any other Dart 1363 framework. 1364 1365 Changes, fixes? Submit an issue or pull request via: 1366 1367 https://github.com/pr3d4t0r/dart-vim-syntax/ 1368 1369 1370 DESKTOP *desktop.vim* *ft-desktop-syntax* 1371 1372 Primary goal of this syntax file is to highlight .desktop and .directory files 1373 according to freedesktop.org standard: 1374 https://specifications.freedesktop.org/desktop-entry-spec/latest/ 1375 To highlight nonstandard extensions that does not begin with X-, set > 1376 let g:desktop_enable_nonstd = 1 1377 Note that this may cause wrong highlight. 1378 To highlight KDE-reserved features, set > 1379 let g:desktop_enable_kde = 1 1380 g:desktop_enable_kde follows g:desktop_enable_nonstd if not supplied 1381 1382 1383 DIFF *diff.vim* 1384 1385 The diff highlighting normally finds translated headers. This can be slow if 1386 there are very long lines in the file. To disable translations: > 1387 1388 :let diff_translations = 0 1389 1390 Also see |diff-slow|. 1391 1392 DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* 1393 1394 The dircolors utility highlighting definition has one option. It exists to 1395 provide compatibility with the Slackware GNU/Linux distributions version of 1396 the command. It adds a few keywords that are generally ignored by most 1397 versions. On Slackware systems, however, the utility accepts the keywords and 1398 uses them for processing. To enable the Slackware keywords add the following 1399 line to your startup file: > 1400 let dircolors_is_slackware = 1 1401 1402 1403 DOCBOOK *docbk.vim* *ft-docbk-syntax* *docbook* 1404 DOCBOOK XML *docbkxml.vim* *ft-docbkxml-syntax* 1405 DOCBOOK SGML *docbksgml.vim* *ft-docbksgml-syntax* 1406 1407 There are two types of DocBook files: SGML and XML. To specify what type you 1408 are using the "b:docbk_type" variable should be set. Vim does this for you 1409 automatically if it can recognize the type. When Vim can't guess it the type 1410 defaults to XML. 1411 You can set the type manually: > 1412 :let b:docbk_type = "sgml" 1413 or: > 1414 :let b:docbk_type = "xml" 1415 You need to do this before loading the syntax file, which is complicated. 1416 Simpler is setting the filetype to "docbkxml" or "docbksgml": > 1417 :set filetype=docbksgml 1418 or: > 1419 :set filetype=docbkxml 1420 1421 You can specify the DocBook version for the current buffer: > 1422 :let b:docbk_ver = 3 1423 When "b:docbk_ver" is not set, "g:docbk_ver" is used as a global fallback: > 1424 :let g:docbk_ver = 3 1425 When neither variable is set, version 4 is used. 1426 1427 1428 DOSBATCH *dosbatch.vim* *ft-dosbatch-syntax* 1429 1430 Select the set of Windows Command interpreter extensions that should be 1431 supported with the variable dosbatch_cmdextversion. For versions of Windows 1432 NT (before Windows 2000) this should have the value of 1. For Windows 2000 1433 and later it should be 2. 1434 Select the version you want with the following line: > 1435 1436 :let dosbatch_cmdextversion = 1 1437 1438 If this variable is not defined it defaults to a value of 2 to support 1439 Windows 2000 and later. 1440 1441 The original MS-DOS supports an idiom of using a double colon (::) as an 1442 alternative way to enter a comment line. This idiom can be used with the 1443 current Windows Command Interpreter, but it can lead to problems when used 1444 inside ( ... ) command blocks. You can find a discussion about this on 1445 Stack Overflow - 1446 1447 https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files 1448 1449 To allow the use of the :: idiom for comments in command blocks with the 1450 Windows Command Interpreter set the dosbatch_colons_comment variable to 1451 anything: > 1452 1453 :let dosbatch_colons_comment = 1 1454 1455 If this variable is set then a :: comment that is the last line in a command 1456 block will be highlighted as an error. 1457 1458 There is an option that covers whether *.btm files should be detected as type 1459 "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter 1460 is used by default. You may select the former with the following line: > 1461 1462 :let g:dosbatch_syntax_for_btm = 1 1463 1464 If this variable is undefined or zero, btm syntax is selected. 1465 1466 1467 DOXYGEN *doxygen.vim* *doxygen-syntax* 1468 1469 Doxygen generates code documentation using a special documentation format 1470 (similar to Javadoc). This syntax script adds doxygen highlighting to c, cpp, 1471 idl and php files, and should also work with java. 1472 1473 There are a few of ways to turn on doxygen formatting. It can be done 1474 explicitly or in a modeline by appending '.doxygen' to the syntax of the file. 1475 Example: > 1476 :set syntax=c.doxygen 1477 or > 1478 // vim:syntax=c.doxygen 1479 1480 It can also be done automatically for C, C++, C#, IDL and PHP files by setting 1481 the global or buffer-local variable load_doxygen_syntax. This is done by 1482 adding the following to your .vimrc. > 1483 :let g:load_doxygen_syntax=1 1484 1485 There are a couple of variables that have an effect on syntax highlighting, 1486 and are to do with non-standard highlighting options. 1487 1488 Variable Default Effect ~ 1489 g:doxygen_enhanced_color 1490 g:doxygen_enhanced_colour 0 Use non-standard highlighting for 1491 doxygen comments. 1492 1493 doxygen_my_rendering 0 Disable rendering of HTML bold, italic 1494 and html_my_rendering underline. 1495 1496 doxygen_javadoc_autobrief 1 Set to 0 to disable javadoc autobrief 1497 colour highlighting. 1498 1499 doxygen_end_punctuation '[.]' Set to regexp match for the ending 1500 punctuation of brief 1501 1502 There are also some highlight groups worth mentioning as they can be useful in 1503 configuration. 1504 1505 Highlight Effect ~ 1506 doxygenErrorComment The colour of an end-comment when missing 1507 punctuation in a code, verbatim or dot section 1508 doxygenLinkError The colour of an end-comment when missing the 1509 \endlink from a \link section. 1510 1511 1512 DTD *dtd.vim* *ft-dtd-syntax* 1513 1514 The DTD syntax highlighting is case sensitive by default. To disable 1515 case-sensitive highlighting, add the following line to your startup file: > 1516 1517 :let dtd_ignore_case=1 1518 1519 The DTD syntax file will highlight unknown tags as errors. If 1520 this is annoying, it can be turned off by setting: > 1521 1522 :let dtd_no_tag_errors=1 1523 1524 before sourcing the dtd.vim syntax file. 1525 Parameter entity names are highlighted in the definition using the 1526 'Type' highlighting group and 'Comment' for punctuation and '%'. 1527 Parameter entity instances are highlighted using the 'Constant' 1528 highlighting group and the 'Type' highlighting group for the 1529 delimiters % and ;. This can be turned off by setting: > 1530 1531 :let dtd_no_param_entities=1 1532 1533 The DTD syntax file is also included by xml.vim to highlight included dtd's. 1534 1535 1536 EIFFEL *eiffel.vim* *ft-eiffel-syntax* 1537 1538 While Eiffel is not case-sensitive, its style guidelines are, and the 1539 syntax highlighting file encourages their use. This also allows to 1540 highlight class names differently. If you want to disable case-sensitive 1541 highlighting, add the following line to your startup file: > 1542 1543 :let eiffel_ignore_case=1 1544 1545 Case still matters for class names and TODO marks in comments. 1546 1547 Conversely, for even stricter checks, add one of the following lines: > 1548 1549 :let eiffel_strict=1 1550 :let eiffel_pedantic=1 1551 1552 Setting eiffel_strict will only catch improper capitalization for the 1553 five predefined words "Current", "Void", "Result", "Precursor", and 1554 "NONE", to warn against their accidental use as feature or class names. 1555 1556 Setting eiffel_pedantic will enforce adherence to the Eiffel style 1557 guidelines fairly rigorously (like arbitrary mixes of upper- and 1558 lowercase letters as well as outdated ways to capitalize keywords). 1559 1560 If you want to use the lower-case version of "Current", "Void", 1561 "Result", and "Precursor", you can use > 1562 1563 :let eiffel_lower_case_predef=1 1564 1565 instead of completely turning case-sensitive highlighting off. 1566 1567 Support for ISE's proposed new creation syntax that is already 1568 experimentally handled by some compilers can be enabled by: > 1569 1570 :let eiffel_ise=1 1571 1572 Finally, some vendors support hexadecimal constants. To handle them, add > 1573 1574 :let eiffel_hex_constants=1 1575 1576 to your startup file. 1577 1578 1579 EUPHORIA *euphoria3.vim* *euphoria4.vim* *ft-euphoria-syntax* 1580 1581 Two syntax highlighting files exist for Euphoria. One for Euphoria 1582 version 3.1.1, which is the default syntax highlighting file, and one for 1583 Euphoria version 4.0.5 or later. 1584 1585 Euphoria version 3.1.1 (http://www.rapideuphoria.com/ link seems dead) is 1586 still necessary for developing applications for the DOS platform, which 1587 Euphoria version 4 (http://www.openeuphoria.org/) does not support. 1588 1589 The following file extensions are auto-detected as Euphoria file type: 1590 1591 *.e, *.eu, *.ew, *.ex, *.exu, *.exw 1592 *.E, *.EU, *.EW, *.EX, *.EXU, *.EXW 1593 1594 To select syntax highlighting file for Euphoria, as well as for 1595 auto-detecting the *.e and *.E file extensions as Euphoria file type, 1596 add the following line to your startup file: > 1597 1598 :let g:filetype_euphoria = "euphoria3" 1599 1600 < or > 1601 1602 :let g:filetype_euphoria = "euphoria4" 1603 1604 Elixir and Euphoria share the *.ex file extension. If the filetype is 1605 specifically set as Euphoria with the g:filetype_euphoria variable, or the 1606 file is determined to be Euphoria based on keywords in the file, then the 1607 filetype will be set as Euphoria. Otherwise, the filetype will default to 1608 Elixir. 1609 1610 1611 ERLANG *erlang.vim* *ft-erlang-syntax* 1612 1613 Erlang is a functional programming language developed by Ericsson. Files with 1614 the following extensions are recognized as Erlang files: erl, hrl, yaws. 1615 1616 Vim highlights triple-quoted docstrings as comments by default. 1617 1618 If you want triple-quoted docstrings highlighted as Markdown, add the 1619 following line to your |.vimrc|: > 1620 1621 :let g:erlang_use_markdown_for_docs = 1 1622 1623 The plain text inside the docstrings (that is, the characters that are not 1624 highlighted by the Markdown syntax) is still highlighted as a comment. 1625 1626 If you want to highlight the plain text inside the docstrings using a 1627 different highlight group, add the following line to your |.vimrc| (the 1628 example highlights plain text using the String highlight group): > 1629 1630 :let g:erlang_docstring_default_highlight = 'String' 1631 1632 If you don't enable Markdown, this line highlights the full docstrings 1633 according to the specified highlight group. 1634 1635 Use the following line to disable highlighting for the plain text: > 1636 1637 :let g:erlang_docstring_default_highlight = '' 1638 1639 Configuration examples: > 1640 1641 " Highlight docstrings as Markdown. 1642 :let g:erlang_use_markdown_for_docs = 1 1643 1644 " 1. Highlight Markdown elements in docstrings as Markdown. 1645 " 2. Highlight the plain text in docstrings as String. 1646 :let g:erlang_use_markdown_for_docs = 1 1647 :let g:erlang_docstring_default_highlight = 'String' 1648 1649 " Highlight docstrings as strings (no Markdown). 1650 :let g:erlang_docstring_default_highlight = 'String' 1651 1652 " 1. Highlight Markdown elements in docstrings as Markdown. 1653 " 2. Don't highlight the plain text in docstrings. 1654 :let g:erlang_use_markdown_for_docs = 1 1655 :let g:erlang_docstring_default_highlight = '' 1656 < 1657 1658 ELIXIR *elixir.vim* *ft-elixir-syntax* 1659 1660 Elixir is a dynamic, functional language for building scalable and 1661 maintainable applications. 1662 1663 The following file extensions are auto-detected as Elixir file types: 1664 1665 *.ex, *.exs, *.eex, *.leex, *.lock 1666 1667 Elixir and Euphoria share the *.ex file extension. If the filetype is 1668 specifically set as Euphoria with the g:filetype_euphoria variable, or the 1669 file is determined to be Euphoria based on keywords in the file, then the 1670 filetype will be set as Euphoria. Otherwise, the filetype will default to 1671 Elixir. 1672 1673 1674 FLEXWIKI *flexwiki.vim* *ft-flexwiki-syntax* 1675 1676 FlexWiki is an ASP.NET-based wiki package which used to be available at 1677 www.flexwiki.com 1678 NOTE: This site currently doesn't work, on Wikipedia is mentioned that 1679 development stopped in 2009. 1680 1681 Syntax highlighting is available for the most common elements of FlexWiki 1682 syntax. The associated ftplugin script sets some buffer-local options to make 1683 editing FlexWiki pages more convenient. FlexWiki considers a newline as the 1684 start of a new paragraph, so the ftplugin sets 'tw'=0 (unlimited line length), 1685 'wrap' (wrap long lines instead of using horizontal scrolling), 'linebreak' 1686 (to wrap at a character in 'breakat' instead of at the last char on screen), 1687 and so on. It also includes some keymaps that are disabled by default. 1688 1689 If you want to enable the keymaps that make "j" and "k" and the cursor keys 1690 move up and down by display lines, add this to your .vimrc: > 1691 :let flexwiki_maps = 1 1692 1693 1694 FORM *form.vim* *ft-form-syntax* 1695 1696 The coloring scheme for syntax elements in the FORM file uses the default 1697 modes Conditional, Number, Statement, Comment, PreProc, Type, and String, 1698 following the language specifications in 'Symbolic Manipulation with FORM' by 1699 J.A.M. Vermaseren, CAN, Netherlands, 1991. 1700 1701 If you want to include your own changes to the default colors, you have to 1702 redefine the following syntax groups: 1703 1704 - formConditional 1705 - formNumber 1706 - formStatement 1707 - formHeaderStatement 1708 - formComment 1709 - formPreProc 1710 - formDirective 1711 - formType 1712 - formString 1713 1714 Note that the form.vim syntax file implements FORM preprocessor commands and 1715 directives per default in the same syntax group. 1716 1717 A predefined enhanced color mode for FORM is available to distinguish between 1718 header statements and statements in the body of a FORM program. To activate 1719 this mode define the following variable in your vimrc file > 1720 1721 :let form_enhanced_color=1 1722 1723 The enhanced mode also takes advantage of additional color features for a dark 1724 gvim display. Here, statements are colored LightYellow instead of Yellow, and 1725 conditionals are LightBlue for better distinction. 1726 1727 Both Visual Basic and FORM use the extension ".frm". To detect which one 1728 should be used, Vim checks for the string "VB_Name" in the first five lines of 1729 the file. If it is found, filetype will be "vb", otherwise "form". 1730 1731 If the automatic detection doesn't work for you or you only edit, for 1732 example, FORM files, use this in your startup vimrc: > 1733 :let filetype_frm = "form" 1734 1735 1736 FORTH *forth.vim* *ft-forth-syntax* 1737 1738 Files matching "*.f" could be Fortran or Forth and those matching "*.fs" could 1739 be F# or Forth. If the automatic detection doesn't work for you, or you don't 1740 edit F# or Fortran at all, use this in your startup vimrc: > 1741 :let filetype_f = "forth" 1742 :let filetype_fs = "forth" 1743 1744 1745 FORTRAN *fortran.vim* *ft-fortran-syntax* 1746 1747 Default highlighting and dialect ~ 1748 Vim highlights according to Fortran 2023 (the most recent standard). This 1749 choice should be appropriate for most users most of the time because Fortran 1750 2023 is almost a superset of previous versions (Fortran 2018, 2008, 2003, 95, 1751 90, 77, and 66). A few legacy constructs deleted or declared obsolescent, 1752 respectively, in recent Fortran standards are highlighted as errors and todo 1753 items. 1754 1755 The syntax script no longer supports Fortran dialects. The variable 1756 fortran_dialect is now silently ignored. Since computers are much faster now, 1757 the variable fortran_more_precise is no longer needed and is silently ignored. 1758 1759 Fortran source code form ~ 1760 Fortran code can be in either fixed or free source form. Note that the 1761 syntax highlighting will not be correct if the form is incorrectly set. 1762 1763 When you create a new Fortran file, the syntax script assumes fixed source 1764 form. If you always use free source form, then > 1765 :let fortran_free_source=1 1766 in your .vimrc prior to the :syntax on command. If you always use fixed 1767 source form, then > 1768 :let fortran_fixed_source=1 1769 in your .vimrc prior to the :syntax on command. 1770 1771 If the form of the source code depends, in a non-standard way, upon the file 1772 extension, then it is most convenient to set fortran_free_source in a ftplugin 1773 file. For more information on ftplugin files, see |ftplugin|. Note that this 1774 will work only if the "filetype plugin indent on" command precedes the "syntax 1775 on" command in your .vimrc file. 1776 1777 When you edit an existing Fortran file, the syntax script will assume free 1778 source form if the fortran_free_source variable has been set, and assumes 1779 fixed source form if the fortran_fixed_source variable has been set. Suppose 1780 neither of these variables have been set. In that case, the syntax script 1781 attempts to determine which source form has been used by examining the file 1782 extension using conventions common to the ifort, gfortran, Cray, NAG, and 1783 PathScale compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 1784 for free-source). No default is used for the .fpp and .ftn file extensions 1785 because different compilers treat them differently. If none of this works, 1786 then the script examines the first five columns of the first 500 lines of your 1787 file. If no signs of free source form are detected, then the file is assumed 1788 to be in fixed source form. The algorithm should work in the vast majority of 1789 cases. In some cases, such as a file that begins with 500 or more full-line 1790 comments, the script may incorrectly decide that the code is in fixed form. 1791 If that happens, just add a non-comment statement beginning anywhere in the 1792 first five columns of the first twenty-five lines, save (:w), and then reload 1793 (:e!) the file. 1794 1795 Vendor extensions ~ 1796 Fixed-form Fortran requires a maximum line length of 72 characters but the 1797 script allows a maximum line length of 80 characters as do all compilers 1798 created in the last three decades. An even longer line length of 132 1799 characters is allowed if you set the variable fortran_extended_line_length 1800 with a command such as > 1801 :let fortran_extended_line_length=1 1802 placed prior to the :syntax on command. 1803 1804 If you want additional highlighting of the CUDA Fortran extensions, you should 1805 set the variable fortran_CUDA with a command such as > 1806 :let fortran_CUDA=1 1807 placed prior to the :syntax on command. 1808 1809 To activate recognition of some common, non-standard, vendor-supplied 1810 intrinsics, you should set the variable fortran_vendor_intrinsics with a 1811 command such as > 1812 :let fortran_vendor_intrinsics=1 1813 placed prior to the :syntax on command. 1814 1815 Tabs in Fortran files ~ 1816 Tabs are not recognized by the Fortran standards. Tabs are not a good idea in 1817 fixed format Fortran source code which requires fixed column boundaries. 1818 Therefore, tabs are marked as errors. Nevertheless, some programmers like 1819 using tabs. If your Fortran files contain tabs, then you should set the 1820 variable fortran_have_tabs in your .vimrc with a command such as > 1821 :let fortran_have_tabs=1 1822 placed prior to the :syntax on command. Unfortunately, the use of tabs will 1823 mean that the syntax file will not be able to detect incorrect margins. 1824 1825 Syntax folding of Fortran files ~ 1826 Vim will fold your file using foldmethod=syntax, if you set the variable 1827 fortran_fold in your .vimrc with a command such as > 1828 :let fortran_fold=1 1829 to instruct the syntax script to define fold regions for program units, that 1830 is main programs starting with a program statement, subroutines, function 1831 subprograms, modules, submodules, blocks of comment lines, and block data 1832 units. Block, interface, associate, critical, type definition, and change 1833 team constructs will also be folded. If you also set the variable 1834 fortran_fold_conditionals with a command such as > 1835 :let fortran_fold_conditionals=1 1836 then fold regions will also be defined for do loops, if blocks, select case, 1837 select type, and select rank constructs. Note that defining fold regions can 1838 be slow for large files. 1839 1840 The syntax/fortran.vim script contains embedded comments that tell you how to 1841 comment and/or uncomment some lines to (a) activate recognition of some 1842 non-standard, vendor-supplied intrinsics and (b) to prevent features deleted 1843 or declared obsolescent in the 2008 standard from being highlighted as todo 1844 items. 1845 1846 Limitations ~ 1847 Parenthesis checking does not catch too few closing parentheses. Hollerith 1848 strings are not recognized. Some keywords may be highlighted incorrectly 1849 because Fortran90 has no reserved words. 1850 1851 For further information related to Fortran, see |ft-fortran-indent| and 1852 |ft-fortran-plugin|. 1853 1854 FREEBASIC *freebasic.vim* *ft-freebasic-syntax* 1855 1856 FreeBASIC files will be highlighted differently for each of the four available 1857 dialects, "fb", "qb", "fblite" and "deprecated". See |ft-freebasic-plugin| 1858 for how to select the correct dialect. 1859 1860 Highlighting is further configurable via the following variables. 1861 1862 Variable Highlight ~ 1863 *freebasic_no_comment_fold* disable multiline comment folding 1864 *freebasic_operators* non-alpha operators 1865 *freebasic_space_errors* trailing white space and spaces before a <Tab> 1866 *freebasic_type_suffixes* QuickBASIC style type suffixes 1867 1868 1869 1870 FVWM CONFIGURATION FILES *fvwm.vim* *ft-fvwm-syntax* 1871 1872 In order for Vim to recognize Fvwm configuration files that do not match 1873 the patterns *fvwmrc* or *fvwm2rc* , you must put additional patterns 1874 appropriate to your system in your myfiletypes.vim file. For these 1875 patterns, you must set the variable "b:fvwm_version" to the major version 1876 number of Fvwm, and the 'filetype' option to fvwm. 1877 1878 For example, to make Vim identify all files in /etc/X11/fvwm2/ 1879 as Fvwm2 configuration files, add the following: > 1880 1881 :au! BufNewFile,BufRead /etc/X11/fvwm2/* let b:fvwm_version = 2 | 1882 \ set filetype=fvwm 1883 1884 GSP *gsp.vim* *ft-gsp-syntax* 1885 1886 The default coloring style for GSP pages is defined by |html.vim|, and 1887 the coloring for java code (within java tags or inline between backticks) 1888 is defined by |java.vim|. The following HTML groups defined in |html.vim| 1889 are redefined to incorporate and highlight inline java code: 1890 1891 htmlString 1892 htmlValue 1893 htmlEndTag 1894 htmlTag 1895 htmlTagN 1896 1897 Highlighting should look fine most of the places where you'd see inline 1898 java code, but in some special cases it may not. To add another HTML 1899 group where you will have inline java code where it does not highlight 1900 correctly, just copy the line you want from |html.vim| and add gspJava 1901 to the contains clause. 1902 1903 The backticks for inline java are highlighted according to the htmlError 1904 group to make them easier to see. 1905 1906 1907 GDB *gdb.vim* *ft-gdb-syntax* 1908 1909 The GDB syntax file provides syntax |folding| (see |:syn-fold|) for comments 1910 and block statements. This can be enabled with: > 1911 1912 :set foldmethod=syntax 1913 1914 1915 GROFF *groff.vim* *ft-groff-syntax* 1916 1917 The groff syntax file is a wrapper for |nroff.vim|, see the notes 1918 under that heading for examples of use and configuration. The purpose 1919 of this wrapper is to set up groff syntax extensions by setting the 1920 filetype from a |modeline| or in a personal filetype definitions file 1921 (see |filetype.txt|). 1922 1923 1924 HASKELL *haskell.vim* *lhaskell.vim* *ft-haskell-syntax* 1925 1926 The Haskell syntax files support plain Haskell code as well as literate 1927 Haskell code, the latter in both Bird style and TeX style. The Haskell 1928 syntax highlighting will also highlight C preprocessor directives. 1929 1930 If you want to highlight delimiter characters (useful if you have a 1931 light-coloured background), add to your .vimrc: > 1932 :let hs_highlight_delimiters = 1 1933 To treat True and False as keywords as opposed to ordinary identifiers, 1934 add: > 1935 :let hs_highlight_boolean = 1 1936 To also treat the names of primitive types as keywords: > 1937 :let hs_highlight_types = 1 1938 And to treat the names of even more relatively common types as keywords: > 1939 :let hs_highlight_more_types = 1 1940 If you want to highlight the names of debugging functions, put in 1941 your .vimrc: > 1942 :let hs_highlight_debug = 1 1943 1944 The Haskell syntax highlighting also highlights C preprocessor 1945 directives, and flags lines that start with # but are not valid 1946 directives as erroneous. This interferes with Haskell's syntax for 1947 operators, as they may start with #. If you want to highlight those 1948 as operators as opposed to errors, put in your .vimrc: > 1949 :let hs_allow_hash_operator = 1 1950 1951 The syntax highlighting for literate Haskell code will try to 1952 automatically guess whether your literate Haskell code contains 1953 TeX markup or not, and correspondingly highlight TeX constructs 1954 or nothing at all. You can override this globally by putting 1955 in your .vimrc > 1956 :let lhs_markup = none 1957 for no highlighting at all, or > 1958 :let lhs_markup = tex 1959 to force the highlighting to always try to highlight TeX markup. 1960 For more flexibility, you may also use buffer local versions of 1961 this variable, so e.g. > 1962 :let b:lhs_markup = tex 1963 will force TeX highlighting for a particular buffer. It has to be 1964 set before turning syntax highlighting on for the buffer or 1965 loading a file. 1966 1967 1968 HTML *html.vim* *ft-html-syntax* 1969 1970 The coloring scheme for tags in the HTML file works as follows. 1971 1972 The <> of opening tags are colored differently than the </> of a closing tag. 1973 This is on purpose! For opening tags the 'Function' color is used, while for 1974 closing tags the 'Identifier' color is used (See syntax.vim to check how those 1975 are defined for you) 1976 1977 Known tag names are colored the same way as statements in C. Unknown tag 1978 names are colored with the same color as the <> or </> respectively which 1979 makes it easy to spot errors 1980 1981 Note that the same is true for argument (or attribute) names. Known attribute 1982 names are colored differently than unknown ones. 1983 1984 Some HTML tags are used to change the rendering of text. The following tags 1985 are recognized by the html.vim syntax coloring file and change the way normal 1986 text is shown: <B> <I> <U> <EM> <STRONG> (<EM> is used as an alias for <I>, 1987 while <STRONG> as an alias for <B>), <H1> - <H6>, <HEAD>, <TITLE> and <A>, but 1988 only if used as a link (that is, it must include a href as in 1989 <A href="somefile.html">). 1990 1991 If you want to change how such text is rendered, you must redefine the 1992 following syntax groups: 1993 1994 - htmlBold 1995 - htmlBoldUnderline 1996 - htmlBoldUnderlineItalic 1997 - htmlUnderline 1998 - htmlUnderlineItalic 1999 - htmlItalic 2000 - htmlTitle for titles 2001 - htmlH1 - htmlH6 for headings 2002 2003 To make this redefinition work you must redefine them all with the exception 2004 of the last two (htmlTitle and htmlH[1-6], which are optional) and define the 2005 following variable in your vimrc (this is due to the order in which the files 2006 are read during initialization) > 2007 :let html_my_rendering=1 2008 2009 If you'd like to see an example download mysyntax.vim at 2010 https://web.archive.org/web/20241129015117/https://www.fleiner.com/vim/download.html 2011 2012 You can also disable this rendering by adding the following line to your 2013 vimrc file: > 2014 :let html_no_rendering=1 2015 2016 By default Vim starts parsing 1.5 times "html_minlines" lines before the first 2017 displayed line, and searches a further "html_maxlines" lines back for a 2018 synchronization point. These values can be configured using: > 2019 :let html_minlines = 500 2020 :let html_maxlines = 750 2021 < 2022 HTML comments are rather special (see an HTML reference document for the 2023 details), and the syntax coloring scheme will highlight all errors. 2024 However, if you prefer to use the wrong style (starts with <!-- and 2025 ends with -->) you can define > 2026 :let html_wrong_comments=1 2027 2028 JavaScript and Visual Basic embedded inside HTML documents are highlighted as 2029 'Special' with statements, comments, strings and so on colored as in standard 2030 programming languages. Note that only JavaScript and Visual Basic are 2031 currently supported, no other scripting language has been added yet. 2032 2033 Embedded and inlined cascading style sheets (CSS) are highlighted too. 2034 2035 There are several html preprocessor languages out there. html.vim has been 2036 written such that it should be trivial to include it. To do so add the 2037 following two lines to the syntax coloring file for that language 2038 (the example comes from the asp.vim file): 2039 > 2040 runtime! syntax/html.vim 2041 syn cluster htmlPreproc add=asp 2042 2043 Now you just need to make sure that you add all regions that contain 2044 the preprocessor language to the cluster htmlPreproc. 2045 2046 *html-folding* 2047 The HTML syntax file provides syntax |folding| (see |:syn-fold|) between start 2048 and end tags. This can be turned on by > 2049 2050 :let g:html_syntax_folding = 1 2051 :set foldmethod=syntax 2052 2053 Note: Syntax folding might slow down syntax highlighting significantly, 2054 especially for large files. 2055 2056 2057 HTML/OS (BY AESTIVA) *htmlos.vim* *ft-htmlos-syntax* 2058 2059 The coloring scheme for HTML/OS works as follows: 2060 2061 Functions and variable names are the same color by default, because VIM 2062 doesn't specify different colors for Functions and Identifiers. To change 2063 this (which is recommended if you want function names to be recognizable in a 2064 different color) you need to add the following line to either your ~/.vimrc: > 2065 :hi Function term=underline cterm=bold ctermfg=LightGray 2066 2067 Of course, the ctermfg can be a different color if you choose. 2068 2069 Another issues that HTML/OS runs into is that there is no special filetype to 2070 signify that it is a file with HTML/OS coding. You can change this by opening 2071 a file and turning on HTML/OS syntax by doing the following: > 2072 :set syntax=htmlos 2073 2074 Lastly, it should be noted that the opening and closing characters to begin a 2075 block of HTML/OS code can either be << or [[ and >> or ]], respectively. 2076 2077 2078 IA64 *ia64.vim* *intel-itanium* *ft-ia64-syntax* 2079 2080 Highlighting for the Intel Itanium 64 assembly language. See |asm.vim| for 2081 how to recognize this filetype. 2082 2083 To have *.inc files be recognized as IA64, add this to your .vimrc file: > 2084 :let g:filetype_inc = "ia64" 2085 2086 2087 2088 ICALENDAR *icalendar.vim* *ft-icalendar-syntax* 2089 2090 Highlighting for iCalendar files (RFC 5545), as used by calendaring 2091 applications with an ".ics" extension. 2092 2093 Component boundaries (BEGIN: and END:), property names, property 2094 parameters and recurrence rule parts are highlighted separately. A content 2095 line may be split across several lines by inserting a line break followed 2096 by a space or a tab; such folded lines are highlighted as a single logical 2097 line. 2098 2099 Folding of components is provided by the filetype plugin and is off by 2100 default; see |ft-icalendar-plugin|. 2101 2102 INFORM *inform.vim* *ft-inform-syntax* 2103 2104 Inform highlighting includes symbols provided by the Inform Library, as 2105 most programs make extensive use of it. If do not wish Library symbols 2106 to be highlighted add this to your vim startup: > 2107 :let inform_highlight_simple=1 2108 2109 By default it is assumed that Inform programs are Z-machine targeted, 2110 and highlights Z-machine assembly language symbols appropriately. If 2111 you intend your program to be targeted to a Glulx/Glk environment you 2112 need to add this to your startup sequence: > 2113 :let inform_highlight_glulx=1 2114 2115 This will highlight Glulx opcodes instead, and also adds glk() to the 2116 set of highlighted system functions. 2117 2118 The Inform compiler will flag certain obsolete keywords as errors when 2119 it encounters them. These keywords are normally highlighted as errors 2120 by Vim. To prevent such error highlighting, you must add this to your 2121 startup sequence: > 2122 :let inform_suppress_obsolete=1 2123 2124 By default, the language features highlighted conform to Compiler 2125 version 6.30 and Library version 6.11. If you are using an older 2126 Inform development environment, you may with to add this to your 2127 startup sequence: > 2128 :let inform_highlight_old=1 2129 2130 IDL *idl.vim* *idl-syntax* 2131 2132 IDL (Interface Definition Language) files are used to define RPC calls. In 2133 Microsoft land, this is also used for defining COM interfaces and calls. 2134 2135 IDL's structure is simple enough to permit a full grammar based approach to 2136 rather than using a few heuristics. The result is large and somewhat 2137 repetitive but seems to work. 2138 2139 There are some Microsoft extensions to idl files that are here. Some of them 2140 are disabled by defining idl_no_ms_extensions. 2141 2142 The more complex of the extensions are disabled by defining idl_no_extensions. 2143 2144 Variable Effect ~ 2145 2146 idl_no_ms_extensions Disable some of the Microsoft specific 2147 extensions 2148 idl_no_extensions Disable complex extensions 2149 idlsyntax_showerror Show IDL errors (can be rather intrusive, but 2150 quite helpful) 2151 idlsyntax_showerror_soft Use softer colours by default for errors 2152 2153 2154 JAVA *java.vim* *ft-java-syntax* 2155 2156 The java.vim syntax highlighting file offers several options. 2157 2158 In Java 1.0.2, it was never possible to have braces inside parens, so this was 2159 flagged as an error. Since Java 1.1, this is possible (with anonymous 2160 classes); and, therefore, is no longer marked as an error. If you prefer the 2161 old way, put the following line into your Vim startup file: > 2162 :let g:java_mark_braces_in_parens_as_errors = 1 2163 2164 All (exported) public types declared in `java.lang` are always automatically 2165 imported and available as simple names. To highlight them, use: > 2166 :let g:java_highlight_java_lang_ids = 1 2167 You can also generate syntax items for other public and protected types and 2168 opt in to highlight some of their names; see |java-package-info-url|. 2169 2170 Headers of indented function declarations can be highlighted (along with parts 2171 of lambda expressions and method reference expressions), but it depends on how 2172 you write Java code. Two formats are recognized: 2173 2174 1) If you write function declarations that are consistently indented by either 2175 a tab, or a space . . . or eight space character(s), you may want to set one 2176 of > 2177 :let g:java_highlight_functions = "indent" 2178 :let g:java_highlight_functions = "indent1" 2179 :let g:java_highlight_functions = "indent2" 2180 :let g:java_highlight_functions = "indent3" 2181 :let g:java_highlight_functions = "indent4" 2182 :let g:java_highlight_functions = "indent5" 2183 :let g:java_highlight_functions = "indent6" 2184 :let g:java_highlight_functions = "indent7" 2185 :let g:java_highlight_functions = "indent8" 2186 Note that in terms of 'shiftwidth', this is the leftmost step of indentation. 2187 2188 2) However, if you follow the Java guidelines about how functions and types 2189 are supposed to be named (with respect to upper- and lowercase) and there is 2190 any amount of indentation, you may want to set > 2191 :let g:java_highlight_functions = "style" 2192 2193 In addition, you can combine any value of "g:java_highlight_functions" with > 2194 :let g:java_highlight_signature = 1 2195 to have the name of a function with its parameter list parens distinctly 2196 highlighted from its type parameters, return type, and formal parameters; and 2197 to have the parameter list parens of a lambda expression with its arrow 2198 distinctly highlighted from its formal parameters or identifiers. 2199 2200 If neither setting does work for you, but you would still want headers of 2201 function declarations to be highlighted, modify the current syntax definitions 2202 or compose new ones. 2203 2204 Higher-order function types can be hard to parse by eye, so uniformly toning 2205 down some of their components may be of value. Provided that such type names 2206 conform to the Java naming guidelines, you may arrange it with > 2207 :let g:java_highlight_generics = 1 2208 2209 In Java 1.1, the functions `System.out.println()` and `System.err.println()` 2210 should only be used for debugging. Consider adding the following definition 2211 in your startup file: > 2212 :let g:java_highlight_debug = 1 2213 to have the bulk of those statements colored as 2214 *Debug debugging statements, 2215 and to make some of their own items further grouped and linked: 2216 *Special as DebugSpecial, 2217 *String as DebugString, 2218 *Boolean as DebugBoolean, 2219 *Type as DebugType, 2220 which are used for special characters appearing in strings, strings proper, 2221 boolean literals, and special instance references (`super`, `this`, `null`), 2222 respectively. 2223 2224 Javadoc is a program that takes special comments out of Java program files and 2225 creates HTML pages. The standard configuration will highlight this HTML code 2226 similarly to HTML files (see |html.vim|). You can even add JavaScript and CSS 2227 inside this code (see below). The HTML rendering and the Markdown rendering 2228 diverge as follows: 2229 1. The first sentence (all characters up to the first period `.`, which is 2230 followed by a whitespace character or a line terminator, or up to the 2231 first block tag, e.g. `@param`, `@return`) is colored as 2232 *SpecialComment special comments. 2233 2. The text is colored as 2234 *Comment comments. 2235 3. HTML comments are colored as 2236 *Special special symbols. 2237 4. The standard Javadoc tags (`@code`, `@see`, etc.) are colored as 2238 *Special special symbols 2239 and some of their arguments are colored as 2240 *Function function names. 2241 To turn this feature off for both HTML and Markdown, add the following line to 2242 your startup file: > 2243 :let g:java_ignore_javadoc = 1 2244 Alternatively, only suppress HTML comments or Markdown comments: > 2245 :let g:java_ignore_html = 1 2246 :let g:java_ignore_markdown = 1 2247 2248 See |ft-java-plugin| for additional support available for Markdown comments. 2249 2250 If you use the special Javadoc comment highlighting described above, you can 2251 also turn on special highlighting for JavaScript, Visual Basic scripts, and 2252 embedded CSS (stylesheets). This only makes sense if any of these languages 2253 actually appear in Javadoc comments. The variables to use are > 2254 :let g:java_javascript = 1 2255 :let g:java_css = 1 2256 :let g:java_vb = 1 2257 Note that these three variables are maintained in the HTML syntax file. 2258 2259 Numbers and strings can be recognized in non-Javadoc comments with > 2260 :let g:java_comment_strings = 1 2261 2262 When 'foldmethod' is set to "syntax", multi-line blocks of code ("b"), plain 2263 comments ("c"), Javadoc comments ("d"), and adjacent "import" declarations 2264 ("i") will be folded by default. Syntax items of any supported kind will 2265 remain NOT foldable when its abbreviated name is delisted with > 2266 :let g:java_ignore_folding = "bcdi" 2267 No text is usually written in the first line of a multi-line comment, making 2268 folded contents of Javadoc comments less informative with the default 2269 'foldtext' value; you may opt for showing the contents of a second line for 2270 any comments written in this way, and showing the contents of a first line 2271 otherwise, with > 2272 :let g:java_foldtext_show_first_or_second_line = 1 2273 HTML tags in Javadoc comments can additionally be folded by following the 2274 instructions listed under |html-folding| and giving explicit consent with > 2275 :let g:java_consent_to_html_syntax_folding = 1 2276 Do not default to this kind of folding unless ALL start tags and optional end 2277 tags are balanced in Javadoc comments; otherwise, put up with creating runaway 2278 folds that break syntax highlighting. 2279 2280 Trailing whitespace characters or a run of space characters before a tab 2281 character can be marked as an error with > 2282 :let g:java_space_errors = 1 2283 but either kind of an error can be suppressed by also defining one of > 2284 :let g:java_no_trail_space_error = 1 2285 :let g:java_no_tab_space_error = 1 2286 2287 In order to highlight nested parens with different colors, define colors for 2288 `javaParen`, `javaParen1`, and `javaParen2`. For example, > 2289 :hi link javaParen Comment 2290 or > 2291 :hi javaParen ctermfg=blue guifg=#0000ff 2292 2293 Certain modifiers are incompatible with each other, e.g. `abstract` and 2294 `final`: > 2295 :syn list javaConceptKind 2296 and can be differently highlighted as a group than other modifiers with > 2297 :hi link javaConceptKind NonText 2298 2299 All instances of variable-width lookbehind assertions (|/\@<!| and |/\@<=|), 2300 resorted to in syntax item definitions, are confined to arbitrary byte counts. 2301 Another arbitrary value can be selected for a related group of definitions. 2302 For example: > 2303 :let g:java_lookbehind_byte_counts = {'javaMarkdownCommentTitle': 240} 2304 Where each key name of this dictionary is the name of a syntax item. The use 2305 of these assertions in syntax items may vary among revisions, so no definitive 2306 set of supported key names is committed to. 2307 2308 If you notice highlighting errors while scrolling backwards, which are fixed 2309 when redrawing with CTRL-L, try setting the "g:java_minlines" variable to 2310 a larger number: > 2311 :let g:java_minlines = 50 2312 This will make the syntax synchronization start 50 lines before the first 2313 displayed line. The default value is 10. The disadvantage of using a larger 2314 number is that redrawing can become slow. 2315 2316 Significant changes to the Java platform are gradually introduced in the form 2317 of JDK Enhancement Proposals (JEPs) that can be implemented for a release and 2318 offered as its preview features. It may take several JEPs and a few release 2319 cycles for such a feature to become either integrated into the platform or 2320 withdrawn from this effort. To cater for early adopters, there is optional 2321 support in Vim for syntax related preview features that are implemented. You 2322 can request it by specifying a list of preview feature numbers as follows: > 2323 :let g:java_syntax_previews = [532] 2324 2325 The supported JEP numbers are to be drawn from this table: 2326 `430`: String Templates [JDK 21] 2327 `532`: Primitive types in Patterns, instanceof, and switch 2328 2329 Note that as soon as the particular preview feature will have been integrated 2330 into the Java platform, its entry will be removed from the table and related 2331 optionality will be discontinued. 2332 *java-package-info-url* 2333 https://github.com/zzzyxwvut/java-vim/blob/master/tools/javaid/src/javaid/package-info.java 2334 2335 JSON *json.vim* *ft-json-syntax* *g:vim_json_conceal* 2336 *g:vim_json_warnings* 2337 2338 The json syntax file provides syntax highlighting with conceal support by 2339 default. To disable concealment: > 2340 let g:vim_json_conceal = 0 2341 2342 To disable syntax highlighting of errors: > 2343 let g:vim_json_warnings = 0 2344 2345 2346 JQ *jq.vim* *jq_quote_highlight* *ft-jq-syntax* 2347 2348 To disable numbers having their own color add the following to your vimrc: > 2349 hi link jqNumber Normal 2350 2351 If you want quotes to have different highlighting than strings > 2352 let g:jq_quote_highlight = 1 2353 2354 KCONFIG *ft-kconfig-syntax* 2355 2356 Kconfig syntax highlighting language. For syntax syncing, you can configure 2357 the following variable (default: 50): > 2358 2359 let kconfig_minlines = 50 2360 2361 To configure a bit more (heavier) highlighting, set the following variable: > 2362 2363 let kconfig_syntax_heavy = 1 2364 2365 LACE *lace.vim* *ft-lace-syntax* 2366 2367 Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the 2368 style guide lines are not. If you prefer case insensitive highlighting, just 2369 define the vim variable 'lace_case_insensitive' in your startup file: > 2370 :let lace_case_insensitive=1 2371 2372 2373 LF (LFRC) *lf.vim* *ft-lf-syntax* *g:lf_shell_syntax* 2374 *b:lf_shell_syntax* 2375 2376 For the lf file manager configuration files (lfrc) the shell commands syntax 2377 highlighting can be changed globally and per buffer by setting a different 2378 'include' command search pattern using these variables: > 2379 let g:lf_shell_syntax = "syntax/dosbatch.vim" 2380 let b:lf_shell_syntax = "syntax/zsh.vim" 2381 2382 These variables are unset by default. 2383 2384 The default 'include' command search pattern is 'syntax/sh.vim'. 2385 2386 2387 LEX *lex.vim* *ft-lex-syntax* 2388 2389 Lex uses brute-force synchronizing as the "^%%$" section delimiter 2390 gives no clue as to what section follows. Consequently, the value for > 2391 :syn sync minlines=300 2392 may be changed by the user if s/he is experiencing synchronization 2393 difficulties (such as may happen with large lex files). 2394 2395 2396 LIFELINES *lifelines.vim* *ft-lifelines-syntax* 2397 2398 To highlight deprecated functions as errors, add in your .vimrc: > 2399 2400 :let g:lifelines_deprecated = 1 2401 < 2402 2403 LISP *lisp.vim* *ft-lisp-syntax* 2404 2405 The lisp syntax highlighting provides two options: > 2406 2407 g:lisp_instring : If it exists, then "(...)" strings are highlighted 2408 as if the contents of the string were lisp. 2409 Useful for AutoLisp. 2410 g:lisp_rainbow : If it exists and is nonzero, then differing levels 2411 of parenthesization will receive different 2412 highlighting. 2413 < 2414 The g:lisp_rainbow option provides 10 levels of individual colorization for 2415 the parentheses and backquoted parentheses. Because of the quantity of 2416 colorization levels, unlike non-rainbow highlighting, the rainbow mode 2417 specifies its highlighting using ctermfg and guifg, thereby bypassing the 2418 usual color scheme control using standard highlighting groups. The actual 2419 highlighting used depends on the dark/bright setting (see 'bg'). 2420 2421 2422 LITE *lite.vim* *ft-lite-syntax* 2423 2424 There are two options for the lite syntax highlighting. 2425 2426 If you like SQL syntax highlighting inside Strings, use this: > 2427 2428 :let lite_sql_query = 1 2429 2430 For syncing, minlines defaults to 100. If you prefer another value, you can 2431 set "lite_minlines" to the value you desire. Example: > 2432 2433 :let lite_minlines = 200 2434 2435 LOG *ft-log-syntax* 2436 2437 Vim comes with a simplistic generic log syntax highlighter. Because the log 2438 file format is so generic, highlighting is not enabled by default, since it 2439 can be distracting. If you want to enable this, simply set the "log" filetype 2440 manually: > 2441 2442 :set ft=log 2443 2444 To enable this automatically for "*.log" files, add the following to your 2445 personal `filetype.vim` file (usually located in `~/.vim/filetype.vim` on Unix 2446 or `$HOME/vimfiles/filetype.vim`, see also |new-filetype|): > 2447 2448 augroup filetypedetect 2449 au! BufNewFile,BufRead *.log setfiletype log 2450 augroup END 2451 2452 LPC *lpc.vim* *ft-lpc-syntax* 2453 2454 LPC stands for a simple, memory-efficient language: Lars Pensjö C. The 2455 file name of LPC is usually *.c. Recognizing these files as LPC would bother 2456 users writing only C programs. If you want to use LPC syntax in Vim, you 2457 should set a variable in your .vimrc file: > 2458 2459 :let lpc_syntax_for_c = 1 2460 2461 If it doesn't work properly for some particular C or LPC files, use a 2462 modeline. For a LPC file: > 2463 2464 // vim:set ft=lpc: 2465 2466 For a C file that is recognized as LPC: > 2467 2468 // vim:set ft=c: 2469 2470 If you don't want to set the variable, use the modeline in EVERY LPC file. 2471 2472 There are several implementations for LPC, we intend to support most widely 2473 used ones. Here the default LPC syntax is for MudOS series, for MudOS v22 2474 and before, you should turn off the sensible modifiers, and this will also 2475 assert the new efuns after v22 to be invalid, don't set this variable when 2476 you are using the latest version of MudOS: > 2477 2478 :let lpc_pre_v22 = 1 2479 2480 For LpMud 3.2 series of LPC: > 2481 2482 :let lpc_compat_32 = 1 2483 2484 For LPC4 series of LPC: > 2485 2486 :let lpc_use_lpc4_syntax = 1 2487 2488 For uLPC series of LPC: 2489 uLPC has been developed to Pike, so you should use Pike syntax 2490 instead, and the name of your source file should be *.pike 2491 2492 2493 LUA *lua.vim* *ft-lua-syntax* 2494 2495 The Lua syntax file can be used for versions 4.0, 5.0+. You can select one of 2496 these versions using the global variables |g:lua_version| and 2497 |g:lua_subversion|. 2498 2499 2500 MAIL *mail.vim* *ft-mail.vim* 2501 2502 Vim highlights all the standard elements of an email (headers, signatures, 2503 quoted text and URLs / email addresses). In keeping with standard 2504 conventions, signatures begin in a line containing only "--" followed 2505 optionally by whitespaces and end with a newline. 2506 2507 Vim treats lines beginning with ']', '}', '|', '>' or a word followed by '>' 2508 as quoted text. However Vim highlights headers and signatures in quoted text 2509 only if the text is quoted with '>' (optionally followed by one space). 2510 2511 By default mail.vim synchronises syntax to 100 lines before the first 2512 displayed line. If you have a slow machine, and generally deal with emails 2513 with short headers, you can change this to a smaller value: > 2514 2515 :let mail_minlines = 30 2516 2517 2518 MAKE *make.vim* *ft-make-syntax* 2519 2520 In makefiles, commands are usually highlighted to make it easy for you to spot 2521 errors. However, this may be too much coloring for you. You can turn this 2522 feature off by using: > 2523 2524 :let make_no_commands = 1 2525 2526 Comments are also highlighted by default. You can turn this off by using: > 2527 2528 :let make_no_comments = 1 2529 2530 There are various Make implementations, which add extensions other than the 2531 POSIX specification and thus are mutually incompatible. If the filename is 2532 BSDmakefile or GNUmakefile, the corresponding implementation is automatically 2533 determined; otherwise vim tries to detect it by the file contents. If you see 2534 any wrong highlights because of this, you can enforce a flavor by setting one 2535 of the following: > 2536 2537 :let g:make_flavor = 'bsd' " or 2538 :let g:make_flavor = 'gnu' " or 2539 :let g:make_flavor = 'microsoft' 2540 2541 2542 MAPLE *maple.vim* *ft-maple-syntax* 2543 2544 Maple V, by Waterloo Maple Inc, supports symbolic algebra. The language 2545 supports many packages of functions which are selectively loaded by the user. 2546 The standard set of packages' functions as supplied in Maple V release 4 may 2547 be highlighted at the user's discretion. Users may place in their .vimrc 2548 file: > 2549 2550 :let mvpkg_all= 1 2551 2552 to get all package functions highlighted, or users may select any subset by 2553 choosing a variable/package from the table below and setting that variable to 2554 1, also in their .vimrc file (prior to sourcing 2555 $VIMRUNTIME/syntax/syntax.vim). 2556 2557 Table of Maple V Package Function Selectors > 2558 mv_DEtools mv_genfunc mv_networks mv_process 2559 mv_Galois mv_geometry mv_numapprox mv_simplex 2560 mv_GaussInt mv_grobner mv_numtheory mv_stats 2561 mv_LREtools mv_group mv_orthopoly mv_student 2562 mv_combinat mv_inttrans mv_padic mv_sumtools 2563 mv_combstruct mv_liesymm mv_plots mv_tensor 2564 mv_difforms mv_linalg mv_plottools mv_totorder 2565 mv_finance mv_logic mv_powseries 2566 2567 2568 MARKDOWN *ft-markdown-syntax* *g:markdown_minlines* 2569 *g:markdown_fenced_languages* *g:markdown_syntax_conceal* 2570 2571 If you have long regions there may be incorrect highlighting. At the cost of 2572 slowing down displaying, you can have the engine look further back to sync on 2573 the start of a region, for example 500 lines (default is 50): > 2574 2575 :let g:markdown_minlines = 500 2576 2577 If you want to enable fenced code block syntax highlighting in your Markdown 2578 documents, set the following variable: > 2579 2580 :let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] 2581 2582 To disable Markdown syntax concealing, add the following to your vimrc: > 2583 2584 :let g:markdown_syntax_conceal = 0 2585 2586 For extended Markdown support with enhanced features such as citations, 2587 footnotes, mathematical formulas, academic writing elements and embedded code 2588 block highlighting, consider using the pandoc syntax plugin. Set 2589 `g:filetype_md` to 'pandoc' and see |ft-pandoc-syntax| for configuration 2590 details. 2591 2592 MATHEMATICA *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax* 2593 2594 Empty *.m files will automatically be presumed to be Matlab files unless you 2595 have the following in your .vimrc: > 2596 2597 let filetype_m = "mma" 2598 2599 MBSYNC *mbsync.vim* *ft-mbsync-syntax* 2600 2601 The mbsync application uses a configuration file to setup mailboxes names, 2602 user and password. All files ending with `.mbsyncrc` or with the name 2603 `isyncrc` will be recognized as mbsync configuration files. 2604 2605 MEDIAWIKI *ft-mediawiki-syntax* 2606 2607 By default, syntax highlighting includes basic HTML tags like style and 2608 headers |html.vim|. For strict Mediawiki syntax highlighting: > 2609 2610 let g:html_no_rendering = 1 2611 2612 If HTML highlighting is desired, terminal-based text formatting such as bold 2613 and italic is possible by: > 2614 2615 let g:html_style_rendering = 1 2616 2617 MODULA2 *modula2.vim* *ft-modula2-syntax* 2618 2619 Vim will recognise comments with dialect tags to automatically select a given 2620 dialect. 2621 2622 The syntax for a dialect tag comment is: > 2623 2624 taggedComment := 2625 '(*!' dialectTag '*)' 2626 ; 2627 2628 dialectTag := 2629 m2pim | m2iso | m2r10 2630 ; 2631 2632 reserved words 2633 m2pim = 'm2pim', m2iso = 'm2iso', m2r10 = 'm2r10' 2634 2635 A dialect tag comment is recognised by Vim if it occurs within the first 200 2636 lines of the source file. Only the very first such comment is recognised, any 2637 additional dialect tag comments are ignored. 2638 2639 Example: > 2640 2641 DEFINITION MODULE FooLib; (*!m2pim*) 2642 ... 2643 2644 Variable g:modula2_default_dialect sets the default Modula-2 dialect when the 2645 dialect cannot be determined from the contents of the Modula-2 file: if 2646 defined and set to 'm2pim', the default dialect is PIM. 2647 2648 Example: > 2649 2650 let g:modula2_default_dialect = 'm2pim' 2651 2652 2653 Highlighting is further configurable for each dialect via the following 2654 variables. 2655 2656 Variable Highlight ~ 2657 *modula2_iso_allow_lowline* allow low line in identifiers 2658 *modula2_iso_disallow_octals* disallow octal integer literals 2659 *modula2_iso_disallow_synonyms* disallow "@", "&" and "~" synonyms 2660 2661 *modula2_pim_allow_lowline* allow low line in identifiers 2662 *modula2_pim_disallow_octals* disallow octal integer literals 2663 *modula2_pim_disallow_synonyms* disallow "&" and "~" synonyms 2664 2665 *modula2_r10_allow_lowline* allow low line in identifiers 2666 2667 MOO *moo.vim* *ft-moo-syntax* 2668 2669 If you use C-style comments inside expressions and find it mangles your 2670 highlighting, you may want to use extended (slow!) matches for C-style 2671 comments: > 2672 2673 :let moo_extended_cstyle_comments = 1 2674 2675 To disable highlighting of pronoun substitution patterns inside strings: > 2676 2677 :let moo_no_pronoun_sub = 1 2678 2679 To disable highlighting of the regular expression operator '%|', and matching 2680 '%(' and '%)' inside strings: > 2681 2682 :let moo_no_regexp = 1 2683 2684 Unmatched double quotes can be recognized and highlighted as errors: > 2685 2686 :let moo_unmatched_quotes = 1 2687 2688 To highlight builtin properties (.name, .location, .programmer etc.): > 2689 2690 :let moo_builtin_properties = 1 2691 2692 Unknown builtin functions can be recognized and highlighted as errors. If you 2693 use this option, add your own extensions to the mooKnownBuiltinFunction group. 2694 To enable this option: > 2695 2696 :let moo_unknown_builtin_functions = 1 2697 2698 An example of adding sprintf() to the list of known builtin functions: > 2699 2700 :syn keyword mooKnownBuiltinFunction sprintf contained 2701 2702 2703 MSQL *msql.vim* *ft-msql-syntax* 2704 2705 There are two options for the msql syntax highlighting. 2706 2707 If you like SQL syntax highlighting inside Strings, use this: > 2708 2709 :let msql_sql_query = 1 2710 2711 For syncing, minlines defaults to 100. If you prefer another value, you can 2712 set "msql_minlines" to the value you desire. Example: > 2713 2714 :let msql_minlines = 200 2715 2716 2717 NEOMUTT *neomutt.vim* *ft-neomuttrc-syntax* 2718 *ft-neomuttlog-syntax* 2719 2720 To disable the default NeoMutt log colors: > 2721 2722 :let g:neolog_disable_default_colors = 1 2723 2724 N1QL *n1ql.vim* *ft-n1ql-syntax* 2725 2726 N1QL is a SQL-like declarative language for manipulating JSON documents in 2727 Couchbase Server databases. 2728 2729 Vim syntax highlights N1QL statements, keywords, operators, types, comments, 2730 and special values. Vim ignores syntactical elements specific to SQL or its 2731 many dialects, like COLUMN or CHAR, that don't exist in N1QL. 2732 2733 2734 NCF *ncf.vim* *ft-ncf-syntax* 2735 2736 There is one option for NCF syntax highlighting. 2737 2738 If you want to have unrecognized (by ncf.vim) statements highlighted as 2739 errors, use this: > 2740 2741 :let ncf_highlight_unknowns = 1 2742 2743 If you don't want to highlight these errors, leave it unset. 2744 2745 2746 NROFF *nroff.vim* *ft-nroff-syntax* 2747 2748 The nroff syntax file works with AT&T n/troff as-is. To support GNU troff 2749 (groff), which Linux and BSD distributions use as their default typesetting 2750 package, arrange for files to be recognized as groff input (see 2751 |ft-groff-syntax|) or add the following option to your start-up files: > 2752 2753 :let nroff_is_groff = 1 2754 2755 GNU troff differs from older AT&T n/troff programs (that you may still find in 2756 Solaris or Plan 9) by extending the *roff language syntax. For example, in 2757 AT&T troff, you access the count of years since 1900 with the escape sequence 2758 \n(yr. In groff you can do the same, which it recognizes for compatibility, 2759 or use groff's extended syntax, \n[yr]. AT&T troff documented the yr register 2760 as storing the "last two digits of current year", but had a Y2K problem; in 2761 groff, you can access the Gregorian year correctly: \n[year]. In groff, font, 2762 register, macro, string, and request names can exceed two characters; for 2763 example, with groff's mm package, the control lines ".VERBON" and ".VERBOFF" 2764 call macros of those names to bracket displays of "verbatim" content. 2765 2766 In order to obtain the best formatted output g/troff can give you, you should 2767 follow a few simple rules about spacing and punctuation. 2768 2769 1. Break the line (put a carriage return) at the end of every sentence. Don't 2770 permit trailing spaces before the newline. 2771 2772 2. If a line ends with a period, question mark, or exclamation point that does 2773 not end a sentence, follow it with the dummy character escape sequence \&. 2774 2775 3. If you're using a macro package, employ its paragraphing macros to achieve 2776 indentation of paragraphs and spacing between them. 2777 2778 4. Use the empty request, a '.' on a line by itself, freely to visually 2779 separate material for ease of document maintenance. 2780 2781 The reason for these tips is that g/n/troff attempts to detect the ends of 2782 sentences, and can use that information to apply inter-sentence space. Using 2783 them also minimizes the size of diffs where lines change due only to refilling 2784 in the text editor. Macro packages typically employ inter-paragraph spacing 2785 amounts other than one vee (which is the result of a blank input line), and 2786 typically store that spacing amount, and that of paragraph indentation, in 2787 user-configurable registers so that pages lay out consistently. 2788 2789 Unlike TeX, troff fills text line-by-line, not paragraph-by-paragraph. If you 2790 desire consistent spacing between words and sentences in formatted output, you 2791 must maintain consistent spacing in the input text. To mark both trailing 2792 spaces and two or more spaces after a punctuation as an error, use: > 2793 2794 :let nroff_space_errors = 1 2795 2796 Another technique to detect extra spacing and other errors that will interfere 2797 with the correct typesetting of your file, is to define an eye-catching 2798 highlighting definition for the syntax groups "nroffDefinition" and 2799 "nroffDefSpecial" in your configuration files. For example: > 2800 2801 hi def nroffDefinition term=italic cterm=italic gui=reverse 2802 hi def nroffDefSpecial term=italic,bold cterm=italic,bold 2803 \ gui=reverse,bold 2804 2805 If you want to navigate preprocessor entries in your source file as easily as 2806 with section markers, you can activate the following option in your .vimrc 2807 file: > 2808 2809 let b:preprocs_as_sections = 1 2810 2811 Further, the syntax file adds an extra paragraph marker for the XP 2812 paragraphing macro in the ms package, a Berkeley and GNU extension. 2813 2814 Finally, there is a |groff.vim| syntax file that can be used to enable groff 2815 syntax highlighting either on a per-file basis or globally by default. 2816 2817 2818 OCAML *ocaml.vim* *ft-ocaml-syntax* 2819 2820 The OCaml syntax file handles files having the following prefixes: .ml, 2821 .mli, .mll and .mly. By setting the following variable > 2822 2823 :let ocaml_revised = 1 2824 2825 you can switch from standard OCaml-syntax to revised syntax as supported 2826 by the camlp4 preprocessor. Setting the variable > 2827 2828 :let ocaml_noend_error = 1 2829 2830 prevents highlighting of "end" as error, which is useful when sources 2831 contain very long structures that Vim does not synchronize anymore. 2832 2833 PANDOC *ft-pandoc-syntax* 2834 2835 By default, markdown files will be detected as filetype "markdown". 2836 Alternatively, you may want them to be detected as filetype "pandoc" instead. 2837 To do so, set the *g:filetype_md* var: > 2838 2839 :let g:filetype_md = 'pandoc' 2840 2841 The pandoc syntax plugin uses |conceal| for pretty highlighting. Default is 1 > 2842 2843 :let g:pandoc#syntax#conceal#use = 1 2844 2845 To specify elements that should not be concealed, set the following variable: > 2846 2847 :let g:pandoc#syntax#conceal#blacklist = [] 2848 2849 This is a list of the rules which can be used here: 2850 2851 - titleblock 2852 - image 2853 - block 2854 - subscript 2855 - superscript 2856 - strikeout 2857 - atx 2858 - codeblock_start 2859 - codeblock_delim 2860 - footnote 2861 - definition 2862 - list 2863 - newline 2864 - dashes 2865 - ellipses 2866 - quotes 2867 - inlinecode 2868 - inlinemath 2869 2870 You can customize the way concealing works. For example, if you prefer to 2871 mark footnotes with the `*` symbol: > 2872 2873 :let g:pandoc#syntax#conceal#cchar_overrides = {"footnote" : "*"} 2874 2875 To conceal the urls in links, use: > 2876 2877 :let g:pandoc#syntax#conceal#urls = 1 2878 2879 Prevent highlighting specific codeblock types so that they remain Normal. 2880 Codeblock types include "definition" for codeblocks inside definition blocks 2881 and "delimited" for delimited codeblocks. Default = [] > 2882 2883 :let g:pandoc#syntax#codeblocks#ignore = ['definition'] 2884 2885 Use embedded highlighting for delimited codeblocks where a language is 2886 specified. Default = 1 > 2887 2888 :let g:pandoc#syntax#codeblocks#embeds#use = 1 2889 2890 For specify what languages and using what syntax files to highlight embeds. 2891 This is a list of language names. When the language pandoc and vim use don't 2892 match, you can use the "PANDOC=VIM" syntax. For example: > 2893 2894 :let g:pandoc#syntax#codeblocks#embeds#langs = ["ruby", "bash=sh"] 2895 2896 To use italics and strong in emphases. Default = 1 > 2897 2898 :let g:pandoc#syntax#style#emphases = 1 2899 2900 "0" will add "block" to g:pandoc#syntax#conceal#blacklist, because otherwise 2901 you couldn't tell where the styles are applied. 2902 2903 To add underline subscript, superscript and strikeout text styles. Default = 1 > 2904 2905 :let g:pandoc#syntax#style#underline_special = 1 2906 2907 Detect and highlight definition lists. Disabling this can improve 2908 performance. Default = 1 (i.e., enabled by default) > 2909 2910 :let g:pandoc#syntax#style#use_definition_lists = 1 2911 2912 The pandoc syntax script also comes with the following commands: > 2913 2914 :PandocHighlight LANG 2915 2916 Enables embedded highlighting for language LANG in codeblocks. Uses the 2917 syntax for items in g:pandoc#syntax#codeblocks#embeds#langs. > 2918 2919 :PandocUnhighlight LANG 2920 2921 Disables embedded highlighting for language LANG in codeblocks. 2922 2923 PAPP *papp.vim* *ft-papp-syntax* 2924 2925 The PApp syntax file handles .papp files and, to a lesser extent, .pxml 2926 and .pxsl files which are all a mixture of perl/xml/html/other using xml 2927 as the top-level file format. By default everything inside phtml or pxml 2928 sections is treated as a string with embedded preprocessor commands. If 2929 you set the variable: > 2930 2931 :let papp_include_html=1 2932 2933 in your startup file it will try to syntax-highlight html code inside phtml 2934 sections, but this is relatively slow and much too colourful to be able to 2935 edit sensibly. ;) 2936 2937 The newest version of the papp.vim syntax file can usually be found at 2938 http://papp.plan9.de. 2939 2940 2941 PASCAL *pascal.vim* *ft-pascal-syntax* 2942 2943 Files matching "*.p" could be Progress or Pascal and those matching "*.pp" 2944 could be Puppet or Pascal. If the automatic detection doesn't work for you, 2945 or you only edit Pascal files, use this in your startup vimrc: > 2946 2947 :let filetype_p = "pascal" 2948 :let filetype_pp = "pascal" 2949 2950 The Pascal syntax file has been extended to take into account some extensions 2951 provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler. 2952 Delphi keywords are also supported. By default, Turbo Pascal 7.0 features are 2953 enabled. If you prefer to stick with the standard Pascal keywords, add the 2954 following line to your startup file: > 2955 2956 :let pascal_traditional=1 2957 2958 To switch on Delphi specific constructions (such as one-line comments, 2959 keywords, etc): > 2960 2961 :let pascal_delphi=1 2962 2963 2964 The option pascal_symbol_operator controls whether symbol operators such as +, 2965 *, .., etc. are displayed using the Operator color or not. To colorize symbol 2966 operators, add the following line to your startup file: > 2967 2968 :let pascal_symbol_operator=1 2969 2970 Some functions are highlighted by default. To switch it off: > 2971 2972 :let pascal_no_functions=1 2973 2974 Furthermore, there are specific variables for some compilers. Besides 2975 pascal_delphi, there are pascal_gpc and pascal_fpc. Default extensions try to 2976 match Turbo Pascal. > 2977 2978 :let pascal_gpc=1 2979 2980 or > 2981 2982 :let pascal_fpc=1 2983 2984 To ensure that strings are defined on a single line, you can define the 2985 pascal_one_line_string variable. > 2986 2987 :let pascal_one_line_string=1 2988 2989 If you dislike <Tab> chars, you can set the pascal_no_tabs variable. Tabs 2990 will be highlighted as Error. > 2991 2992 :let pascal_no_tabs=1 2993 2994 2995 2996 PERL *perl.vim* *ft-perl-syntax* 2997 2998 There are a number of possible options to the perl syntax highlighting. 2999 3000 Inline POD highlighting is now turned on by default. If you don't wish 3001 to have the added complexity of highlighting POD embedded within Perl 3002 files, you may set the 'perl_include_pod' option to 0: > 3003 3004 :let perl_include_pod = 0 3005 3006 To reduce the complexity of parsing (and increase performance) you can switch 3007 off two elements in the parsing of variable names and contents. > 3008 3009 To handle package references in variable and function names not differently 3010 from the rest of the name (like 'PkgName::' in '$PkgName::VarName'): > 3011 3012 :let perl_no_scope_in_variables = 1 3013 3014 (In Vim 6.x it was the other way around: "perl_want_scope_in_variables" 3015 enabled it.) 3016 3017 If you do not want complex things like '@{${"foo"}}' to be parsed: > 3018 3019 :let perl_no_extended_vars = 1 3020 3021 (In Vim 6.x it was the other way around: "perl_extended_vars" enabled it.) 3022 3023 The coloring strings can be changed. By default strings and qq friends will 3024 be highlighted like the first line. If you set the variable 3025 perl_string_as_statement, it will be highlighted as in the second line. 3026 3027 "hello world!"; qq|hello world|; 3028 ^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^N (unlet perl_string_as_statement) 3029 S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^SN (let perl_string_as_statement) 3030 3031 (^ = perlString, S = perlStatement, N = None at all) 3032 3033 The syncing has 3 options. The first two switch off some triggering of 3034 synchronization and should only be needed in case it fails to work properly. 3035 If while scrolling all of a sudden the whole screen changes color completely 3036 then you should try and switch off one of those. Let the developer know if 3037 you can figure out the line that causes the mistake. 3038 3039 One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less. > 3040 3041 :let perl_no_sync_on_sub 3042 :let perl_no_sync_on_global_var 3043 3044 Below you can set the maximum distance VIM should look for starting points for 3045 its attempts in syntax highlighting. > 3046 3047 :let perl_sync_dist = 100 3048 3049 If you want to use folding with perl, set perl_fold: > 3050 3051 :let perl_fold = 1 3052 3053 If you want to fold blocks in if statements, etc. as well set the following: > 3054 3055 :let perl_fold_blocks = 1 3056 3057 Subroutines are folded by default if 'perl_fold' is set. If you do not want 3058 this, you can set 'perl_nofold_subs': > 3059 3060 :let perl_nofold_subs = 1 3061 3062 Anonymous subroutines are not folded by default; you may enable their folding 3063 via 'perl_fold_anonymous_subs': > 3064 3065 :let perl_fold_anonymous_subs = 1 3066 3067 Packages are also folded by default if 'perl_fold' is set. To disable this 3068 behavior, set 'perl_nofold_packages': > 3069 3070 :let perl_nofold_packages = 1 3071 3072 PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax* 3073 3074 [Note: Previously this was called "php3", but since it now also supports php4 3075 it has been renamed to "php"] 3076 3077 There are the following options for the php syntax highlighting. 3078 3079 If you like SQL syntax highlighting inside Strings: > 3080 3081 let php_sql_query = 1 3082 3083 For highlighting the Baselib methods: > 3084 3085 let php_baselib = 1 3086 3087 Enable HTML syntax highlighting inside strings: > 3088 3089 let php_htmlInStrings = 1 3090 3091 Using the old colorstyle: > 3092 3093 let php_oldStyle = 1 3094 3095 Enable highlighting ASP-style short tags: > 3096 3097 let php_asp_tags = 1 3098 3099 Disable short tags: > 3100 3101 let php_noShortTags = 1 3102 3103 For highlighting parent error ] or ): > 3104 3105 let php_parent_error_close = 1 3106 3107 For skipping a php end tag, if there exists an open ( or [ without a closing 3108 one: > 3109 3110 let php_parent_error_open = 1 3111 3112 Enable folding for classes and functions: > 3113 3114 let php_folding = 1 3115 3116 Selecting syncing method: > 3117 3118 let php_sync_method = x 3119 3120 x = -1 to sync by search (default), 3121 x > 0 to sync at least x lines backwards, 3122 x = 0 to sync from start. 3123 3124 3125 PLAINTEX *plaintex.vim* *ft-plaintex-syntax* 3126 3127 TeX is a typesetting language, and plaintex is the file type for the "plain" 3128 variant of TeX. If you never want your *.tex files recognized as plain TeX, 3129 see |ft-tex-plugin|. 3130 3131 This syntax file has the option > 3132 3133 let g:plaintex_delimiters = 1 3134 3135 if you want to highlight brackets "[]" and braces "{}". 3136 3137 3138 PPWIZARD *ppwiz.vim* *ft-ppwiz-syntax* 3139 3140 PPWizard is a preprocessor for HTML and OS/2 INF files 3141 3142 This syntax file has the options: 3143 3144 - ppwiz_highlight_defs : Determines highlighting mode for PPWizard's 3145 definitions. Possible values are 3146 3147 ppwiz_highlight_defs = 1 : PPWizard #define statements retain the 3148 colors of their contents (e.g. PPWizard macros and variables). 3149 3150 ppwiz_highlight_defs = 2 : Preprocessor #define and #evaluate 3151 statements are shown in a single color with the exception of line 3152 continuation symbols. 3153 3154 The default setting for ppwiz_highlight_defs is 1. 3155 3156 - ppwiz_with_html : If the value is 1 (the default), highlight literal 3157 HTML code; if 0, treat HTML code like ordinary text. 3158 3159 3160 PHTML *phtml.vim* *ft-phtml-syntax* 3161 3162 There are two options for the phtml syntax highlighting. 3163 3164 If you like SQL syntax highlighting inside Strings, use this: > 3165 3166 :let phtml_sql_query = 1 3167 3168 For syncing, minlines defaults to 100. If you prefer another value, you can 3169 set "phtml_minlines" to the value you desire. Example: > 3170 3171 :let phtml_minlines = 200 3172 3173 3174 POSTSCRIPT *postscr.vim* *ft-postscr-syntax* 3175 3176 There are several options when it comes to highlighting PostScript. 3177 3178 First which version of the PostScript language to highlight. There are 3179 currently three defined language versions, or levels. Level 1 is the original 3180 and base version, and includes all extensions prior to the release of level 2. 3181 Level 2 is the most common version around, and includes its own set of 3182 extensions prior to the release of level 3. Level 3 is currently the highest 3183 level supported. You select which level of the PostScript language you want 3184 highlighted by defining the postscr_level variable as follows: > 3185 3186 :let postscr_level=2 3187 3188 If this variable is not defined it defaults to 2 (level 2) since this is 3189 the most prevalent version currently. 3190 3191 Note: Not all PS interpreters will support all language features for a 3192 particular language level. In particular the %!PS-Adobe-3.0 at the start of 3193 PS files does NOT mean the PostScript present is level 3 PostScript! 3194 3195 If you are working with Display PostScript, you can include highlighting of 3196 Display PS language features by defining the postscr_display variable as 3197 follows: > 3198 3199 :let postscr_display=1 3200 3201 If you are working with Ghostscript, you can include highlighting of 3202 Ghostscript specific language features by defining the variable 3203 postscr_ghostscript as follows: > 3204 3205 :let postscr_ghostscript=1 3206 3207 PostScript is a large language, with many predefined elements. While it 3208 useful to have all these elements highlighted, on slower machines this can 3209 cause Vim to slow down. In an attempt to be machine friendly font names and 3210 character encodings are not highlighted by default. Unless you are working 3211 explicitly with either of these this should be ok. If you want them to be 3212 highlighted you should set one or both of the following variables: > 3213 3214 :let postscr_fonts=1 3215 :let postscr_encodings=1 3216 3217 There is a stylistic option to the highlighting of and, or, and not. In 3218 PostScript the function of these operators depends on the types of their 3219 operands - if the operands are booleans then they are the logical operators, 3220 if they are integers then they are binary operators. As binary and logical 3221 operators can be highlighted differently they have to be highlighted one way 3222 or the other. By default they are treated as logical operators. They can be 3223 highlighted as binary operators by defining the variable 3224 postscr_andornot_binary as follows: > 3225 3226 :let postscr_andornot_binary=1 3227 < 3228 3229 *ptcap.vim* *ft-printcap-syntax* 3230 PRINTCAP + TERMCAP *ft-ptcap-syntax* *ft-termcap-syntax* 3231 3232 This syntax file applies to the printcap and termcap databases. 3233 3234 In order for Vim to recognize printcap/termcap files that do not match 3235 the patterns "*printcap*", or "*termcap*", you must put additional patterns 3236 appropriate to your system in your |myfiletypefile| file. For these 3237 patterns, you must set the variable "b:ptcap_type" to either "print" or 3238 "term", and then the 'filetype' option to ptcap. 3239 3240 For example, to make Vim identify all files in /etc/termcaps/ as termcap 3241 files, add the following: > 3242 3243 :au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" | 3244 \ set filetype=ptcap 3245 3246 If you notice highlighting errors while scrolling backwards, which 3247 are fixed when redrawing with CTRL-L, try setting the "ptcap_minlines" 3248 internal variable to a larger number: > 3249 3250 :let ptcap_minlines = 50 3251 3252 (The default is 20 lines.) 3253 3254 3255 PROGRESS *progress.vim* *ft-progress-syntax* 3256 3257 Files matching "*.w" could be Progress or cweb. If the automatic detection 3258 doesn't work for you, or you don't edit cweb at all, use this in your 3259 startup vimrc: > 3260 :let filetype_w = "progress" 3261 The same happens for "*.i", which could be assembly, and "*.p", which could be 3262 Pascal. Use this if you don't use assembly and Pascal: > 3263 :let filetype_i = "progress" 3264 :let filetype_p = "progress" 3265 3266 3267 PYTHON *python.vim* *ft-python-syntax* 3268 3269 There are seven options to control Python syntax highlighting. 3270 3271 For highlighted numbers: > 3272 :let python_no_number_highlight = 1 3273 3274 For highlighted builtin functions: > 3275 :let python_no_builtin_highlight = 1 3276 3277 For highlighted standard exceptions: > 3278 :let python_no_exception_highlight = 1 3279 3280 For highlighted doctests and code inside: > 3281 :let python_no_doctest_highlight = 1 3282 or > 3283 :let python_no_doctest_code_highlight = 1 3284 The first option implies the second one. 3285 3286 For highlighted trailing whitespace and mix of spaces and tabs: > 3287 :let python_space_error_highlight = 1 3288 3289 For highlighted built-in constants distinguished from other keywords: > 3290 :let python_constant_highlight = 1 3291 3292 If you want all possible Python highlighting: > 3293 :let python_highlight_all = 1 3294 This has the same effect as setting python_space_error_highlight, 3295 python_constant_highlight and unsetting all the other ones. 3296 3297 If you use Python 2 or straddling code (Python 2 and 3 compatible), 3298 you can enforce the use of an older syntax file with support for 3299 Python 2 and up to Python 3.5. > 3300 :let python_use_python2_syntax = 1 3301 This option will exclude all modern Python 3.6 or higher features. 3302 3303 Note: Only existence of these options matters, not their value. 3304 You can replace 1 above with anything. 3305 3306 3307 QUAKE *quake.vim* *ft-quake-syntax* 3308 3309 The Quake syntax definition should work for most FPS (First Person Shooter) 3310 based on one of the Quake engines. However, the command names vary a bit 3311 between the three games (Quake, Quake 2, and Quake 3 Arena) so the syntax 3312 definition checks for the existence of three global variables to allow users 3313 to specify what commands are legal in their files. The three variables can 3314 be set for the following effects: 3315 3316 set to highlight commands only available in Quake: > 3317 :let quake_is_quake1 = 1 3318 3319 set to highlight commands only available in Quake 2: > 3320 :let quake_is_quake2 = 1 3321 3322 set to highlight commands only available in Quake 3 Arena: > 3323 :let quake_is_quake3 = 1 3324 3325 Any combination of these three variables is legal, but might highlight more 3326 commands than are actually available to you by the game. 3327 3328 3329 R *r.vim* *ft-r-syntax* 3330 3331 The parsing of R code for syntax highlight starts 40 lines backwards, but you 3332 can set a different value in your |vimrc|. Example: > 3333 let r_syntax_minlines = 60 3334 3335 You can also turn off syntax highlighting of ROxygen: > 3336 let r_syntax_hl_roxygen = 0 3337 3338 enable folding of code delimited by parentheses, square brackets and curly 3339 braces: > 3340 let r_syntax_folding = 1 3341 3342 and highlight as functions all keywords followed by an opening parenthesis: > 3343 let r_syntax_fun_pattern = 1 3344 3345 3346 R MARKDOWN *rmd.vim* *ft-rmd-syntax* 3347 3348 To disable syntax highlight of YAML header, add to your |vimrc|: > 3349 let rmd_syn_hl_yaml = 0 3350 3351 To disable syntax highlighting of citation keys: > 3352 let rmd_syn_hl_citations = 0 3353 3354 To highlight R code in knitr chunk headers: > 3355 let rmd_syn_hl_chunk = 1 3356 3357 By default, chunks of R code will be highlighted following the rules of R 3358 language. Moreover, whenever the buffer is saved, Vim scans the buffer and 3359 highlights other languages if they are present in new chunks. LaTeX code also 3360 is automatically recognized and highlighted when the buffer is saved. This 3361 behavior can be controlled with the variables `rmd_dynamic_fenced_languages`, 3362 and `rmd_include_latex` whose valid values are: > 3363 let rmd_dynamic_fenced_languages = 0 " No autodetection of languages 3364 let rmd_dynamic_fenced_languages = 1 " Autodetection of languages 3365 let rmd_include_latex = 0 " Don't highlight LaTeX code 3366 let rmd_include_latex = 1 " Autodetect LaTeX code 3367 let rmd_include_latex = 2 " Always include LaTeX highlighting 3368 3369 If the value of `rmd_dynamic_fenced_languages` is 0, you still can set the 3370 list of languages whose chunks of code should be properly highlighted, as in 3371 the example: > 3372 let rmd_fenced_languages = ['r', 'python'] 3373 3374 3375 R RESTRUCTURED TEXT *rrst.vim* *ft-rrst-syntax* 3376 3377 To highlight R code in knitr chunk headers, add to your |vimrc|: > 3378 let rrst_syn_hl_chunk = 1 3379 3380 3381 RASI *rasi.vim* *ft-rasi-syntax* 3382 3383 Rasi stands for Rofi Advanced Style Information. It is used by the program 3384 rofi to style the rendering of the search window. The language is heavily 3385 inspired by CSS stylesheet. Files with the following extensions are 3386 recognized as rasi files: .rasi. 3387 3388 READLINE *readline.vim* *ft-readline-syntax* 3389 3390 The readline library is primarily used by the BASH shell, which adds quite a 3391 few commands and options to the ones already available. To highlight these 3392 items as well you can add the following to your |vimrc| or just type it in the 3393 command line before loading a file with the readline syntax: > 3394 let readline_has_bash = 1 3395 3396 This will add highlighting for the commands that BASH (version 2.05a and 3397 later, and part earlier) adds. 3398 3399 3400 REGO *rego.vim* *ft-rego-syntax* 3401 3402 Rego is a query language developed by Styra. It is mostly used as a policy 3403 language for kubernetes, but can be applied to almost anything. Files with 3404 the following extensions are recognized as rego files: .rego. 3405 3406 3407 RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* 3408 3409 Syntax highlighting is enabled for code blocks within the document for a 3410 select number of file types. See $VIMRUNTIME/syntax/rst.vim for the default 3411 syntax list. 3412 3413 To set a user-defined list of code block syntax highlighting: > 3414 let rst_syntax_code_list = ['vim', 'lisp', ...] 3415 3416 To assign multiple code block types to a single syntax, define 3417 `rst_syntax_code_list` as a mapping: > 3418 let rst_syntax_code_list = { 3419 \ 'cpp': ['cpp', 'c++'], 3420 \ 'bash': ['bash', 'sh'], 3421 ... 3422 \ } 3423 3424 To use color highlighting for emphasis text: > 3425 let rst_use_emphasis_colors = 1 3426 3427 To enable folding of sections: > 3428 let rst_fold_enabled = 1 3429 3430 Note that folding can cause performance issues on some platforms. 3431 3432 The minimum line syntax sync is set to 50. To modify this number: > 3433 let rst_minlines = 100 3434 3435 3436 REXX *rexx.vim* *ft-rexx-syntax* 3437 3438 If you notice highlighting errors while scrolling backwards, which are fixed 3439 when redrawing with CTRL-L, try setting the "rexx_minlines" internal variable 3440 to a larger number: > 3441 :let rexx_minlines = 50 3442 This will make the syntax synchronization start 50 lines before the first 3443 displayed line. The default value is 10. The disadvantage of using a larger 3444 number is that redrawing can become slow. 3445 3446 Vim tries to guess what type a ".r" file is. If it can't be detected (from 3447 comment lines), the default is "r". To make the default rexx add this line to 3448 your .vimrc: *g:filetype_r* 3449 > 3450 :let g:filetype_r = "r" 3451 3452 3453 RUBY *ruby.vim* *ft-ruby-syntax* 3454 3455 Ruby: Operator highlighting |ruby_operators| 3456 Ruby: Whitespace errors |ruby_space_errors| 3457 Ruby: Folding |ruby_fold| |ruby_foldable_groups| 3458 Ruby: Reducing expensive operations |ruby_no_expensive| |ruby_minlines| 3459 Ruby: Spellchecking strings |ruby_spellcheck_strings| 3460 3461 *ruby_operators* 3462 Ruby: Operator highlighting ~ 3463 3464 Operators can be highlighted by defining "ruby_operators": > 3465 3466 :let ruby_operators = 1 3467 < 3468 *ruby_space_errors* 3469 Ruby: Whitespace errors ~ 3470 3471 Whitespace errors can be highlighted by defining "ruby_space_errors": > 3472 3473 :let ruby_space_errors = 1 3474 < 3475 This will highlight trailing whitespace and tabs preceded by a space character 3476 as errors. This can be refined by defining "ruby_no_trail_space_error" and 3477 "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after 3478 spaces respectively. 3479 3480 *ruby_fold* *ruby_foldable_groups* 3481 Ruby: Folding ~ 3482 3483 Folding can be enabled by defining "ruby_fold": > 3484 3485 :let ruby_fold = 1 3486 < 3487 This will set the value of 'foldmethod' to "syntax" locally to the current 3488 buffer or window, which will enable syntax-based folding when editing Ruby 3489 filetypes. 3490 3491 Default folding is rather detailed, i.e., small syntax units like "if", "do", 3492 "%w[]" may create corresponding fold levels. 3493 3494 You can set "ruby_foldable_groups" to restrict which groups are foldable: > 3495 3496 :let ruby_foldable_groups = 'if case %' 3497 < 3498 The value is a space-separated list of keywords: 3499 3500 keyword meaning ~ 3501 -------- ------------------------------------- ~ 3502 ALL Most block syntax (default) 3503 NONE Nothing 3504 if "if" or "unless" block 3505 def "def" block 3506 class "class" block 3507 module "module" block 3508 do "do" block 3509 begin "begin" block 3510 case "case" block 3511 for "for", "while", "until" loops 3512 { Curly bracket block or hash literal 3513 [ Array literal 3514 % Literal with "%" notation, e.g.: %w(STRING), %!STRING! 3515 / Regexp 3516 string String and shell command output (surrounded by ', ", `) 3517 : Symbol 3518 # Multiline comment 3519 << Here documents 3520 __END__ Source code after "__END__" directive 3521 3522 *ruby_no_expensive* 3523 Ruby: Reducing expensive operations ~ 3524 3525 By default, the "end" keyword is colorized according to the opening statement 3526 of the block it closes. While useful, this feature can be expensive; if you 3527 experience slow redrawing (or you are on a terminal with poor color support) 3528 you may want to turn it off by defining the "ruby_no_expensive" variable: > 3529 3530 :let ruby_no_expensive = 1 3531 < 3532 In this case the same color will be used for all control keywords. 3533 3534 *ruby_minlines* 3535 3536 If you do want this feature enabled, but notice highlighting errors while 3537 scrolling backwards, which are fixed when redrawing with CTRL-L, try setting 3538 the "ruby_minlines" variable to a value larger than 50: > 3539 3540 :let ruby_minlines = 100 3541 < 3542 Ideally, this value should be a number of lines large enough to embrace your 3543 largest class or module. 3544 3545 *ruby_spellcheck_strings* 3546 Ruby: Spellchecking strings ~ 3547 3548 Ruby syntax will perform spellchecking of strings if you define 3549 "ruby_spellcheck_strings": > 3550 3551 :let ruby_spellcheck_strings = 1 3552 < 3553 3554 SCHEME *scheme.vim* *ft-scheme-syntax* 3555 3556 By default only R7RS keywords are highlighted and properly indented. 3557 3558 scheme.vim also supports extensions of the CHICKEN Scheme->C compiler. 3559 Define b:is_chicken or g:is_chicken, if you need them. 3560 3561 3562 SDL *sdl.vim* *ft-sdl-syntax* 3563 3564 The SDL highlighting probably misses a few keywords, but SDL has so many 3565 of them it's almost impossibly to cope. 3566 3567 The new standard, SDL-2000, specifies that all identifiers are 3568 case-sensitive (which was not so before), and that all keywords can be 3569 used either completely lowercase or completely uppercase. To have the 3570 highlighting reflect this, you can set the following variable: > 3571 :let sdl_2000=1 3572 3573 This also sets many new keywords. If you want to disable the old 3574 keywords, which is probably a good idea, use: > 3575 :let SDL_no_96=1 3576 3577 3578 The indentation is probably also incomplete, but right now I am very 3579 satisfied with it for my own projects. 3580 3581 3582 SED *sed.vim* *ft-sed-syntax* 3583 3584 To make tabs stand out from regular blanks (accomplished by using Todo 3585 highlighting on the tabs), define "g:sed_highlight_tabs" by putting > 3586 3587 :let g:sed_highlight_tabs = 1 3588 < 3589 in the vimrc file. (This special highlighting only applies for tabs 3590 inside search patterns, replacement texts, addresses or text included 3591 by an Append/Change/Insert command.) If you enable this option, it is 3592 also a good idea to set the tab width to one character; by doing that, 3593 you can easily count the number of tabs in a string. 3594 3595 GNU sed allows comments after text on the same line. BSD sed only allows 3596 comments where "#" is the first character of the line. To enforce BSD-style 3597 comments, i.e. mark end-of-line comments as errors, use: > 3598 3599 :let g:sed_dialect = "bsd" 3600 < 3601 Note that there are other differences between GNU sed and BSD sed which are 3602 not (yet) affected by this setting. 3603 3604 Bugs: 3605 3606 The transform command (y) is treated exactly like the substitute 3607 command. This means that, as far as this syntax file is concerned, 3608 transform accepts the same flags as substitute, which is wrong. 3609 (Transform accepts no flags.) I tolerate this bug because the 3610 involved commands need very complex treatment (95 patterns, one for 3611 each plausible pattern delimiter). 3612 3613 3614 SGML *sgml.vim* *ft-sgml-syntax* 3615 3616 The coloring scheme for tags in the SGML file works as follows. 3617 3618 The <> of opening tags are colored differently than the </> of a closing tag. 3619 This is on purpose! For opening tags the 'Function' color is used, while for 3620 closing tags the 'Type' color is used (See syntax.vim to check how those are 3621 defined for you) 3622 3623 Known tag names are colored the same way as statements in C. Unknown tag 3624 names are not colored which makes it easy to spot errors. 3625 3626 Note that the same is true for argument (or attribute) names. Known attribute 3627 names are colored differently than unknown ones. 3628 3629 Some SGML tags are used to change the rendering of text. The following tags 3630 are recognized by the sgml.vim syntax coloring file and change the way normal 3631 text is shown: <varname> <emphasis> <command> <function> <literal> 3632 <replaceable> <ulink> and <link>. 3633 3634 If you want to change how such text is rendered, you must redefine the 3635 following syntax groups: 3636 3637 - sgmlBold 3638 - sgmlBoldItalic 3639 - sgmlUnderline 3640 - sgmlItalic 3641 - sgmlLink for links 3642 3643 To make this redefinition work you must redefine them all and define the 3644 following variable in your vimrc (this is due to the order in which the files 3645 are read during initialization) > 3646 let sgml_my_rendering=1 3647 3648 You can also disable this rendering by adding the following line to your 3649 vimrc file: > 3650 let sgml_no_rendering=1 3651 3652 (Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>) 3653 3654 3655 *ft-posix-syntax* *ft-dash-syntax* 3656 SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax* 3657 3658 This covers syntax highlighting for the older Unix (Bourne) sh, and newer 3659 shells such as bash, dash, posix, and the Korn shells. 3660 3661 Vim attempts to determine which shell type is in use by specifying that 3662 various filenames are of specific types, e.g.: > 3663 3664 ksh : .kshrc* *.ksh 3665 bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash 3666 < 3667 See $VIMRUNTIME/filetype.vim for the full list of patterns. If none of these 3668 cases pertain, then the first line of the file is examined (ex. looking for 3669 /bin/sh /bin/ksh /bin/bash). If the first line specifies a shelltype, then 3670 that shelltype is used. However some files (ex. .profile) are known to be 3671 shell files but the type is not apparent. Furthermore, on many systems sh is 3672 symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" (POSIX). 3673 3674 One may specify a global default by instantiating one of the following 3675 variables in your <.vimrc>: 3676 3677 ksh: > 3678 let g:is_kornshell = 1 3679 < posix: (default) > 3680 let g:is_posix = 1 3681 < bash: > 3682 let g:is_bash = 1 3683 < dash: > 3684 let g:is_dash = 1 3685 < sh: Bourne shell > 3686 let g:is_sh = 1 3687 3688 Specific shell features are automatically enabled based on the shell detected 3689 from the shebang line ("#! ..."). For KornShell Vim detects different shell 3690 features for mksh, ksh88, ksh93, ksh93u, ksh93v, and ksh2020. 3691 3692 If there's no "#! ..." line, and the user hasn't availed himself/herself of a 3693 default sh.vim syntax setting as just shown, then syntax/sh.vim will assume 3694 the POSIX shell syntax. No need to quote RFCs or market penetration 3695 statistics in error reports, please -- just select the default version of the 3696 sh your system uses and install the associated "let..." in your <.vimrc>. 3697 3698 The syntax/sh.vim file provides several levels of syntax-based folding: > 3699 3700 let g:sh_fold_enabled= 0 (default, no syntax folding) 3701 let g:sh_fold_enabled= 1 (enable function folding) 3702 let g:sh_fold_enabled= 2 (enable heredoc folding) 3703 let g:sh_fold_enabled= 4 (enable if/do/for folding) 3704 > 3705 then various syntax items (ie. HereDocuments and function bodies) become 3706 syntax-foldable (see |:syn-fold|). You also may add these together 3707 to get multiple types of folding: > 3708 3709 let g:sh_fold_enabled= 3 (enables function and heredoc folding) 3710 3711 If you notice highlighting errors while scrolling backwards which are fixed 3712 when one redraws with CTRL-L, try setting the "sh_minlines" internal variable 3713 to a larger number. Example: > 3714 3715 let sh_minlines = 500 3716 3717 This will make syntax synchronization start 500 lines before the first 3718 displayed line. The default value is 200. The disadvantage of using a larger 3719 number is that redrawing can become slow. 3720 3721 If you don't have much to synchronize on, displaying can be very slow. To 3722 reduce this, the "sh_maxlines" internal variable can be set. Example: > 3723 3724 let sh_maxlines = 100 3725 < 3726 The default is to use the twice sh_minlines. Set it to a smaller number to 3727 speed up displaying. The disadvantage is that highlight errors may appear. 3728 3729 Unmatched "]", "done", "fi", etc., are highlighted as errors by default. If 3730 you find this error handling problematic, you may suppress it with: > 3731 3732 let g:sh_no_error = 1 3733 < 3734 As a refinement, you may suppress particular classes of errors by looking up 3735 their syntax rule names and listing them with: > 3736 3737 let g:sh_no_error_rules = ["shCurlyError", "shParenError"] 3738 < 3739 3740 *sh-embed* *sh-awk* 3741 Sh: EMBEDDING LANGUAGES~ 3742 3743 You may wish to embed languages into sh. I'll give an example courtesy of 3744 Lorance Stinson on how to do this with awk as an example. Put the following 3745 file into $HOME/.vim/after/syntax/sh/awkembed.vim: > 3746 3747 " AWK Embedding: 3748 " ============== 3749 " Shamelessly ripped from aspperl.vim by Aaron Hope. 3750 if exists("b:current_syntax") 3751 unlet b:current_syntax 3752 endif 3753 syn include @AWKScript syntax/awk.vim 3754 syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@<!'+ skip=+\\'+ end=+'+ contains=@AWKScript contained 3755 syn region AWKScriptEmbedded matchgroup=AWKCommand start=+\<awk\>+ skip=+\\$+ end=+[=\\]\@<!'+me=e-1 contains=@shIdList,@shExprList2 nextgroup=AWKScriptCode 3756 syn cluster shCommandSubList add=AWKScriptEmbedded 3757 hi def link AWKCommand Type 3758 < 3759 This code will then let the awk code in the single quotes: > 3760 awk '...awk code here...' 3761 be highlighted using the awk highlighting syntax. Clearly this may be 3762 extended to other languages. 3763 3764 3765 SPEEDUP *spup.vim* *ft-spup-syntax* 3766 (AspenTech plant simulator) 3767 3768 The Speedup syntax file has some options: 3769 3770 - strict_subsections : If this variable is defined, only keywords for 3771 sections and subsections will be highlighted as statements but not 3772 other keywords (like WITHIN in the OPERATION section). 3773 3774 - highlight_types : Definition of this variable causes stream types 3775 like temperature or pressure to be highlighted as Type, not as a 3776 plain Identifier. Included are the types that are usually found in 3777 the DECLARE section; if you defined own types, you have to include 3778 them in the syntax file. 3779 3780 - oneline_comments : This value ranges from 1 to 3 and determines the 3781 highlighting of # style comments. 3782 3783 oneline_comments = 1 : Allow normal Speedup code after an even 3784 number of #s. 3785 3786 oneline_comments = 2 : Show code starting with the second # as 3787 error. This is the default setting. 3788 3789 oneline_comments = 3 : Show the whole line as error if it contains 3790 more than one #. 3791 3792 Since especially OPERATION sections tend to become very large due to 3793 PRESETting variables, syncing may be critical. If your computer is 3794 fast enough, you can increase minlines and/or maxlines near the end of 3795 the syntax file. 3796 3797 3798 SQL *sql.vim* *ft-sql-syntax* 3799 *sqlinformix.vim* *ft-sqlinformix-syntax* 3800 *sqlanywhere.vim* *ft-sqlanywhere-syntax* 3801 3802 While there is an ANSI standard for SQL, most database engines add their own 3803 custom extensions. Vim currently supports the Oracle and Informix dialects of 3804 SQL. Vim assumes "*.sql" files are Oracle SQL by default. 3805 3806 Vim currently has SQL support for a variety of different vendors via syntax 3807 scripts. You can change Vim's default from Oracle to any of the current SQL 3808 supported types. You can also easily alter the SQL dialect being used on a 3809 buffer by buffer basis. 3810 3811 For more detailed instructions see |ft_sql.txt|. 3812 3813 3814 SQUIRREL *squirrel.vim* *ft-squirrel-syntax* 3815 3816 Squirrel is a high level imperative, object-oriented programming language, 3817 designed to be a light-weight scripting language that fits in the size, memory 3818 bandwidth, and real-time requirements of applications like video games. Files 3819 with the following extensions are recognized as squirrel files: .nut. 3820 3821 3822 TCSH *tcsh.vim* *ft-tcsh-syntax* 3823 3824 This covers the shell named "tcsh". It is a superset of csh. See |csh.vim| 3825 for how the filetype is detected. 3826 3827 Tcsh does not allow \" in strings unless the "backslash_quote" shell variable 3828 is set. If you want VIM to assume that no backslash quote constructs exist 3829 add this line to your .vimrc: > 3830 3831 :let tcsh_backslash_quote = 0 3832 3833 If you notice highlighting errors while scrolling backwards, which are fixed 3834 when redrawing with CTRL-L, try setting the "tcsh_minlines" internal variable 3835 to a larger number: > 3836 3837 :let tcsh_minlines = 1000 3838 3839 This will make the syntax synchronization start 1000 lines before the first 3840 displayed line. If you set "tcsh_minlines" to "fromstart", then 3841 synchronization is done from the start of the file. The default value for 3842 tcsh_minlines is 100. The disadvantage of using a larger number is that 3843 redrawing can become slow. 3844 3845 3846 TEX *tex.vim* *ft-tex-syntax* *latex-syntax* 3847 *syntax-tex* *syntax-latex* 3848 3849 Tex Contents~ 3850 Tex: Want Syntax Folding? |tex-folding| 3851 Tex: No Spell Checking Wanted |g:tex_nospell| 3852 Tex: Don't Want Spell Checking In Comments? |tex-nospell| 3853 Tex: Want Spell Checking in Verbatim Zones? |tex-verb| 3854 Tex: Run-on Comments or MathZones |tex-runon| 3855 Tex: Slow Syntax Highlighting? |tex-slow| 3856 Tex: Want To Highlight More Commands? |tex-morecommands| 3857 Tex: Excessive Error Highlighting? |tex-error| 3858 Tex: Need a new Math Group? |tex-math| 3859 Tex: Starting a New Style? |tex-style| 3860 Tex: Taking Advantage of Conceal Mode |tex-conceal| 3861 Tex: Selective Conceal Mode |g:tex_conceal| 3862 Tex: Controlling iskeyword |g:tex_isk| 3863 Tex: Fine Subscript and Superscript Control |tex-supersub| 3864 Tex: Match Check Control |tex-matchcheck| 3865 3866 *tex-folding* *g:tex_fold_enabled* 3867 Tex: Want Syntax Folding? ~ 3868 3869 As of version 28 of <syntax/tex.vim>, syntax-based folding of parts, chapters, 3870 sections, subsections, etc are supported. Put > 3871 let g:tex_fold_enabled=1 3872 in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a 3873 modeline at the end of your LaTeX file: > 3874 % vim: fdm=syntax 3875 If your system becomes too slow, then you might wish to look into > 3876 https://vimhelp.org/vim_faq.txt.html#faq-29.7 3877 < 3878 *g:tex_nospell* 3879 Tex: No Spell Checking Wanted~ 3880 3881 If you don't want spell checking anywhere in your LaTeX document, put > 3882 let g:tex_nospell=1 3883 into your .vimrc. If you merely wish to suppress spell checking inside 3884 comments only, see |g:tex_comment_nospell|. 3885 3886 *tex-nospell* *g:tex_comment_nospell* 3887 Tex: Don't Want Spell Checking In Comments? ~ 3888 3889 Some folks like to include things like source code in comments and so would 3890 prefer that spell checking be disabled in comments in LaTeX files. To do 3891 this, put the following in your <.vimrc>: > 3892 let g:tex_comment_nospell= 1 3893 If you want to suppress spell checking everywhere inside your LaTeX document, 3894 see |g:tex_nospell|. 3895 3896 *tex-verb* *g:tex_verbspell* 3897 Tex: Want Spell Checking in Verbatim Zones?~ 3898 3899 Often verbatim regions are used for things like source code; seldom does 3900 one want source code spell-checked. However, for those of you who do 3901 want your verbatim zones spell-checked, put the following in your <.vimrc>: > 3902 let g:tex_verbspell= 1 3903 < 3904 *tex-runon* *tex-stopzone* 3905 Tex: Run-on Comments or MathZones ~ 3906 3907 The <syntax/tex.vim> highlighting supports TeX, LaTeX, and some AmsTeX. The 3908 highlighting supports three primary zones/regions: normal, texZone, and 3909 texMathZone. Although considerable effort has been made to have these zones 3910 terminate properly, zones delineated by $..$ and $$..$$ cannot be synchronized 3911 as there's no difference between start and end patterns. Consequently, a 3912 special "TeX comment" has been provided > 3913 %stopzone 3914 which will forcibly terminate the highlighting of either a texZone or a 3915 texMathZone. 3916 3917 *tex-slow* *tex-sync* 3918 Tex: Slow Syntax Highlighting? ~ 3919 3920 If you have a slow computer, you may wish to reduce the values for > 3921 :syn sync maxlines=200 3922 :syn sync minlines=50 3923 (especially the latter). If your computer is fast, you may wish to 3924 increase them. This primarily affects synchronizing (i.e. just what group, 3925 if any, is the text at the top of the screen supposed to be in?). 3926 3927 Another cause of slow highlighting is due to syntax-driven folding; see 3928 |tex-folding| for a way around this. 3929 3930 *g:tex_fast* 3931 3932 Finally, if syntax highlighting is still too slow, you may set > 3933 3934 :let g:tex_fast= "" 3935 3936 in your .vimrc. Used this way, the g:tex_fast variable causes the syntax 3937 highlighting script to avoid defining any regions and associated 3938 synchronization. The result will be much faster syntax highlighting; the 3939 price: you will no longer have as much highlighting or any syntax-based 3940 folding, and you will be missing syntax-based error checking. 3941 3942 You may decide that some syntax is acceptable; you may use the following table 3943 selectively to enable just some syntax highlighting: > 3944 3945 b : allow bold and italic syntax 3946 c : allow texComment syntax 3947 m : allow texMatcher syntax (ie. {...} and [...]) 3948 M : allow texMath syntax 3949 p : allow parts, chapter, section, etc syntax 3950 r : allow texRefZone syntax (nocite, bibliography, label, pageref, eqref) 3951 s : allow superscript/subscript regions 3952 S : allow texStyle syntax 3953 v : allow verbatim syntax 3954 V : allow texNewEnv and texNewCmd syntax 3955 < 3956 As an example, let g:tex_fast= "M" will allow math-associated highlighting 3957 but suppress all the other region-based syntax highlighting. 3958 (also see: |g:tex_conceal| and |tex-supersub|) 3959 3960 *tex-morecommands* *tex-package* 3961 Tex: Want To Highlight More Commands? ~ 3962 3963 LaTeX is a programmable language, and so there are thousands of packages full 3964 of specialized LaTeX commands, syntax, and fonts. If you're using such a 3965 package you'll often wish that the distributed syntax/tex.vim would support 3966 it. However, clearly this is impractical. So please consider using the 3967 techniques in |mysyntaxfile-add| to extend or modify the highlighting provided 3968 by syntax/tex.vim. Please consider uploading any extensions that you write, 3969 which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to 3970 http://vim.sf.net/. 3971 3972 I've included some support for various popular packages on my website: > 3973 3974 http://www.drchip.org/astronaut/vim/index.html#LATEXPKGS 3975 < 3976 The syntax files there go into your .../after/syntax/tex/ directory. 3977 3978 *tex-error* *g:tex_no_error* 3979 Tex: Excessive Error Highlighting? ~ 3980 3981 The <tex.vim> supports lexical error checking of various sorts. Thus, 3982 although the error checking is ofttimes very useful, it can indicate 3983 errors where none actually are. If this proves to be a problem for you, 3984 you may put in your <.vimrc> the following statement: > 3985 let g:tex_no_error=1 3986 and all error checking by <syntax/tex.vim> will be suppressed. 3987 3988 *tex-math* 3989 Tex: Need a new Math Group? ~ 3990 3991 If you want to include a new math group in your LaTeX, the following 3992 code shows you an example as to how you might do so: > 3993 call TexNewMathZone(sfx,mathzone,starform) 3994 You'll want to provide the new math group with a unique suffix 3995 (currently, A-L and V-Z are taken by <syntax/tex.vim> itself). 3996 As an example, consider how eqnarray is set up by <syntax/tex.vim>: > 3997 call TexNewMathZone("D","eqnarray",1) 3998 You'll need to change "mathzone" to the name of your new math group, 3999 and then to the call to it in .vim/after/syntax/tex.vim. 4000 The "starform" variable, if true, implies that your new math group 4001 has a starred form (ie. eqnarray*). 4002 4003 *tex-style* *b:tex_stylish* 4004 Tex: Starting a New Style? ~ 4005 4006 One may use "\makeatletter" in *.tex files, thereby making the use of "@" in 4007 commands available. However, since the *.tex file doesn't have one of the 4008 following suffices: sty cls clo dtx ltx, the syntax highlighting will flag 4009 such use of @ as an error. To solve this: > 4010 4011 :let b:tex_stylish = 1 4012 :set ft=tex 4013 4014 Putting "let g:tex_stylish=1" into your <.vimrc> will make <syntax/tex.vim> 4015 always accept such use of @. 4016 4017 *tex-cchar* *tex-cole* *tex-conceal* 4018 Tex: Taking Advantage of Conceal Mode~ 4019 4020 If you have 'conceallevel' set to 2 and if your encoding is utf-8, then a 4021 number of character sequences can be translated into appropriate utf-8 glyphs, 4022 including various accented characters, Greek characters in MathZones, and 4023 superscripts and subscripts in MathZones. Not all characters can be made into 4024 superscripts or subscripts; the constraint is due to what utf-8 supports. 4025 In fact, only a few characters are supported as subscripts. 4026 4027 One way to use this is to have vertically split windows (see |CTRL-W_v|); one 4028 with 'conceallevel' at 0 and the other at 2; and both using 'scrollbind'. 4029 4030 *g:tex_conceal* 4031 Tex: Selective Conceal Mode~ 4032 4033 You may selectively use conceal mode by setting g:tex_conceal in your 4034 <.vimrc>. By default, g:tex_conceal is set to "admgs" to enable concealment 4035 for the following sets of characters: > 4036 4037 a = accents/ligatures 4038 b = bold and italic 4039 d = delimiters 4040 m = math symbols 4041 g = Greek 4042 s = superscripts/subscripts 4043 < 4044 By leaving one or more of these out, the associated conceal-character 4045 substitution will not be made. 4046 4047 *g:tex_isk* *g:tex_stylish* 4048 Tex: Controlling iskeyword~ 4049 4050 Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex 4051 keywords don't support the underscore - except when in *.sty files. The 4052 syntax highlighting script handles this with the following logic: 4053 4054 * If g:tex_stylish exists and is 1 4055 then the file will be treated as a "sty" file, so the "_" 4056 will be allowed as part of keywords 4057 (regardless of g:tex_isk) 4058 * Else if the file's suffix is sty, cls, clo, dtx, or ltx, 4059 then the file will be treated as a "sty" file, so the "_" 4060 will be allowed as part of keywords 4061 (regardless of g:tex_isk) 4062 4063 * If g:tex_isk exists, then it will be used for the local 'iskeyword' 4064 * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255 4065 4066 *tex-supersub* *g:tex_superscripts* *g:tex_subscripts* 4067 Tex: Fine Subscript and Superscript Control~ 4068 4069 See |tex-conceal| for how to enable concealed character replacement. 4070 4071 See |g:tex_conceal| for selectively concealing accents, bold/italic, 4072 math, Greek, and superscripts/subscripts. 4073 4074 One may exert fine control over which superscripts and subscripts one 4075 wants syntax-based concealment for (see |:syn-cchar|). Since not all 4076 fonts support all characters, one may override the 4077 concealed-replacement lists; by default these lists are given by: > 4078 4079 let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" 4080 let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" 4081 < 4082 For example, I use Luxi Mono Bold; it doesn't support subscript 4083 characters for "hklmnpst", so I put > 4084 let g:tex_subscripts= "[0-9aeijoruvx,+-/().]" 4085 < in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable 4086 utf-8 glyphs appear. 4087 4088 *tex-matchcheck* *g:tex_matchcheck* 4089 Tex: Match Check Control~ 4090 4091 Sometimes one actually wants mismatched parentheses, square braces, 4092 and or curly braces; for example, \text{(1,10]} is a range from but 4093 not including 1 to and including 10. This wish, of course, conflicts 4094 with the desire to provide delimiter mismatch detection. To 4095 accommodate these conflicting goals, syntax/tex.vim provides > 4096 g:tex_matchcheck = '[({[]' 4097 < which is shown along with its default setting. So, if one doesn't 4098 want [] and () to be checked for mismatches, try using > 4099 let g:tex_matchcheck= '[{}]' 4100 < If you don't want matching to occur inside bold and italicized 4101 regions, > 4102 let g:tex_excludematcher= 1 4103 < will prevent the texMatcher group from being included in those 4104 regions. 4105 4106 TF *tf.vim* *ft-tf-syntax* 4107 4108 There is one option for the tf syntax highlighting. 4109 4110 For syncing, minlines defaults to 100. If you prefer another value, you can 4111 set "tf_minlines" to the value you desire. Example: > 4112 4113 :let tf_minlines = your choice 4114 < 4115 TYPESCRIPT *typescript.vim* *ft-typescript-syntax* 4116 *typescriptreact.vim* *ft-typescriptreact-syntax* 4117 4118 There is one option to control the TypeScript syntax highlighting. 4119 4120 *g:typescript_host_keyword* 4121 When this variable is set to 1, host-specific APIs such as `addEventListener` 4122 are highlighted. To disable set it to zero in your .vimrc: > 4123 4124 let g:typescript_host_keyword = 0 4125 < 4126 The default value is 1. 4127 4128 TYPST *ft-typst-syntax* 4129 4130 *g:typst_embedded_languages* 4131 Typst files can embed syntax highlighting for other languages by setting the 4132 |g:typst_embedded_languages| variable. This variable is a list of language 4133 names whose syntax definitions will be included in Typst files. Example: > 4134 4135 let g:typst_embedded_languages = ['python', 'r'] 4136 4137 VIM *vim.vim* *ft-vim-syntax* 4138 *g:vimsyn_minlines* *g:vimsyn_maxlines* 4139 4140 There is a trade-off between more accurate syntax highlighting versus screen 4141 updating speed. To improve accuracy, you may wish to increase the 4142 g:vimsyn_minlines variable. The g:vimsyn_maxlines variable may be used to 4143 improve screen updating rates (see |:syn-sync| for more on this). > 4144 4145 g:vimsyn_minlines : used to set synchronization minlines 4146 g:vimsyn_maxlines : used to set synchronization maxlines 4147 < 4148 (g:vim_minlines and g:vim_maxlines are deprecated variants of 4149 these two options) 4150 4151 *g:vimsyn_embed* 4152 The g:vimsyn_embed option allows users to select what, if any, types of 4153 embedded script highlighting they wish to have. > 4154 4155 g:vimsyn_embed == 0 : don't support any embedded scripts 4156 g:vimsyn_embed =~# 'l' : support embedded Lua 4157 g:vimsyn_embed =~# 'm' : support embedded MzScheme 4158 g:vimsyn_embed =~# 'p' : support embedded Perl 4159 g:vimsyn_embed =~# 'P' : support embedded Python 4160 g:vimsyn_embed =~# 'r' : support embedded Ruby 4161 g:vimsyn_embed =~# 't' : support embedded Tcl 4162 < 4163 By default, g:vimsyn_embed is unset, and the Lua and Python script interfaces 4164 are supported. 4165 4166 *g:vimsyn_folding* 4167 Some folding is now supported with when 'foldmethod' is set to "syntax": > 4168 4169 g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding 4170 g:vimsyn_folding =~# 'a' : fold augroups 4171 g:vimsyn_folding =~# 'c' : fold Vim9 classes 4172 g:vimsyn_folding =~# 'e' : fold Vim9 enums 4173 g:vimsyn_folding =~# 'f' : fold functions 4174 g:vimsyn_folding =~# 'h' : fold let heredocs 4175 g:vimsyn_folding =~# 'i' : fold Vim9 interfaces 4176 g:vimsyn_folding =~# 'H' : fold Vim9 legacy headers 4177 g:vimsyn_folding =~# 'l' : fold Lua heredocs 4178 g:vimsyn_folding =~# 'm' : fold MzScheme heredocs 4179 g:vimsyn_folding =~# 'p' : fold Perl heredocs 4180 g:vimsyn_folding =~# 'P' : fold Python heredocs 4181 g:vimsyn_folding =~# 'r' : fold Ruby heredocs 4182 g:vimsyn_folding =~# 't' : fold Tcl heredocs 4183 g:vimsyn_folding =~# 'T' : fold :append, :change and :insert 4184 < 4185 4186 By default, g:vimsyn_folding is unset. Concatenate the indicated characters 4187 to support folding of multiple syntax constructs (e.g., 4188 g:vimsyn_folding = "fh" will enable folding of both functions and heredocs). 4189 4190 *g:vimsyn_comment_strings* 4191 By default, strings are highlighted inside comments. This may be disabled by 4192 setting g:vimsyn_comment_strings to false. 4193 4194 *g:vimsyn_noerror* 4195 Not all error highlighting that syntax/vim.vim does may be correct; Vim script 4196 is a difficult language to highlight correctly. A way to suppress error 4197 highlighting is to put the following line in your |vimrc|: > 4198 4199 let g:vimsyn_noerror = 1 4200 < 4201 To suppress only specific errors, define the following variables: > 4202 4203 g:vimsyn_nobehaveerror = 1 " :behave error 4204 g:vimsyn_vimFTError = 1 " :filetype error 4205 g:vimsyn_noaugrouperror = 1 " :augroup error 4206 g:vimsyn_noopererror = 1 " operator error 4207 g:vimsyn_notypealiaserror = 1 " Vim9 type alias error 4208 g:vimsyn_novimfunctionerror = 1 " Vim9 method error 4209 g:vimsyn_nousercmderror = 1 " :com error 4210 g:vimsyn_novimsynerror = 1 " :syn error 4211 g:vimsyn_novimsyncaseerror = 1 " :syn case error 4212 g:vimsyn_novimsynconcealerror = 1 " :syn conceal error 4213 g:vimsyn_novimsynfoldlevelerror = 1 " :syn foldlevel error 4214 g:vimsyn_novimsynspellerror = 1 " :syn spell error 4215 g:vimsyn_novimsyncerror = 1 " :syn sync error 4216 g:vimsyn_novimhictermerror = 1 " :hi error 4217 g:vimsyn_vimhikeyerror = 1 " :hi key=arg error 4218 < 4219 To force highlighting of Neovim specific Vim script elements (even if not 4220 using Neovim), set > 4221 4222 let g:vimsyn_vim_features = ['nvim'] 4223 < 4224 4225 WDL *wdl.vim* *wdl-syntax* 4226 4227 The Workflow Description Language is a way to specify data processing 4228 workflows with a human-readable and writeable syntax. This is used a lot in 4229 bioinformatics. More info on the spec can be found here: 4230 https://github.com/openwdl/wdl 4231 4232 4233 XF86CONFIG *xf86conf.vim* *ft-xf86conf-syntax* 4234 4235 The syntax of XF86Config file differs in XFree86 v3.x and v4.x. Both 4236 variants are supported. Automatic detection is used, but is far from perfect. 4237 You may need to specify the version manually. Set the variable 4238 xf86conf_xfree86_version to 3 or 4 according to your XFree86 version in 4239 your .vimrc. Example: > 4240 :let xf86conf_xfree86_version=3 4241 When using a mix of versions, set the b:xf86conf_xfree86_version variable. 4242 4243 Note that spaces and underscores in option names are not supported. Use 4244 "SyncOnGreen" instead of "__s yn con gr_e_e_n" if you want the option name 4245 highlighted. 4246 4247 4248 XML *xml.vim* *ft-xml-syntax* 4249 4250 Xml namespaces are highlighted by default. This can be inhibited by 4251 setting a global variable: > 4252 4253 :let g:xml_namespace_transparent=1 4254 < 4255 *xml-folding* 4256 The xml syntax file provides syntax |folding| (see |:syn-fold|) between 4257 start and end tags. This can be turned on by > 4258 4259 :let g:xml_syntax_folding = 1 4260 :set foldmethod=syntax 4261 4262 Note: Syntax folding might slow down syntax highlighting significantly, 4263 especially for large files. 4264 4265 4266 X Pixmaps (XPM) *xpm.vim* *ft-xpm-syntax* 4267 4268 xpm.vim creates its syntax items dynamically based upon the contents of the 4269 XPM file. Thus if you make changes e.g. in the color specification strings, 4270 you have to source it again e.g. with ":set syn=xpm". 4271 4272 To copy a pixel with one of the colors, yank a "pixel" with "yl" and insert it 4273 somewhere else with "P". 4274 4275 Do you want to draw with the mouse? Try the following: > 4276 :function! GetPixel() 4277 : let c = getline(".")[col(".") - 1] 4278 : echo c 4279 : exe "noremap <LeftMouse> <LeftMouse>r" .. c 4280 : exe "noremap <LeftDrag> <LeftMouse>r" .. c 4281 :endfunction 4282 :noremap <RightMouse> <LeftMouse>:call GetPixel()<CR> 4283 :set guicursor=n:hor20 " to see the color beneath the cursor 4284 This turns the right button into a pipette and the left button into a pen. 4285 It will work with XPM files that have one character per pixel only and you 4286 must not click outside of the pixel strings, but feel free to improve it. 4287 4288 It will look much better with a font in a quadratic cell size, e.g. for X: > 4289 :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-* 4290 4291 4292 YAML *yaml.vim* *ft-yaml-syntax* 4293 4294 *g:yaml_schema* *b:yaml_schema* 4295 A YAML schema is a combination of a set of tags and a mechanism for resolving 4296 non-specific tags. For user this means that YAML parser may, depending on 4297 plain scalar contents, treat plain scalar (which can actually be only string 4298 and nothing else) as a value of the other type: null, boolean, floating-point, 4299 integer. `g:yaml_schema` option determines according to which schema values 4300 will be highlighted specially. Supported schemas are 4301 4302 Schema Description ~ 4303 failsafe No additional highlighting. 4304 json Supports JSON-style numbers, booleans and null. 4305 core Supports more number, boolean and null styles. 4306 pyyaml In addition to core schema supports highlighting timestamps, 4307 but there are some differences in what is recognized as 4308 numbers and many additional boolean values not present in core 4309 schema. 4310 4311 Default schema is `core`. 4312 4313 Note that schemas are not actually limited to plain scalars, but this is the 4314 only difference between schemas defined in YAML specification and the only 4315 difference defined in the syntax file. 4316 4317 4318 ZSH *zsh.vim* *ft-zsh-syntax* 4319 4320 The syntax script for zsh allows for syntax-based folding: > 4321 4322 :let g:zsh_fold_enable = 1 4323 4324 ============================================================================== 4325 6. Defining a syntax *:syn-define* *E410* 4326 4327 Vim understands three types of syntax items: 4328 4329 1. Keyword 4330 It can only contain keyword characters, according to the characters 4331 specified with |:syn-iskeyword| or the 'iskeyword' option. It cannot 4332 contain other syntax items. It will only match with a complete word (there 4333 are no keyword characters before or after the match). The keyword "if" 4334 would match in "if(a=b)", but not in "ifdef x", because "(" is not a 4335 keyword character and "d" is. 4336 4337 2. Match 4338 This is a match with a single regexp pattern. 4339 4340 3. Region 4341 This starts at a match of the "start" regexp pattern and ends with a match 4342 with the "end" regexp pattern. Any other text can appear in between. A 4343 "skip" regexp pattern can be used to avoid matching the "end" pattern. 4344 4345 Several syntax ITEMs can be put into one syntax GROUP. For a syntax group 4346 you can give highlighting attributes. For example, you could have an item 4347 to define a "/* ... */" comment and another one that defines a "// ..." 4348 comment, and put them both in the "Comment" group. You can then specify that 4349 a "Comment" will be in bold font and have a blue color. You are free to make 4350 one highlight group for one syntax item, or put all items into one group. 4351 This depends on how you want to specify your highlighting attributes. Putting 4352 each item in its own group results in having to specify the highlighting 4353 for a lot of groups. 4354 4355 Note that a syntax group and a highlight group are similar. For a highlight 4356 group you will have given highlight attributes. These attributes will be used 4357 for the syntax group with the same name. 4358 4359 In case more than one item matches at the same position, the one that was 4360 defined LAST wins. Thus you can override previously defined syntax items by 4361 using an item that matches the same text. But a keyword always goes before a 4362 match or region. And a keyword with matching case always goes before a 4363 keyword with ignoring case. 4364 4365 4366 PRIORITY *:syn-priority* 4367 4368 When several syntax items may match, these rules are used: 4369 4370 1. When multiple Match or Region items start in the same position, the item 4371 defined last has priority. 4372 2. A Keyword has priority over Match and Region items. 4373 3. An item that starts in an earlier position has priority over items that 4374 start in later positions. 4375 4376 4377 DEFINING CASE *:syn-case* *E390* 4378 4379 :sy[ntax] case [match | ignore] 4380 This defines if the following ":syntax" commands will work with 4381 matching case, when using "match", or with ignoring case, when using 4382 "ignore". Note that any items before this are not affected, and all 4383 items until the next ":syntax case" command are affected. 4384 4385 :sy[ntax] case 4386 Show either "syntax case match" or "syntax case ignore". 4387 4388 4389 DEFINING FOLDLEVEL *:syn-foldlevel* 4390 4391 :sy[ntax] foldlevel start 4392 :sy[ntax] foldlevel minimum 4393 This defines how the foldlevel of a line is computed when using 4394 foldmethod=syntax (see |fold-syntax| and |:syn-fold|): 4395 4396 start: Use level of item containing start of line. 4397 minimum: Use lowest local-minimum level of items on line. 4398 4399 The default is "start". Use "minimum" to search a line horizontally 4400 for the lowest level contained on the line that is followed by a 4401 higher level. This produces more natural folds when syntax items 4402 may close and open horizontally within a line. 4403 4404 :sy[ntax] foldlevel 4405 Show the current foldlevel method, either "syntax foldlevel start" or 4406 "syntax foldlevel minimum". 4407 4408 {not meaningful when Vim was compiled without |+folding| feature} 4409 4410 SPELL CHECKING *:syn-spell* 4411 4412 :sy[ntax] spell toplevel 4413 :sy[ntax] spell notoplevel 4414 :sy[ntax] spell default 4415 This defines where spell checking is to be done for text that is not 4416 in a syntax item: 4417 4418 toplevel: Text is spell checked. 4419 notoplevel: Text is not spell checked. 4420 default: When there is a @Spell cluster no spell checking. 4421 4422 For text in syntax items use the @Spell and @NoSpell clusters 4423 |spell-syntax|. When there is no @Spell and no @NoSpell cluster then 4424 spell checking is done for "default" and "toplevel". 4425 4426 To activate spell checking the 'spell' option must be set. 4427 4428 :sy[ntax] spell 4429 Show the current syntax spell checking method, either "syntax spell 4430 toplevel", "syntax spell notoplevel" or "syntax spell default". 4431 4432 4433 SYNTAX ISKEYWORD SETTING *:syn-iskeyword* 4434 4435 :sy[ntax] iskeyword [clear | {option}] 4436 This defines the keyword characters. It's like the 'iskeyword' option 4437 for but only applies to syntax highlighting. 4438 4439 clear: Syntax specific iskeyword setting is disabled and the 4440 buffer-local 'iskeyword' setting is used. 4441 {option} Set the syntax 'iskeyword' option to a new value. 4442 4443 Example: > 4444 :syntax iskeyword @,48-57,192-255,$,_ 4445 < 4446 This would set the syntax specific iskeyword option to include all 4447 alphabetic characters, plus the numeric characters, all accented 4448 characters and also includes the "_" and the "$". 4449 4450 If no argument is given, the current value will be output. 4451 4452 Setting this option influences what |/\k| matches in syntax patterns 4453 and also determines where |:syn-keyword| will be checked for a new 4454 match. 4455 4456 It is recommended when writing syntax files, to use this command to 4457 set the correct value for the specific syntax language and not change 4458 the 'iskeyword' option. 4459 4460 DEFINING KEYWORDS *:syn-keyword* 4461 4462 :sy[ntax] keyword {group-name} [{options}] {keyword} ... [{options}] 4463 4464 This defines a number of keywords. 4465 4466 {group-name} Is a syntax group name such as "Comment". 4467 [{options}] See |:syn-arguments| below. 4468 {keyword} ... Is a list of keywords which are part of this group. 4469 4470 Example: > 4471 :syntax keyword Type int long char 4472 < 4473 The {options} can be given anywhere in the line. They will apply to 4474 all keywords given, also for options that come after a keyword. 4475 These examples do exactly the same: > 4476 :syntax keyword Type contained int long char 4477 :syntax keyword Type int long contained char 4478 :syntax keyword Type int long char contained 4479 < *E789* *E890* 4480 When you have a keyword with an optional tail, like Ex commands in 4481 Vim, you can put the optional characters inside [], to define all the 4482 variations at once: > 4483 :syntax keyword vimCommand ab[breviate] n[ext] 4484 < 4485 Don't forget that a keyword can only be recognized if all the 4486 characters are included in the 'iskeyword' option. If one character 4487 isn't, the keyword will never be recognized. 4488 Multi-byte characters can also be used. These do not have to be in 4489 'iskeyword'. 4490 See |:syn-iskeyword| for defining syntax specific iskeyword settings. 4491 4492 A keyword always has higher priority than a match or region, the 4493 keyword is used if more than one item matches. Keywords do not nest 4494 and a keyword can't contain anything else. 4495 4496 Note that when you have a keyword that is the same as an option (even 4497 one that isn't allowed here), you can not use it. Use a match 4498 instead. 4499 4500 The maximum length of a keyword is 80 characters. 4501 4502 The same keyword can be defined multiple times, when its containment 4503 differs. For example, you can define the keyword once not contained 4504 and use one highlight group, and once contained, and use a different 4505 highlight group. Example: > 4506 :syn keyword vimCommand tag 4507 :syn keyword vimSetting contained tag 4508 < When finding "tag" outside of any syntax item, the "vimCommand" 4509 highlight group is used. When finding "tag" in a syntax item that 4510 contains "vimSetting", the "vimSetting" group is used. 4511 4512 4513 DEFINING MATCHES *:syn-match* 4514 4515 :sy[ntax] match {group-name} [{options}] 4516 [excludenl] 4517 [keepend] 4518 {pattern} 4519 [{options}] 4520 4521 This defines one match. 4522 4523 {group-name} A syntax group name such as "Comment". 4524 [{options}] See |:syn-arguments| below. 4525 [excludenl] Don't make a pattern with the end-of-line "$" 4526 extend a containing match or region. Must be 4527 given before the pattern. |:syn-excludenl| 4528 keepend Don't allow contained matches to go past a 4529 match with the end pattern. See 4530 |:syn-keepend|. 4531 {pattern} The search pattern that defines the match. 4532 See |:syn-pattern| below. 4533 Note that the pattern may match more than one 4534 line, which makes the match depend on where 4535 Vim starts searching for the pattern. You 4536 need to make sure syncing takes care of this. 4537 4538 Example (match a character constant): > 4539 :syntax match Character /'.'/hs=s+1,he=e-1 4540 < 4541 4542 DEFINING REGIONS *:syn-region* *:syn-start* *:syn-skip* *:syn-end* 4543 *E398* *E399* 4544 :sy[ntax] region {group-name} [{options}] 4545 [matchgroup={group-name}] 4546 [keepend] 4547 [extend] 4548 [excludenl] 4549 start={start-pattern} ... 4550 [skip={skip-pattern}] 4551 end={end-pattern} ... 4552 [{options}] 4553 4554 This defines one region. It may span several lines. 4555 4556 {group-name} A syntax group name such as "Comment". 4557 [{options}] See |:syn-arguments| below. 4558 [matchgroup={group-name}] The syntax group to use for the following 4559 start or end pattern matches only. Not used 4560 for the text in between the matched start and 4561 end patterns. Use NONE to reset to not using 4562 a different group for the start or end match. 4563 See |:syn-matchgroup|. 4564 keepend Don't allow contained matches to go past a 4565 match with the end pattern. See 4566 |:syn-keepend|. 4567 extend Override a "keepend" for an item this region 4568 is contained in. See |:syn-extend|. 4569 excludenl Don't make a pattern with the end-of-line "$" 4570 extend a containing match or item. Only 4571 useful for end patterns. Must be given before 4572 the patterns it applies to. |:syn-excludenl| 4573 start={start-pattern} The search pattern that defines the start of 4574 the region. See |:syn-pattern| below. 4575 skip={skip-pattern} The search pattern that defines text inside 4576 the region where not to look for the end 4577 pattern. See |:syn-pattern| below. 4578 end={end-pattern} The search pattern that defines the end of 4579 the region. See |:syn-pattern| below. 4580 4581 Example: > 4582 :syntax region String start=+"+ skip=+\\"+ end=+"+ 4583 < 4584 The start/skip/end patterns and the options can be given in any order. 4585 There can be zero or one skip pattern. There must be one or more 4586 start and end patterns. This means that you can omit the skip 4587 pattern, but you must give at least one start and one end pattern. It 4588 is allowed to have white space before and after the equal sign 4589 (although it mostly looks better without white space). 4590 4591 When more than one start pattern is given, a match with one of these 4592 is sufficient. This means there is an OR relation between the start 4593 patterns. The last one that matches is used. The same is true for 4594 the end patterns. 4595 4596 The search for the end pattern starts right after the start pattern. 4597 Offsets are not used for this. This implies that the match for the 4598 end pattern will never overlap with the start pattern. 4599 4600 The skip and end pattern can match across line breaks, but since the 4601 search for the pattern can start in any line it often does not do what 4602 you want. The skip pattern doesn't avoid a match of an end pattern in 4603 the next line. Use single-line patterns to avoid trouble. 4604 4605 Note: The decision to start a region is only based on a matching start 4606 pattern. There is no check for a matching end pattern. This does NOT 4607 work: > 4608 :syn region First start="(" end=":" 4609 :syn region Second start="(" end=";" 4610 < The Second always matches before the First (last defined pattern has 4611 higher priority). The Second region then continues until the next 4612 ';', no matter if there is a ':' before it. Using a match does work: > 4613 :syn match First "(\_.\{-}:" 4614 :syn match Second "(\_.\{-};" 4615 < This pattern matches any character or line break with "\_." and 4616 repeats that with "\{-}" (repeat as few as possible). 4617 4618 *:syn-keepend* 4619 By default, a contained match can obscure a match for the end pattern. 4620 This is useful for nesting. For example, a region that starts with 4621 "{" and ends with "}", can contain another region. An encountered "}" 4622 will then end the contained region, but not the outer region: 4623 { starts outer "{}" region 4624 { starts contained "{}" region 4625 } ends contained "{}" region 4626 } ends outer "{} region 4627 If you don't want this, the "keepend" argument will make the matching 4628 of an end pattern of the outer region also end any contained item. 4629 This makes it impossible to nest the same region, but allows for 4630 contained items to highlight parts of the end pattern, without causing 4631 that to skip the match with the end pattern. Example: > 4632 :syn match vimComment +"[^"]\+$+ 4633 :syn region vimCommand start="set" end="$" contains=vimComment keepend 4634 < The "keepend" makes the vimCommand always end at the end of the line, 4635 even though the contained vimComment includes a match with the <EOL>. 4636 4637 When "keepend" is not used, a match with an end pattern is retried 4638 after each contained match. When "keepend" is included, the first 4639 encountered match with an end pattern is used, truncating any 4640 contained matches. 4641 *:syn-extend* 4642 The "keepend" behavior can be changed by using the "extend" argument. 4643 When an item with "extend" is contained in an item that uses 4644 "keepend", the "keepend" is ignored and the containing region will be 4645 extended. 4646 This can be used to have some contained items extend a region while 4647 others don't. Example: > 4648 4649 :syn region htmlRef start=+<a>+ end=+</a>+ keepend contains=htmlItem,htmlScript 4650 :syn match htmlItem +<[^>]*>+ contained 4651 :syn region htmlScript start=+<script+ end=+</script[^>]*>+ contained extend 4652 4653 < Here the htmlItem item does not make the htmlRef item continue 4654 further, it is only used to highlight the <> items. The htmlScript 4655 item does extend the htmlRef item. 4656 4657 Another example: > 4658 :syn region xmlFold start="<a>" end="</a>" fold transparent keepend extend 4659 < This defines a region with "keepend", so that its end cannot be 4660 changed by contained items, like when the "</a>" is matched to 4661 highlight it differently. But when the xmlFold region is nested (it 4662 includes itself), the "extend" applies, so that the "</a>" of a nested 4663 region only ends that region, and not the one it is contained in. 4664 4665 *:syn-excludenl* 4666 When a pattern for a match or end pattern of a region includes a '$' 4667 to match the end-of-line, it will make a region item that it is 4668 contained in continue on the next line. For example, a match with 4669 "\\$" (backslash at the end of the line) can make a region continue 4670 that would normally stop at the end of the line. This is the default 4671 behavior. If this is not wanted, there are two ways to avoid it: 4672 1. Use "keepend" for the containing item. This will keep all 4673 contained matches from extending the match or region. It can be 4674 used when all contained items must not extend the containing item. 4675 2. Use "excludenl" in the contained item. This will keep that match 4676 from extending the containing match or region. It can be used if 4677 only some contained items must not extend the containing item. 4678 "excludenl" must be given before the pattern it applies to. 4679 4680 *:syn-matchgroup* 4681 "matchgroup" can be used to highlight the start and/or end pattern 4682 differently than the body of the region. Example: > 4683 :syntax region String matchgroup=Quote start=+"+ skip=+\\"+ end=+"+ 4684 < This will highlight the quotes with the "Quote" group, and the text in 4685 between with the "String" group. 4686 The "matchgroup" is used for all start and end patterns that follow, 4687 until the next "matchgroup". Use "matchgroup=NONE" to go back to not 4688 using a matchgroup. 4689 4690 In a start or end pattern that is highlighted with "matchgroup" the 4691 contained items of the region are not used. This can be used to avoid 4692 that a contained item matches in the start or end pattern match. When 4693 using "transparent", this does not apply to a start or end pattern 4694 match that is highlighted with "matchgroup". 4695 4696 Here is an example, which highlights three levels of parentheses in 4697 different colors: > 4698 :sy region par1 matchgroup=par1 start=/(/ end=/)/ contains=par2 4699 :sy region par2 matchgroup=par2 start=/(/ end=/)/ contains=par3 contained 4700 :sy region par3 matchgroup=par3 start=/(/ end=/)/ contains=par1 contained 4701 :hi par1 ctermfg=red guifg=red 4702 :hi par2 ctermfg=blue guifg=blue 4703 :hi par3 ctermfg=darkgreen guifg=darkgreen 4704 < 4705 *E849* 4706 The maximum number of syntax groups is 19999. 4707 4708 ============================================================================== 4709 7. :syntax arguments *:syn-arguments* 4710 4711 The :syntax commands that define syntax items take a number of arguments. 4712 The common ones are explained here. The arguments may be given in any order 4713 and may be mixed with patterns. 4714 4715 Not all commands accept all arguments. This table shows which arguments 4716 can not be used for all commands: 4717 *E395* 4718 contains oneline fold display extend concealends~ 4719 :syntax keyword - - - - - - 4720 :syntax match yes - yes yes yes - 4721 :syntax region yes yes yes yes yes yes 4722 4723 These arguments can be used for all three commands: 4724 conceal 4725 cchar 4726 contained 4727 containedin 4728 nextgroup 4729 transparent 4730 skipwhite 4731 skipnl 4732 skipempty 4733 4734 conceal *conceal* *:syn-conceal* 4735 4736 When the "conceal" argument is given, the item is marked as concealable. 4737 Whether or not it is actually concealed depends on the value of the 4738 'conceallevel' option. The 'concealcursor' option is used to decide whether 4739 concealable items in the current line are displayed unconcealed to be able to 4740 edit the line. 4741 4742 Another way to conceal text is with |matchadd()|, but internally this works a 4743 bit differently |syntax-vs-match|. 4744 4745 concealends *:syn-concealends* 4746 4747 When the "concealends" argument is given, the start and end matches of 4748 the region, but not the contents of the region, are marked as concealable. 4749 Whether or not they are actually concealed depends on the setting on the 4750 'conceallevel' option. The ends of a region can only be concealed separately 4751 in this way when they have their own highlighting via "matchgroup". The 4752 |synconcealed()| function can be used to retrieve information about concealed 4753 items. 4754 4755 cchar *:syn-cchar* 4756 *E844* 4757 The "cchar" argument defines the character shown in place of the item 4758 when it is concealed (setting "cchar" only makes sense when the conceal 4759 argument is given.) If "cchar" is not set then the default conceal 4760 character defined in the 'listchars' option is used. The character cannot be 4761 a control character such as Tab. Example: > 4762 :syntax match Entity "&" conceal cchar=& 4763 See |hl-Conceal| for highlighting. 4764 4765 contained *:syn-contained* 4766 4767 When the "contained" argument is given, this item will not be recognized at 4768 the top level, but only when it is mentioned in the "contains" field of 4769 another match. Example: > 4770 :syntax keyword Todo TODO contained 4771 :syntax match Comment "//.*" contains=Todo 4772 4773 4774 display *:syn-display* 4775 4776 If the "display" argument is given, this item will be skipped when the 4777 detected highlighting will not be displayed. This will speed up highlighting, 4778 by skipping this item when only finding the syntax state for the text that is 4779 to be displayed. 4780 4781 Generally, you can use "display" for match and region items that meet these 4782 conditions: 4783 - The item does not continue past the end of a line. Example for C: A region 4784 for a "/*" comment can't contain "display", because it continues on the next 4785 line. 4786 - The item does not contain items that continue past the end of the line or 4787 make it continue on the next line. 4788 - The item does not change the size of any item it is contained in. Example 4789 for C: A match with "\\$" in a preprocessor match can't have "display", 4790 because it may make that preprocessor match shorter. 4791 - The item does not allow other items to match that didn't match otherwise, 4792 and that item may extend the match too far. Example for C: A match for a 4793 "//" comment can't use "display", because a "/*" inside that comment would 4794 match then and start a comment which extends past the end of the line. 4795 4796 Examples, for the C language, where "display" can be used: 4797 - match with a number 4798 - match with a label 4799 4800 4801 transparent *:syn-transparent* 4802 4803 If the "transparent" argument is given, this item will not be highlighted 4804 itself, but will take the highlighting of the item it is contained in. This 4805 is useful for syntax items that don't need any highlighting but are used 4806 only to skip over a part of the text. 4807 4808 The "contains=" argument is also inherited from the item it is contained in, 4809 unless a "contains" argument is given for the transparent item itself. To 4810 avoid that unwanted items are contained, use "contains=NONE". Example, which 4811 highlights words in strings, but makes an exception for "vim": > 4812 :syn match myString /'[^']*'/ contains=myWord,myVim 4813 :syn match myWord /\<[a-z]*\>/ contained 4814 :syn match myVim /\<vim\>/ transparent contained contains=NONE 4815 :hi link myString String 4816 :hi link myWord Comment 4817 Since the "myVim" match comes after "myWord" it is the preferred match (last 4818 match in the same position overrules an earlier one). The "transparent" 4819 argument makes the "myVim" match use the same highlighting as "myString". But 4820 it does not contain anything. If the "contains=NONE" argument would be left 4821 out, then "myVim" would use the contains argument from myString and allow 4822 "myWord" to be contained, which will be highlighted as a Comment. This 4823 happens because a contained match doesn't match inside itself in the same 4824 position, thus the "myVim" match doesn't overrule the "myWord" match here. 4825 4826 When you look at the colored text, it is like looking at layers of contained 4827 items. The contained item is on top of the item it is contained in, thus you 4828 see the contained item. When a contained item is transparent, you can look 4829 through, thus you see the item it is contained in. In a picture: 4830 4831 look from here 4832 4833 | | | | | | 4834 V V V V V V 4835 4836 xxxx yyy more contained items 4837 .................... contained item (transparent) 4838 ============================= first item 4839 4840 The 'x', 'y' and '=' represent a highlighted syntax item. The '.' represent a 4841 transparent group. 4842 4843 What you see is: 4844 4845 =======xxxx=======yyy======== 4846 4847 Thus you look through the transparent "....". 4848 4849 4850 oneline *:syn-oneline* 4851 4852 The "oneline" argument indicates that the region does not cross a line 4853 boundary. It must match completely in the current line. However, when the 4854 region has a contained item that does cross a line boundary, it continues on 4855 the next line anyway. A contained item can be used to recognize a line 4856 continuation pattern. But the "end" pattern must still match in the first 4857 line, otherwise the region doesn't even start. 4858 4859 When the start pattern includes a "\n" to match an end-of-line, the end 4860 pattern must be found in the same line as where the start pattern ends. The 4861 end pattern may also include an end-of-line. Thus the "oneline" argument 4862 means that the end of the start pattern and the start of the end pattern must 4863 be within one line. This can't be changed by a skip pattern that matches a 4864 line break. 4865 4866 4867 fold *:syn-fold* 4868 4869 The "fold" argument makes the fold level increase by one for this item. 4870 Example: > 4871 :syn region myFold start="{" end="}" transparent fold 4872 :syn sync fromstart 4873 :set foldmethod=syntax 4874 This will make each {} block form one fold. 4875 4876 The fold will start on the line where the item starts, and end where the item 4877 ends. If the start and end are within the same line, there is no fold. 4878 The 'foldnestmax' option limits the nesting of syntax folds. 4879 See |:syn-foldlevel| to control how the foldlevel of a line is computed 4880 from its syntax items. 4881 {not available when Vim was compiled without |+folding| feature} 4882 4883 4884 *:syn-contains* *E405* *E406* *E407* *E408* *E409* 4885 contains={group-name},... 4886 4887 The "contains" argument is followed by a list of syntax group names. These 4888 groups will be allowed to begin inside the item (they may extend past the 4889 containing group's end). This allows for recursive nesting of matches and 4890 regions. If there is no "contains" argument, no groups will be contained in 4891 this item. The group names do not need to be defined before they can be used 4892 here. 4893 4894 contains=ALL 4895 If the only item in the contains list is "ALL", then all 4896 groups will be accepted inside the item. 4897 4898 contains=ALLBUT,{group-name},... 4899 If the first item in the contains list is "ALLBUT", then all 4900 groups will be accepted inside the item, except the ones that 4901 are listed. Example: > 4902 :syntax region Block start="{" end="}" ... contains=ALLBUT,Function 4903 4904 contains=TOP 4905 If the first item in the contains list is "TOP", then all 4906 groups will be accepted that don't have the "contained" 4907 argument. 4908 contains=TOP,{group-name},... 4909 Like "TOP", but excluding the groups that are listed. 4910 4911 contains=CONTAINED 4912 If the first item in the contains list is "CONTAINED", then 4913 all groups will be accepted that have the "contained" 4914 argument. 4915 contains=CONTAINED,{group-name},... 4916 Like "CONTAINED", but excluding the groups that are 4917 listed. 4918 4919 4920 The {group-name} in the "contains" list can be a pattern. All group names 4921 that match the pattern will be included (or excluded, if "ALLBUT" is used). 4922 The pattern cannot contain white space or a ','. Example: > 4923 ... contains=Comment.*,Keyw[0-3] 4924 The matching will be done at moment the syntax command is executed. Groups 4925 that are defined later will not be matched. Also, if the current syntax 4926 command defines a new group, it is not matched. Be careful: When putting 4927 syntax commands in a file you can't rely on groups NOT being defined, because 4928 the file may have been sourced before, and ":syn clear" doesn't remove the 4929 group names. 4930 4931 The contained groups will also match in the start and end patterns of a 4932 region. If this is not wanted, the "matchgroup" argument can be used 4933 |:syn-matchgroup|. The "ms=" and "me=" offsets can be used to change the 4934 region where contained items do match. Note that this may also limit the 4935 area that is highlighted 4936 4937 4938 containedin={group-name},... *:syn-containedin* 4939 4940 The "containedin" argument is followed by a list of syntax group names. The 4941 item will be allowed to begin inside these groups. This works as if the 4942 containing item has a "contains=" argument that includes this item. 4943 4944 Only the immediate containing item (the one at the top of the syntax stack) is 4945 considered. Vim does not search other ancestors. If the immediate container 4946 neither contains this item via |:syn-contains| nor is named in this item's 4947 "containedin=", the match will not start even if some ancestor would allow it. 4948 Note that a |:syn-transparent| region still enforces its own |:syn-contains| 4949 list. 4950 4951 The {group-name},... can be used just like for "contains", as explained above. 4952 4953 This is useful when adding a syntax item afterwards. An item can be told to 4954 be included inside an already existing item, without changing the definition 4955 of that item. For example, to highlight a word in a C comment after loading 4956 the C syntax: > 4957 :syn keyword myword HELP containedin=cComment contained 4958 Note that "contained" is also used, to avoid that the item matches at the top 4959 level. 4960 4961 Matches for "containedin" are added to the other places where the item can 4962 appear. A "contains" argument may also be added as usual. Don't forget that 4963 keywords never contain another item, thus adding them to "containedin" won't 4964 work. 4965 See also: |:syn-contains|, |:syn-transparent|. 4966 4967 4968 nextgroup={group-name},... *:syn-nextgroup* 4969 4970 The "nextgroup" argument is followed by a list of syntax group names, 4971 separated by commas (just like with "contains", so you can also use patterns). 4972 4973 If the "nextgroup" argument is given, the mentioned syntax groups will be 4974 tried for a match, after the match or region ends. If none of the groups have 4975 a match, highlighting continues normally. If there is a match, this group 4976 will be used, even when it is not mentioned in the "contains" field of the 4977 current group. This is like giving the mentioned group priority over all 4978 other groups. Example: > 4979 :syntax match ccFoobar "Foo.\{-}Bar" contains=ccFoo 4980 :syntax match ccFoo "Foo" contained nextgroup=ccFiller 4981 :syntax region ccFiller start="." matchgroup=ccBar end="Bar" contained 4982 4983 This will highlight "Foo" and "Bar" differently, and only when there is a 4984 "Bar" after "Foo". In the text line below, "f" shows where ccFoo is used for 4985 highlighting, and "bbb" where ccBar is used. > 4986 4987 Foo asdfasd Bar asdf Foo asdf Bar asdf 4988 fff bbb fff bbb 4989 4990 Note the use of ".\{-}" to skip as little as possible until the next Bar. 4991 when ".*" would be used, the "asdf" in between "Bar" and "Foo" would be 4992 highlighted according to the "ccFoobar" group, because the ccFooBar match 4993 would include the first "Foo" and the last "Bar" in the line (see |pattern|). 4994 4995 4996 skipwhite *:syn-skipwhite* 4997 skipnl *:syn-skipnl* 4998 skipempty *:syn-skipempty* 4999 5000 These arguments are only used in combination with "nextgroup". They can be 5001 used to allow the next group to match after skipping some text: 5002 skipwhite skip over space and tab characters 5003 skipnl skip over the end of a line 5004 skipempty skip over empty lines (implies a "skipnl") 5005 5006 When "skipwhite" is present, the white space is only skipped if there is no 5007 next group that matches the white space. 5008 5009 When "skipnl" is present, the match with nextgroup may be found in the next 5010 line. This only happens when the current item ends at the end of the current 5011 line! When "skipnl" is not present, the nextgroup will only be found after 5012 the current item in the same line. 5013 5014 When skipping text while looking for a next group, the matches for other 5015 groups are ignored. Only when no next group matches, other items are tried 5016 for a match again. This means that matching a next group and skipping white 5017 space and <EOL>s has a higher priority than other items. 5018 5019 Example: > 5020 :syn match ifstart "\<if.*" nextgroup=ifline skipwhite skipempty 5021 :syn match ifline "[^ \t].*" nextgroup=ifline skipwhite skipempty contained 5022 :syn match ifline "endif" contained 5023 Note that the "[^ \t].*" match matches all non-white text. Thus it would also 5024 match "endif". Therefore the "endif" match is put last, so that it takes 5025 precedence. 5026 Note that this example doesn't work for nested "if"s. You need to add 5027 "contains" arguments to make that work (omitted for simplicity of the 5028 example). 5029 5030 IMPLICIT CONCEAL *:syn-conceal-implicit* 5031 5032 :sy[ntax] conceal [on|off] 5033 This defines if the following ":syntax" commands will define keywords, 5034 matches or regions with the "conceal" flag set. After ":syn conceal 5035 on", all subsequent ":syn keyword", ":syn match" or ":syn region" 5036 defined will have the "conceal" flag set implicitly. ":syn conceal 5037 off" returns to the normal state where the "conceal" flag must be 5038 given explicitly. 5039 5040 :sy[ntax] conceal 5041 Show either "syntax conceal on" or "syntax conceal off". 5042 5043 ============================================================================== 5044 8. Syntax patterns *:syn-pattern* *E401* *E402* 5045 5046 In the syntax commands, a pattern must be surrounded by two identical 5047 characters. This is like it works for the ":s" command. The most common to 5048 use is the double quote. But if the pattern contains a double quote, you can 5049 use another character that is not used in the pattern. Examples: > 5050 :syntax region Comment start="/\*" end="\*/" 5051 :syntax region String start=+"+ end=+"+ skip=+\\"+ 5052 5053 See |pattern| for the explanation of what a pattern is. Syntax patterns are 5054 always interpreted like the 'magic' option is set, no matter what the actual 5055 value of 'magic' is. And the patterns are interpreted like the 'l' flag is 5056 not included in 'cpoptions'. This was done to make syntax files portable and 5057 independent of 'compatible' and 'magic' settings. 5058 5059 Try to avoid patterns that can match an empty string, such as "[a-z]*". 5060 This slows down the highlighting a lot, because it matches everywhere. 5061 5062 *:syn-pattern-offset* 5063 The pattern can be followed by a character offset. This can be used to 5064 change the highlighted part, and to change the text area included in the 5065 match or region (which only matters when trying to match other items). Both 5066 are relative to the matched pattern. The character offset for a skip 5067 pattern can be used to tell where to continue looking for an end pattern. 5068 5069 The offset takes the form of "{what}={offset}" 5070 The {what} can be one of seven strings: 5071 5072 ms Match Start offset for the start of the matched text 5073 me Match End offset for the end of the matched text 5074 hs Highlight Start offset for where the highlighting starts 5075 he Highlight End offset for where the highlighting ends 5076 rs Region Start offset for where the body of a region starts 5077 re Region End offset for where the body of a region ends 5078 lc Leading Context offset past "leading context" of pattern 5079 5080 The {offset} can be: 5081 5082 s start of the matched pattern 5083 s+{nr} start of the matched pattern plus {nr} chars to the right 5084 s-{nr} start of the matched pattern plus {nr} chars to the left 5085 e end of the matched pattern 5086 e+{nr} end of the matched pattern plus {nr} chars to the right 5087 e-{nr} end of the matched pattern plus {nr} chars to the left 5088 {nr} (for "lc" only): start matching {nr} chars right of the start 5089 5090 Examples: "ms=s+1", "hs=e-2", "lc=3". 5091 5092 Although all offsets are accepted after any pattern, they are not always 5093 meaningful. This table shows which offsets are actually used: 5094 5095 ms me hs he rs re lc ~ 5096 match item yes yes yes yes - - yes 5097 region item start yes - yes - yes - yes 5098 region item skip - yes - - - - yes 5099 region item end - yes - yes - yes yes 5100 5101 Offsets can be concatenated, with a ',' in between. Example: > 5102 :syn match String /"[^"]*"/hs=s+1,he=e-1 5103 < 5104 some "string" text 5105 ^^^^^^ highlighted 5106 5107 Notes: 5108 - There must be no white space between the pattern and the character 5109 offset(s). 5110 - The highlighted area will never be outside of the matched text. 5111 - A negative offset for an end pattern may not always work, because the end 5112 pattern may be detected when the highlighting should already have stopped. 5113 - Before Vim 7.2 the offsets were counted in bytes instead of characters. 5114 This didn't work well for multibyte characters, so it was changed with the 5115 Vim 7.2 release. 5116 - The start of a match cannot be in a line other than where the pattern 5117 matched. This doesn't work: "a\nb"ms=e. You can make the highlighting 5118 start in another line, this does work: "a\nb"hs=e. 5119 5120 Example (match a comment but don't highlight the /* and */): > 5121 :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1 5122 < 5123 /* this is a comment */ 5124 ^^^^^^^^^^^^^^^^^^^ highlighted 5125 5126 A more complicated Example: > 5127 :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1 5128 < 5129 abcfoostringbarabc 5130 mmmmmmmmmmm match 5131 sssrrreee highlight start/region/end ("Foo", "Exa" and "Bar") 5132 5133 Leading context *:syn-lc* *:syn-leading* *:syn-context* 5134 5135 Note: This is an obsolete feature, only included for backwards compatibility 5136 with previous Vim versions. It's now recommended to use the |/\@<=| construct 5137 in the pattern. You can also often use |/\zs|. 5138 5139 The "lc" offset specifies leading context -- a part of the pattern that must 5140 be present, but is not considered part of the match. An offset of "lc=n" will 5141 cause Vim to step back n columns before attempting the pattern match, allowing 5142 characters which have already been matched in previous patterns to also be 5143 used as leading context for this match. This can be used, for instance, to 5144 specify that an "escaping" character must not precede the match: > 5145 5146 :syn match ZNoBackslash "[^\\]z"ms=s+1 5147 :syn match WNoBackslash "[^\\]w"lc=1 5148 :syn match Underline "_\+" 5149 < 5150 ___zzzz ___wwww 5151 ^^^ ^^^ matches Underline 5152 ^ ^ matches ZNoBackslash 5153 ^^^^ matches WNoBackslash 5154 5155 The "ms" offset is automatically set to the same value as the "lc" offset, 5156 unless you set "ms" explicitly. 5157 5158 5159 Multi-line patterns *:syn-multi-line* 5160 5161 The patterns can include "\n" to match an end-of-line. Mostly this works as 5162 expected, but there are a few exceptions. 5163 5164 When using a start pattern with an offset, the start of the match is not 5165 allowed to start in a following line. The highlighting can start in a 5166 following line though. Using the "\zs" item also requires that the start of 5167 the match doesn't move to another line. 5168 5169 The skip pattern can include the "\n", but the search for an end pattern will 5170 continue in the first character of the next line, also when that character is 5171 matched by the skip pattern. This is because redrawing may start in any line 5172 halfway a region and there is no check if the skip pattern started in a 5173 previous line. For example, if the skip pattern is "a\nb" and an end pattern 5174 is "b", the end pattern does match in the second line of this: > 5175 x x a 5176 b x x 5177 Generally this means that the skip pattern should not match any characters 5178 after the "\n". 5179 5180 5181 External matches *:syn-ext-match* 5182 5183 These extra regular expression items are available in region patterns: 5184 5185 */\z(* */\z(\)* *E50* *E52* *E879* 5186 \z(\) Marks the sub-expression as "external", meaning that it can be 5187 accessed from another pattern match. Currently only usable in 5188 defining a syntax region start pattern. 5189 5190 */\z1* */\z2* */\z3* */\z4* */\z5* 5191 \z1 ... \z9 */\z6* */\z7* */\z8* */\z9* *E66* *E67* 5192 Matches the same string that was matched by the corresponding 5193 sub-expression in a previous start pattern match. 5194 5195 Sometimes the start and end patterns of a region need to share a common 5196 sub-expression. A common example is the "here" document in Perl and many Unix 5197 shells. This effect can be achieved with the "\z" special regular expression 5198 items, which marks a sub-expression as "external", in the sense that it can be 5199 referenced from outside the pattern in which it is defined. The here-document 5200 example, for instance, can be done like this: > 5201 :syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$" 5202 5203 As can be seen here, the \z actually does double duty. In the start pattern, 5204 it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it 5205 changes the \z1 back-reference into an external reference referring to the 5206 first external sub-expression in the start pattern. External references can 5207 also be used in skip patterns: > 5208 :syn region foo start="start \z(\I\i*\)" skip="not end \z1" end="end \z1" 5209 5210 Note that normal and external sub-expressions are completely orthogonal and 5211 indexed separately; for instance, if the pattern "\z(..\)\(..\)" is applied 5212 to the string "aabb", then \1 will refer to "bb" and \z1 will refer to "aa". 5213 Note also that external sub-expressions cannot be accessed as back-references 5214 within the same pattern like normal sub-expressions. If you want to use one 5215 sub-expression as both a normal and an external sub-expression, you can nest 5216 the two, as in "\(\z(...\)\)". 5217 5218 Note that only matches within a single line can be used. Multi-line matches 5219 cannot be referred to. 5220 5221 ============================================================================== 5222 9. Syntax clusters *:syn-cluster* *E400* 5223 5224 :sy[ntax] cluster {cluster-name} [contains={group-name},...] 5225 [add={group-name},...] 5226 [remove={group-name},...] 5227 5228 This command allows you to cluster a list of syntax groups together under a 5229 single name. 5230 5231 contains={group-name},... 5232 The cluster is set to the specified list of groups. 5233 add={group-name},... 5234 The specified groups are added to the cluster. 5235 remove={group-name},... 5236 The specified groups are removed from the cluster. 5237 5238 A cluster so defined may be referred to in a contains=..., containedin=..., 5239 nextgroup=..., add=... or remove=... list with a "@" prefix. You can also use 5240 this notation to implicitly declare a cluster before specifying its contents. 5241 5242 Example: > 5243 :syntax match Thing "# [^#]\+ #" contains=@ThingMembers 5244 :syntax cluster ThingMembers contains=ThingMember1,ThingMember2 5245 5246 As the previous example suggests, modifications to a cluster are effectively 5247 retroactive; the membership of the cluster is checked at the last minute, so 5248 to speak: > 5249 :syntax keyword A aaa 5250 :syntax keyword B bbb 5251 :syntax cluster AandB contains=A 5252 :syntax match Stuff "( aaa bbb )" contains=@AandB 5253 :syntax cluster AandB add=B " now both keywords are matched in Stuff 5254 5255 This also has implications for nested clusters: > 5256 :syntax keyword A aaa 5257 :syntax keyword B bbb 5258 :syntax cluster SmallGroup contains=B 5259 :syntax cluster BigGroup contains=A,@SmallGroup 5260 :syntax match Stuff "( aaa bbb )" contains=@BigGroup 5261 :syntax cluster BigGroup remove=B " no effect, since B isn't in BigGroup 5262 :syntax cluster SmallGroup remove=B " now bbb isn't matched within Stuff 5263 < 5264 *E848* 5265 The maximum number of clusters is 9767. 5266 5267 ============================================================================== 5268 10. Including syntax files *:syn-include* *E397* 5269 5270 It is often useful for one language's syntax file to include a syntax file for 5271 a related language. Depending on the exact relationship, this can be done in 5272 two different ways: 5273 5274 - If top-level syntax items in the included syntax file are to be 5275 allowed at the top level in the including syntax, you can simply use 5276 the |:runtime| command: > 5277 5278 " In cpp.vim: 5279 :runtime! syntax/c.vim 5280 :unlet b:current_syntax 5281 5282 < - If top-level syntax items in the included syntax file are to be 5283 contained within a region in the including syntax, you can use the 5284 ":syntax include" command: 5285 5286 :sy[ntax] include [@{grouplist-name}] {file-name} 5287 5288 All syntax items declared in the included file will have the 5289 "contained" flag added. In addition, if a group list is specified, 5290 all top-level syntax items in the included file will be added to 5291 that list. > 5292 5293 " In perl.vim: 5294 :syntax include @Pod <sfile>:p:h/pod.vim 5295 :syntax region perlPOD start="^=head" end="^=cut" contains=@Pod 5296 < 5297 When {file-name} is an absolute path (starts with "/", "c:", "$VAR" 5298 or "<sfile>") that file is sourced. When it is a relative path 5299 (e.g., "syntax/pod.vim") the file is searched for in 'runtimepath'. 5300 All matching files are loaded. Using a relative path is 5301 recommended, because it allows a user to replace the included file 5302 with their own version, without replacing the file that does the 5303 ":syn include". 5304 5305 *E847* 5306 The maximum number of includes is 999. 5307 5308 ============================================================================== 5309 11. Synchronizing *:syn-sync* *E403* *E404* 5310 5311 Vim wants to be able to start redrawing in any position in the document. To 5312 make this possible it needs to know the syntax state at the position where 5313 redrawing starts. 5314 5315 :sy[ntax] sync [ccomment [group-name] | minlines={N} | ...] 5316 5317 There are four ways to synchronize: 5318 1. Always parse from the start of the file. 5319 |:syn-sync-first| 5320 2. Based on C-style comments. Vim understands how C-comments work and can 5321 figure out if the current line starts inside or outside a comment. 5322 |:syn-sync-second| 5323 3. Jumping back a certain number of lines and start parsing there. 5324 |:syn-sync-third| 5325 4. Searching backwards in the text for a pattern to sync on. 5326 |:syn-sync-fourth| 5327 5328 *:syn-sync-maxlines* *:syn-sync-minlines* 5329 For the last three methods, the line range where the parsing can start is 5330 limited by "minlines" and "maxlines". 5331 5332 If the "minlines={N}" argument is given, the parsing always starts at least 5333 that many lines backwards. This can be used if the parsing may take a few 5334 lines before it's correct, or when it's not possible to use syncing. 5335 5336 If the "maxlines={N}" argument is given, the number of lines that are searched 5337 for a comment or syncing pattern is restricted to N lines backwards (after 5338 adding "minlines"). This is useful if you have few things to sync on and a 5339 slow machine. Example: > 5340 :syntax sync maxlines=500 ccomment 5341 < 5342 *:syn-sync-linebreaks* 5343 When using a pattern that matches multiple lines, a change in one line may 5344 cause a pattern to no longer match in a previous line. This means has to 5345 start above where the change was made. How many lines can be specified with 5346 the "linebreaks" argument. For example, when a pattern may include one line 5347 break use this: > 5348 :syntax sync linebreaks=1 5349 The result is that redrawing always starts at least one line before where a 5350 change was made. The default value for "linebreaks" is zero. Usually the 5351 value for "minlines" is bigger than "linebreaks". 5352 5353 5354 First syncing method: *:syn-sync-first* 5355 > 5356 :syntax sync fromstart 5357 5358 The file will be parsed from the start. This makes syntax highlighting 5359 accurate, but can be slow for long files. Vim caches previously parsed text, 5360 so that it's only slow when parsing the text for the first time. However, 5361 when making changes some part of the text needs to be parsed again (worst 5362 case: to the end of the file). 5363 5364 Using "fromstart" is equivalent to using "minlines" with a very large number. 5365 5366 5367 Second syncing method: *:syn-sync-second* *:syn-sync-ccomment* 5368 5369 For the second method, only the "ccomment" argument needs to be given. 5370 Example: > 5371 :syntax sync ccomment 5372 5373 When Vim finds that the line where displaying starts is inside a C-style 5374 comment, the last region syntax item with the group-name "Comment" will be 5375 used. This requires that there is a region with the group-name "Comment"! 5376 An alternate group name can be specified, for example: > 5377 :syntax sync ccomment javaComment 5378 This means that the last item specified with "syn region javaComment" will be 5379 used for the detected C comment region. This only works properly if that 5380 region does have a start pattern "\/*" and an end pattern "*\/". 5381 5382 The "maxlines" argument can be used to restrict the search to a number of 5383 lines. The "minlines" argument can be used to at least start a number of 5384 lines back (e.g., for when there is some construct that only takes a few 5385 lines, but it hard to sync on). 5386 5387 Note: Syncing on a C comment doesn't work properly when strings are used 5388 that cross a line and contain a "*/". Since letting strings cross a line 5389 is a bad programming habit (many compilers give a warning message), and the 5390 chance of a "*/" appearing inside a comment is very small, this restriction 5391 is hardly ever noticed. 5392 5393 5394 Third syncing method: *:syn-sync-third* 5395 5396 For the third method, only the "minlines={N}" argument needs to be given. 5397 Vim will subtract {N} from the line number and start parsing there. This 5398 means {N} extra lines need to be parsed, which makes this method a bit slower. 5399 Example: > 5400 :syntax sync minlines=50 5401 5402 "lines" is equivalent to "minlines" (used by older versions). 5403 5404 5405 Fourth syncing method: *:syn-sync-fourth* 5406 5407 The idea is to synchronize on the end of a few specific regions, called a 5408 sync pattern. Only regions can cross lines, so when we find the end of some 5409 region, we might be able to know in which syntax item we are. The search 5410 starts in the line just above the one where redrawing starts. From there 5411 the search continues backwards in the file. 5412 5413 This works just like the non-syncing syntax items. You can use contained 5414 matches, nextgroup, etc. But there are a few differences: 5415 - Keywords cannot be used. 5416 - The syntax items with the "sync" keyword form a completely separated group 5417 of syntax items. You can't mix syncing groups and non-syncing groups. 5418 - The matching works backwards in the buffer (line by line), instead of 5419 forwards. 5420 - A line continuation pattern can be given. It is used to decide which group 5421 of lines need to be searched like they were one line. This means that the 5422 search for a match with the specified items starts in the first of the 5423 consecutive lines that contain the continuation pattern. 5424 - When using "nextgroup" or "contains", this only works within one line (or 5425 group of continued lines). 5426 - When using a region, it must start and end in the same line (or group of 5427 continued lines). Otherwise the end is assumed to be at the end of the 5428 line (or group of continued lines). 5429 - When a match with a sync pattern is found, the rest of the line (or group of 5430 continued lines) is searched for another match. The last match is used. 5431 This is used when a line can contain both the start and the end of a region 5432 (e.g., in a C-comment like /* this */, the last "*/" is used). 5433 5434 There are two ways how a match with a sync pattern can be used: 5435 1. Parsing for highlighting starts where redrawing starts (and where the 5436 search for the sync pattern started). The syntax group that is expected 5437 to be valid there must be specified. This works well when the regions 5438 that cross lines cannot contain other regions. 5439 2. Parsing for highlighting continues just after the match. The syntax group 5440 that is expected to be present just after the match must be specified. 5441 This can be used when the previous method doesn't work well. It's much 5442 slower, because more text needs to be parsed. 5443 Both types of sync patterns can be used at the same time. 5444 5445 Besides the sync patterns, other matches and regions can be specified, to 5446 avoid finding unwanted matches. 5447 5448 [The reason that the sync patterns are given separately, is that mostly the 5449 search for the sync point can be much simpler than figuring out the 5450 highlighting. The reduced number of patterns means it will go (much) 5451 faster.] 5452 5453 *syn-sync-grouphere* *E393* *E394* 5454 :syntax sync match {sync-group-name} grouphere {group-name} "pattern" ... 5455 5456 Define a match that is used for syncing. {group-name} is the 5457 name of a syntax group that follows just after the match. Parsing 5458 of the text for highlighting starts just after the match. A region 5459 must exist for this {group-name}. The first one defined will be used. 5460 "NONE" can be used for when there is no syntax group after the match. 5461 5462 *syn-sync-groupthere* 5463 :syntax sync match {sync-group-name} groupthere {group-name} "pattern" ... 5464 5465 Like "grouphere", but {group-name} is the name of a syntax group that 5466 is to be used at the start of the line where searching for the sync 5467 point started. The text between the match and the start of the sync 5468 pattern searching is assumed not to change the syntax highlighting. 5469 For example, in C you could search backwards for "/*" and "*/". If 5470 "/*" is found first, you know that you are inside a comment, so the 5471 "groupthere" is "cComment". If "*/" is found first, you know that you 5472 are not in a comment, so the "groupthere" is "NONE". (in practice 5473 it's a bit more complicated, because the "/*" and "*/" could appear 5474 inside a string. That's left as an exercise to the reader...). 5475 5476 :syntax sync match ... 5477 :syntax sync region ... 5478 5479 Without a "groupthere" argument. Define a region or match that is 5480 skipped while searching for a sync point. 5481 5482 *syn-sync-linecont* 5483 :syntax sync linecont {pattern} 5484 5485 When {pattern} matches in a line, it is considered to continue in 5486 the next line. This means that the search for a sync point will 5487 consider the lines to be concatenated. 5488 5489 If the "maxlines={N}" argument is given too, the number of lines that are 5490 searched for a match is restricted to N. This is useful if you have very 5491 few things to sync on and a slow machine. Example: > 5492 :syntax sync maxlines=100 5493 5494 You can clear all sync settings with: > 5495 :syntax sync clear 5496 5497 You can clear specific sync patterns with: > 5498 :syntax sync clear {sync-group-name} ... 5499 5500 ============================================================================== 5501 12. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* 5502 5503 This command lists all the syntax items: > 5504 5505 :sy[ntax] [list] 5506 5507 To show the syntax items for one syntax group: > 5508 5509 :sy[ntax] list {group-name} 5510 5511 To list the syntax groups in one cluster: *E392* > 5512 5513 :sy[ntax] list @{cluster-name} 5514 5515 See above for other arguments for the ":syntax" command. 5516 5517 Note that the ":syntax" command can be abbreviated to ":sy", although ":syn" 5518 is mostly used, because it looks better. 5519 5520 ============================================================================== 5521 13. Colorschemes *color-schemes* 5522 5523 In the next section you can find information about individual highlight groups 5524 and how to specify colors for them. Most likely you want to just select a set 5525 of colors by using the `:colorscheme` command, for example: > 5526 5527 colorscheme pablo 5528 < 5529 *:colo* *:colorscheme* *E185* 5530 :colo[rscheme] Output the name of the currently active color scheme. 5531 This is basically the same as > 5532 :echo g:colors_name 5533 < In case g:colors_name has not been defined :colo will 5534 output "default". Its palette is defined in the file 5535 "$VIMRUNTIME/syntax/syncolor.vim" and is based on 5536 legacy versions of peachpuff and desert. When 5537 compiled without the |+eval| feature it will output 5538 "unknown". 5539 5540 :colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath' 5541 for the file "colors/{name}.vim". The first one that 5542 is found is loaded. 5543 Use `:colo default` to load the default colorscheme. 5544 Also searches all plugins in 'packpath', first below 5545 "start" and then under "opt". 5546 5547 Doesn't work recursively, thus you can't use 5548 ":colorscheme" in a color scheme script. 5549 5550 You have two options for customizing a color scheme. For changing the 5551 appearance of specific colors, you can redefine a color name before loading 5552 the scheme. The desert scheme uses the khaki color for the cursor. To use a 5553 darker variation of the same color: > 5554 5555 let v:colornames['khaki'] = '#bdb76b' 5556 colorscheme desert 5557 < 5558 For further customization, such as changing |:highlight-link| associations, 5559 use another name, e.g. "~/.vim/colors/mine.vim", and use `:runtime` to load 5560 the original color scheme: > 5561 runtime colors/evening.vim 5562 hi Statement ctermfg=Blue guifg=Blue 5563 5564 Before the color scheme will be loaded all default color list scripts 5565 (`colors/lists/default.vim`) will be executed and then the |ColorSchemePre| 5566 autocommand event is triggered. After the color scheme has been loaded the 5567 |ColorScheme| autocommand event is triggered. 5568 5569 *colorscheme-override* 5570 If a color scheme is almost right, you can add modifications on top of it by 5571 using the |ColorScheme| autocommand. For example, to remove the background 5572 color (can make it transparent in some terminals): > 5573 augroup my_colorschemes 5574 au! 5575 au Colorscheme pablo hi Normal ctermbg=NONE 5576 augroup END 5577 5578 Change a couple more colors: > 5579 augroup my_colorschemes 5580 au! 5581 au Colorscheme pablo hi Normal ctermbg=NONE 5582 \ | highlight Special ctermfg=63 5583 \ | highlight Identifier ctermfg=44 5584 augroup END 5585 5586 If you make a lot of changes it might be better to copy the distributed 5587 colorscheme to your home directory and change it: > 5588 :!cp $VIMRUNTIME/colors/pablo.vim ~/.vim/colors 5589 :edit ~/.vim/colors/pablo.vim 5590 5591 With Vim 9.0 the collection of color schemes was updated and made work in many 5592 different terminals. One change was to often define the Normal highlight 5593 group to make sure the colors work well. In case you prefer the old version, 5594 you can find them here: 5595 https://github.com/vim/colorschemes/blob/master/legacy_colors/ 5596 5597 For info about writing a color scheme file: > 5598 :edit $VIMRUNTIME/colors/README.txt 5599 5600 5601 ============================================================================== 5602 14. Highlight command *:highlight* *:hi* *E28* *E411* *E415* 5603 5604 There are three types of highlight groups: 5605 - The ones used for specific languages. For these the name starts with the 5606 name of the language. Many of these don't have any attributes, but are 5607 linked to a group of the second type. 5608 - The ones used for all syntax languages. 5609 - The ones used for the 'highlight' option. 5610 *hitest.vim* 5611 You can see all the groups currently active with this command: > 5612 :so $VIMRUNTIME/syntax/hitest.vim 5613 This will open a new window containing all highlight group names, displayed 5614 in their own color. 5615 5616 :hi[ghlight] List all the current highlight groups that have 5617 attributes set. 5618 5619 :hi[ghlight] {group-name} 5620 List one highlight group. 5621 5622 *highlight-clear* *:hi-clear* 5623 :hi[ghlight] clear Reset all highlighting to the defaults. Removes all 5624 highlighting for groups added by the user. 5625 Uses the current value of 'background' to decide which 5626 default colors to use. 5627 If there was a default link, restore it. |:hi-link| 5628 5629 :hi[ghlight] clear {group-name} 5630 :hi[ghlight] {group-name} NONE 5631 Disable the highlighting for one highlight group. It 5632 is _not_ set back to the default colors. 5633 5634 :hi[ghlight] [default] {group-name} {key}={arg} ... 5635 Add a highlight group, or change the highlighting for 5636 an existing group. If a given color name is not 5637 recognized, each `colors/lists/default.vim` found on 5638 'runtimepath' will be loaded. 5639 See |highlight-args| for the {key}={arg} arguments. 5640 See |:highlight-default| for the optional [default] 5641 argument. 5642 5643 :hi[ghlight][!] [default] link {from-group} {to-group} 5644 :hi[ghlight][!] [default] link {from-group} NONE 5645 See |:hi-link|. 5646 5647 Normally a highlight group is added once when starting up. This sets the 5648 default values for the highlighting. After that, you can use additional 5649 highlight commands to change the arguments that you want to set to non-default 5650 values. The value "NONE" can be used to switch the value off or go back to 5651 the default value. 5652 5653 A simple way to change colors is with the |:colorscheme| command. This loads 5654 a file with ":highlight" commands such as this: > 5655 5656 :hi Comment gui=bold 5657 5658 Note that all settings that are not included remain the same, only the 5659 specified field is used, and settings are merged with previous ones. So, the 5660 result is like this single command has been used: > 5661 :hi Comment term=bold ctermfg=Cyan guifg=#80a0ff gui=bold 5662 < 5663 *:highlight-verbose* 5664 When listing a highlight group and 'verbose' is non-zero, the listing will 5665 also tell where it was last set. Example: > 5666 :verbose hi Comment 5667 < Comment xxx term=bold ctermfg=4 guifg=Blue ~ 5668 Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim ~ 5669 5670 When ":hi clear" is used then the script where this command is used will be 5671 mentioned for the default values. See |:verbose-cmd| for more information. 5672 5673 *highlight-args* *E416* *E417* *E423* 5674 There are three types of terminals for highlighting: 5675 term a normal terminal (vt100, xterm) 5676 cterm a color terminal (MS-Windows console, color-xterm, these have the "Co" 5677 termcap entry) 5678 gui the GUI 5679 5680 For each type the highlighting can be given. This makes it possible to use 5681 the same syntax file on all terminals, and use the optimal highlighting. 5682 5683 1. highlight arguments for normal terminals 5684 5685 *bold* *underline* *undercurl* 5686 *underdouble* *underdotted* 5687 *underdashed* *inverse* *italic* 5688 *standout* *nocombine* *strikethrough* 5689 term={attr-list} *attr-list* *highlight-term* *E418* 5690 attr-list is a comma-separated list (without spaces) of the 5691 following items (in any order): 5692 bold 5693 underline 5694 undercurl not always available 5695 underdouble not always available 5696 underdotted not always available 5697 underdashed not always available 5698 strikethrough not always available 5699 reverse 5700 inverse same as reverse 5701 italic 5702 standout 5703 nocombine override attributes instead of combining them 5704 NONE no attributes used (used to reset it) 5705 5706 Note that "bold" can be used here and by using a bold font. They 5707 have the same effect. 5708 *underline-codes* 5709 "undercurl" is a curly underline. When "undercurl" is not possible 5710 then "underline" is used. In general "undercurl" and "strikethrough" 5711 are only available in the GUI and some terminals. The color is set 5712 with |highlight-guisp| or |highlight-ctermul|. You can try these 5713 termcap entries to make undercurl work in a terminal: > 5714 let &t_Cs = "\e[4:3m" 5715 let &t_Ce = "\e[4:0m" 5716 5717 < "underdouble" is a double underline, "underdotted" is a dotted 5718 underline and "underdashed" is a dashed underline. These are only 5719 supported by some terminals. If your terminal supports them you may 5720 have to specify the codes like this: > 5721 let &t_Us = "\e[4:2m" 5722 let &t_ds = "\e[4:4m" 5723 let &t_Ds = "\e[4:5m" 5724 < They are reset with |t_Ce|, the same as curly underline (undercurl). 5725 When t_Us, t_ds or t_Ds is not set then underline will be used as a 5726 fallback. 5727 5728 5729 start={term-list} *highlight-start* *E422* 5730 stop={term-list} *term-list* *highlight-stop* 5731 These lists of terminal codes can be used to get 5732 non-standard attributes on a terminal. 5733 5734 The escape sequence specified with the "start" argument 5735 is written before the characters in the highlighted 5736 area. It can be anything that you want to send to the 5737 terminal to highlight this area. The escape sequence 5738 specified with the "stop" argument is written after the 5739 highlighted area. This should undo the "start" argument. 5740 Otherwise the screen will look messed up. 5741 5742 The {term-list} can have two forms: 5743 5744 1. A string with escape sequences. 5745 This is any string of characters, except that it can't start with 5746 "t_" and blanks are not allowed. The <> notation is recognized 5747 here, so you can use things like "<Esc>" and "<Space>". Example: 5748 start=<Esc>[27h;<Esc>[<Space>r; 5749 5750 2. A list of terminal codes. 5751 Each terminal code has the form "t_xx", where "xx" is the name of 5752 the termcap entry. The codes have to be separated with commas. 5753 White space is not allowed. Example: 5754 start=t_C1,t_BL 5755 The terminal codes must exist for this to work. 5756 5757 5758 2. highlight arguments for color terminals 5759 5760 cterm={attr-list} *highlight-cterm* 5761 See above for the description of {attr-list} |attr-list|. 5762 The "cterm" argument is likely to be different from "term", when 5763 colors are used. For example, in a normal terminal comments could 5764 be underlined, in a color terminal they can be made Blue. 5765 Note: Some terminals (e.g., DOS console) can't mix these attributes 5766 with coloring. To be portable, use only one of "cterm=" OR "ctermfg=" 5767 OR "ctermbg=". 5768 5769 ctermfg={color-nr} *highlight-ctermfg* *E421* 5770 ctermbg={color-nr} *highlight-ctermbg* 5771 ctermul={color-nr} *highlight-ctermul* 5772 These give the foreground (ctermfg), background (ctermbg) and 5773 underline (ctermul) color to use in the terminal. 5774 5775 The {color-nr} argument is a color number. Its range is zero to 5776 (not including) the number given by the termcap entry "Co". 5777 The actual color with this number depends on the type of terminal 5778 and its settings. Sometimes the color also depends on the settings of 5779 "cterm". For example, on some systems "cterm=bold ctermfg=3" gives 5780 another color, on others you just get color 3. 5781 5782 For an xterm this depends on your resources, and is a bit 5783 unpredictable. See your xterm documentation for the defaults. The 5784 colors for a color-xterm can be changed from the .Xdefaults file. 5785 Unfortunately this means that it's not possible to get the same colors 5786 for each user. See |xterm-color| for info about color xterms. 5787 *tmux* 5788 When using tmux you may want to use this in the tmux config: > 5789 # tmux colors 5790 set -s default-terminal "tmux-256color" 5791 set -as terminal-overrides ",*-256color:Tc" 5792 < More info at: 5793 https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal 5794 https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour 5795 5796 The MS-Windows standard colors are fixed (in a console window), so 5797 these have been used for the names. But the meaning of color names in 5798 X11 are fixed, so these color settings have been used, to make the 5799 highlighting settings portable (complicated, isn't it?). The 5800 following names are recognized, with the color number used: 5801 5802 *cterm-colors* 5803 NR-16 NR-8 COLOR NAME ~ 5804 0 0 Black 5805 1 4 DarkBlue 5806 2 2 DarkGreen 5807 3 6 DarkCyan 5808 4 1 DarkRed 5809 5 5 DarkMagenta 5810 6 3 Brown, DarkYellow 5811 7 7 LightGray, LightGrey, Gray, Grey 5812 8 0* DarkGray, DarkGrey 5813 9 4* Blue, LightBlue 5814 10 2* Green, LightGreen 5815 11 6* Cyan, LightCyan 5816 12 1* Red, LightRed 5817 13 5* Magenta, LightMagenta 5818 14 3* Yellow, LightYellow 5819 15 7* White 5820 5821 The number under "NR-16" is used for 16-color terminals ('t_Co' 5822 greater than or equal to 16). The number under "NR-8" is used for 5823 8-color terminals ('t_Co' less than 16). The '*' indicates that the 5824 bold attribute is set for ctermfg. In many 8-color terminals (e.g., 5825 "linux"), this causes the bright colors to appear. This doesn't work 5826 for background colors! Without the '*' the bold attribute is removed. 5827 If you want to set the bold attribute in a different way, put a 5828 "cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument. Or use 5829 a number instead of a color name. 5830 5831 The case of the color names is ignored, however Vim will use lower 5832 case color names when reading from the |v:colornames| dictionary. 5833 Note that for 16 color ansi style terminals (including xterms), the 5834 numbers in the NR-8 column is used. Here '*' means 'add 8' so that 5835 Blue is 12, DarkGray is 8 etc. 5836 5837 Note that for some color terminals these names may result in the wrong 5838 colors! 5839 5840 You can also use "NONE" to remove the color. 5841 5842 *:hi-normal-cterm* 5843 When setting the "ctermfg" or "ctermbg" colors for the Normal group, 5844 these will become the colors used for the non-highlighted text. 5845 Example: > 5846 :highlight Normal ctermfg=grey ctermbg=darkblue 5847 < When setting the "ctermbg" color for the Normal group, the 5848 'background' option will be adjusted automatically, under the 5849 condition that the color is recognized and 'background' was not set 5850 explicitly. This causes the highlight groups that depend on 5851 'background' to change! This means you should set the colors for 5852 Normal first, before setting other colors. 5853 When a color scheme is being used, changing 'background' causes it to 5854 be reloaded, which may reset all colors (including Normal). First 5855 delete the "g:colors_name" variable when you don't want this. 5856 5857 When you have set "ctermfg" or "ctermbg" for the Normal group, Vim 5858 needs to reset the color when exiting. This is done with the "op" 5859 termcap entry |t_op|. If this doesn't work correctly, try setting the 5860 't_op' option in your .vimrc. 5861 *E419* *E420* *E453* 5862 When Vim knows the normal foreground, background and underline colors, 5863 "fg", "bg" and "ul" can be used as color names. This only works after 5864 setting the colors for the Normal group and for the MS-Windows 5865 console. Example, for reverse video: > 5866 :highlight Visual ctermfg=bg ctermbg=fg 5867 < Note that the colors are used that are valid at the moment this 5868 command is given. If the Normal group colors are changed later, the 5869 "fg" and "bg" colors will not be adjusted. 5870 5871 ctermfont={font-nr} *highlight-ctermfont* 5872 This gives the alternative font number to use in the terminal. The 5873 available fonts depend on the terminal, and if the terminal is not set 5874 up for alternative fonts this simply won't do anything. The range of 5875 {font-nr} is 0-10 where 0 resets the font to the default font, 1-9 5876 selects one of the 9 alternate fonts, and 10 selects the Fraktur font. 5877 For more information see your terminal's handling of SGR parameters 5878 10-20. |t_CF| 5879 5880 3. highlight arguments for the GUI 5881 5882 gui={attr-list} *highlight-gui* 5883 These give the attributes to use in the GUI mode. 5884 See |attr-list| for a description. 5885 Note that "bold" can be used here and by using a bold font. They 5886 have the same effect. 5887 Note that the attributes are ignored for the "Normal" group. 5888 5889 font={font-name} *highlight-font* 5890 font-name is the name of a font, as it is used on the system Vim 5891 runs on. For X11 this is a complicated name, for example: > 5892 font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1 5893 < 5894 The font-name "NONE" can be used to revert to the default font. 5895 When setting the font for the "Normal" group, this becomes the default 5896 font (until the 'guifont' option is changed; the last one set is 5897 used). 5898 In the GTK GUI, a font can only be set for the "Normal" group; for 5899 other groups it is accepted but has no effect. 5900 The following only works with Motif, not with other GUIs: 5901 When setting the font for the "Menu" group, the menus will be changed. 5902 When setting the font for the "Tooltip" group, the tooltips will be 5903 changed. 5904 All fonts used, except for Menu and Tooltip, should be of the same 5905 character size as the default font! Otherwise redrawing problems will 5906 occur. 5907 To use a font name with an embedded space or other special character, 5908 put it in single quotes. The single quote cannot be used then. 5909 Example: > 5910 :hi Normal font='Monospace 10' 5911 5912 guifg={color-name} *highlight-guifg* 5913 guibg={color-name} *highlight-guibg* 5914 guisp={color-name} *highlight-guisp* 5915 These give the foreground (guifg), background (guibg) and special 5916 (guisp) color to use in the GUI. "guisp" is used for undercurl and 5917 strikethrough. 5918 There are a few special names: 5919 NONE no color (transparent) *E1361* 5920 bg use normal background color 5921 background use normal background color 5922 fg use normal foreground color 5923 foreground use normal foreground color 5924 To use a color name with an embedded space or other special character, 5925 put it in single quotes. The single quote cannot be used then. 5926 Example: > 5927 :hi comment guifg='salmon pink' 5928 < 5929 *gui-colors* 5930 Suggested color names (these are available on most systems): 5931 Red LightRed DarkRed 5932 Green LightGreen DarkGreen SeaGreen 5933 Blue LightBlue DarkBlue SlateBlue 5934 Cyan LightCyan DarkCyan 5935 Magenta LightMagenta DarkMagenta 5936 Yellow LightYellow Brown DarkYellow 5937 Gray LightGray DarkGray 5938 Black White 5939 Orange Purple Violet 5940 5941 In the Win32 GUI version, additional system colors are available. See 5942 |win32-colors|. 5943 5944 You can also specify a color by its Red, Green and Blue values. 5945 The format is "#rrggbb", where 5946 "rr" is the Red value 5947 "gg" is the Green value 5948 "bb" is the Blue value 5949 All values are hexadecimal, range from "00" to "ff". Examples: > 5950 :highlight Comment guifg=#11f0c3 guibg=#ff00ff 5951 < 5952 If you are authoring a color scheme and use the same hexadecimal value 5953 repeatedly, you can define a (lower case) name for it in 5954 |v:colornames|. For example: > 5955 5956 # provide a default value for this color but allow the user to 5957 # override it. 5958 :call extend(v:colornames, {'alt_turquoise': '#11f0c3'}, 'keep') 5959 :highlight Comment guifg=alt_turquoise guibg=magenta 5960 < 5961 If you are using a color scheme that relies on named colors and you 5962 would like to adjust the precise appearance of those colors, you can 5963 do so by overriding the values in |v:colornames| prior to loading the 5964 scheme: > 5965 5966 let v:colornames['alt_turquoise'] = '#22f0d3' 5967 colorscheme alt 5968 < 5969 If you want to develop a color list that can be relied on by others, 5970 it is best to prefix your color names. By convention these color 5971 lists are placed in the colors/lists directory. You can see an 5972 example in "$VIMRUNTIME/colors/lists/csscolors.vim". This list would 5973 be sourced by a color scheme using: > 5974 5975 :runtime colors/lists/csscolors.vim 5976 :highlight Comment guifg=css_turquoise 5977 < 5978 5979 *highlight-groups* *highlight-default* 5980 These are the default highlighting groups. These groups are used by the 5981 'highlight' option default. Note that the highlighting depends on the value 5982 of 'background'. You can see the current settings with the ":highlight" 5983 command. 5984 When possible the name is highlighted in the used colors. If this makes it 5985 unreadable use Visual selection. 5986 5987 *hl-ColorColumn* 5988 ColorColumn Used for the columns set with 'colorcolumn'. 5989 *hl-Conceal* 5990 Conceal Placeholder characters substituted for concealed 5991 text (see 'conceallevel'). 5992 *hl-Cursor* *hl-lCursor* 5993 Cursor Character under the cursor. 5994 lCursor Character under the cursor when |language-mapping| 5995 is used (see 'guicursor'). 5996 *hl-CursorIM* 5997 CursorIM Like Cursor, but used when in IME mode. |CursorIM| 5998 *hl-CursorColumn* 5999 CursorColumn Screen column that the cursor is in when 'cursorcolumn' is 6000 set. 6001 *hl-CursorLine* 6002 CursorLine Screen line that the cursor is in when 'cursorline' is set. 6003 *hl-Directory* 6004 Directory Directory names (and other special names in listings). 6005 *hl-DiffAdd* 6006 DiffAdd Diff mode: Added line. |diff.txt| 6007 *hl-DiffChange* 6008 DiffChange Diff mode: Changed line. |diff.txt| 6009 *hl-DiffDelete* 6010 DiffDelete Diff mode: Deleted line. |diff.txt| 6011 *hl-DiffText* 6012 DiffText Diff mode: Changed text within a changed line. |diff.txt| 6013 *hl-DiffTextAdd* 6014 DiffTextAdd Diff mode: Added text within a changed line. Linked to 6015 |hl-DiffText| by default. |diff.txt| 6016 *hl-EndOfBuffer* 6017 EndOfBuffer Filler lines (~) after the last line in the buffer. 6018 By default, this is highlighted like |hl-NonText|. 6019 *hl-ErrorMsg* 6020 ErrorMsg Error messages on the command line. 6021 *hl-VertSplit* 6022 VertSplit Column separating vertically split windows that is adjacent 6023 to the current window. Drawn with the "vert" item of 6024 'fillchars'. 6025 *hl-VertSplitNC* 6026 VertSplitNC Column separating vertically split windows where neither 6027 adjacent window is the current window. Drawn with the 6028 "vert" item of 'fillchars'. 6029 By default, highlighted like |hl-VertSplit|. 6030 *hl-Folded* 6031 Folded Line used for closed folds. 6032 *hl-FoldColumn* 6033 FoldColumn 'foldcolumn' 6034 *hl-SignColumn* 6035 SignColumn Column where |signs| are displayed. 6036 *hl-IncSearch* 6037 IncSearch 'incsearch' highlighting; also used for the text replaced with 6038 ":s///c". 6039 *hl-LineNr* 6040 LineNr Line number for ":number" and ":#" commands, and when 'number' 6041 or 'relativenumber' option is set. 6042 *hl-LineNrAbove* 6043 LineNrAbove Line number for when the 'relativenumber' 6044 option is set, above the cursor line. 6045 *hl-LineNrBelow* 6046 LineNrBelow Line number for when the 'relativenumber' 6047 option is set, below the cursor line. 6048 *hl-CursorLineNr* 6049 CursorLineNr Like LineNr when 'cursorline' is set and 'cursorlineopt' 6050 contains "number" or is "both", for the cursor line. 6051 *hl-CursorLineFold* 6052 CursorLineFold Like FoldColumn when 'cursorline' is set for the cursor line. 6053 *hl-CursorLineSign* 6054 CursorLineSign Like SignColumn when 'cursorline' is set for the cursor line. 6055 *hl-MatchParen* 6056 MatchParen Character under the cursor or just before it, if it 6057 is a paired bracket, and its match. |pi_paren.txt| 6058 *hl-MessageWindow* 6059 MessageWindow Messages popup window used by `:echowindow`. Linked to 6060 |hl-WarningMsg| by default. 6061 *hl-ModeMsg* 6062 ModeMsg 'showmode' message (e.g., "-- INSERT --"). 6063 *hl-MsgArea* 6064 MsgArea Command-line area, also used for outputting messages, see also 6065 'cmdheight' 6066 *hl-MoreMsg* 6067 MoreMsg |more-prompt| 6068 *hl-NonText* 6069 NonText '@' at the end of the window, "<<<" at the start of the window 6070 for 'smoothscroll', characters from 'showbreak' and other 6071 characters that do not really exist in the text, such as the 6072 ">" displayed when a double-wide character doesn't fit at the 6073 end of the line. 6074 *hl-Normal* 6075 Normal Normal text. 6076 *hl-Pmenu* 6077 Pmenu Popup menu: Normal item. 6078 *hl-PmenuSel* 6079 PmenuSel Popup menu: Selected item. 6080 *hl-PmenuKind* 6081 PmenuKind Popup menu: Normal item "kind". 6082 *hl-PmenuKindSel* 6083 PmenuKindSel Popup menu: Selected item "kind". 6084 *hl-PmenuExtra* 6085 PmenuExtra Popup menu: Normal item "extra text". 6086 *hl-PmenuExtraSel* 6087 PmenuExtraSel Popup menu: Selected item "extra text". 6088 *hl-PmenuSbar* 6089 PmenuSbar Popup menu: Scrollbar. 6090 *hl-PmenuThumb* 6091 PmenuThumb Popup menu: Thumb of the scrollbar. 6092 *hl-PmenuMatch* 6093 PmenuMatch Popup menu: Matched text in normal item. Applied in 6094 combination with |hl-Pmenu|. 6095 *hl-PmenuMatchSel* 6096 PmenuMatchSel Popup menu: Matched text in selected item. Applied in 6097 combination with |hl-PmenuSel|. 6098 *hl-PmenuBorder* 6099 PmenuBorder Popup menu: Border characters. 6100 Linked to |hl-Pmenu| by default. 6101 *hl-PmenuShadow* 6102 PmenuShadow Popup menu: Used for shadow. 6103 *hl-ComplMatchIns* 6104 ComplMatchIns Matched text of the currently inserted completion. 6105 *hl-PreInsert* 6106 PreInsert Text inserted when "preinsert" is in 'completeopt'. 6107 *hl-Popup* 6108 Popup Popup window body, used when neither the popup's 'wincolor' 6109 nor explicit "highlight" argument is set. Linked to |hl-Pmenu| 6110 by default. 6111 *hl-PopupBorder* 6112 PopupBorder Popup window border characters, used when "borderhighlight" is 6113 not set and the popup's 'wincolor' is also not set. 6114 Linked to |hl-Pmenu| by default. 6115 *hl-PopupTitle* 6116 PopupTitle Popup window title, used when "borderhighlight" is not set and 6117 the popup's 'wincolor' is also not set. Linked to 6118 |hl-Pmenu| by default. 6119 *hl-PopupSelected* 6120 PopupSelected Popup window created with |popup_menu()|. Linked to 6121 |hl-PmenuSel| by default. 6122 *hl-PopupNotification* 6123 PopupNotification 6124 Popup window created with |popup_notification()|. Linked to 6125 |hl-WarningMsg| by default. 6126 *hl-Question* 6127 Question |hit-enter| prompt and yes/no questions. 6128 *hl-QuickFixLine* 6129 QuickFixLine Current |quickfix| item in the quickfix window. 6130 *hl-Search* 6131 Search Last search pattern highlighting (see 'hlsearch'). 6132 Also used for similar items that need to stand out. 6133 *hl-CurSearch* 6134 CurSearch Current match for the last search pattern (see 'hlsearch'). 6135 Note: This is correct after a search, but may get outdated if 6136 changes are made or the screen is redrawn. 6137 *hl-SpecialKey* 6138 SpecialKey Meta and special keys listed with ":map", also for text used 6139 to show unprintable characters in the text, 'listchars'. 6140 Generally: Text that is displayed differently from what it 6141 really is. 6142 *hl-SpellBad* 6143 SpellBad Word that is not recognized by the spellchecker. |spell| 6144 This will be combined with the highlighting used otherwise. 6145 *hl-SpellCap* 6146 SpellCap Word that should start with a capital. |spell| 6147 This will be combined with the highlighting used otherwise. 6148 *hl-SpellLocal* 6149 SpellLocal Word that is recognized by the spellchecker as one that is 6150 used in another region. |spell| 6151 This will be combined with the highlighting used otherwise. 6152 *hl-SpellRare* 6153 SpellRare Word that is recognized by the spellchecker as one that is 6154 hardly ever used. |spell| 6155 This will be combined with the highlighting used otherwise. 6156 *hl-StatusLine* 6157 StatusLine Status line of current window. The highlight at the status 6158 line's edge (StatusLine, or any %#... / %N* in 'statusline') 6159 also extends into the adjacent vertical separator cell when 6160 the status lines are connected (The "vert" in 'fillchars' is 6161 not being drawn). 6162 *hl-StatusLineNC* 6163 StatusLineNC status lines of not-current windows. Like |hl-StatusLine|, 6164 the edge highlight also extends into the adjacent vertical 6165 separator cell. 6166 Note: If this is equal to "StatusLine", Vim will use "^^^" in 6167 the status line of the current window. 6168 *hl-StatusLineTerm* 6169 StatusLineTerm Status line of current window, if it is a |terminal| window. 6170 *hl-StatusLineTermNC* 6171 StatusLineTermNC 6172 Status lines of not-current windows that is a |terminal| 6173 window. 6174 *hl-TabLine* 6175 TabLine Tab pages line, not active tab page label. 6176 *hl-TabLineFill* 6177 TabLineFill Tab pages line, where there are no labels. 6178 *hl-TabLineSel* 6179 TabLineSel Tab pages line, active tab page label. 6180 *hl-TabPanel* 6181 TabPanel TabPanel, not active tab page label. 6182 *hl-TabPanelFill* 6183 TabPanelFill TabPanel, where there are no labels. 6184 *hl-TabPanelSel* 6185 TabPanelSel TabPanel, active tab page label. 6186 *hl-Terminal* 6187 Terminal |terminal| window (see |terminal-size-color|). 6188 *hl-Title* 6189 Title Titles for output from ":set all", ":autocmd" etc. 6190 *hl-TitleBar* 6191 TitleBar Title bar for the active Gui's window. 6192 This feature is supported only in the MS-Windows GUI. 6193 See |gui-w32-title-bar| for details. 6194 Only the `guibg` and `guifg` highlight arguments are effective. 6195 *hl-TitleBarNC* 6196 TitleBarNC Title bar for inactive Gui's window. 6197 This feature is supported only in the MS-Windows GUI. 6198 See |gui-w32-title-bar| for details. 6199 Only the `guibg` and `guifg` highlight arguments are effective. 6200 *hl-Visual* 6201 Visual Visual mode selection. 6202 *hl-VisualNOS* 6203 VisualNOS Visual mode selection when vim is "Not Owning the Selection". 6204 Only X11 Gui's |gui-x11|, |xterm-clipboard| and 6205 |wayland-selections| supports this. 6206 *hl-WarningMsg* 6207 WarningMsg Warning messages. 6208 *hl-WildMenu* 6209 WildMenu Current match in 'wildmenu' completion. 6210 6211 *hl-User1* *hl-User1..9* *hl-User9* 6212 The 'statusline' syntax allows the use of 9 different highlights in the 6213 statusline and ruler (via 'rulerformat'). The names are User1 to User9. 6214 6215 For the GUI you can use the following groups to set the colors for the menu, 6216 scrollbars and tooltips. They don't have defaults. This doesn't work for the 6217 Win32 GUI. Only three highlight arguments have any effect here: font, guibg, 6218 and guifg. 6219 6220 *hl-Menu* 6221 Menu Current font, background and foreground colors of the menus. 6222 Also used for the toolbar. 6223 Applicable highlight arguments: font, guibg, guifg. 6224 6225 NOTE: For Motif the font argument actually specifies a fontset 6226 at all times, no matter if 'guifontset' is empty, and as such 6227 it is tied to the current |:language| when set. 6228 6229 *hl-Scrollbar* 6230 Scrollbar Current background and foreground of the main window's 6231 scrollbars. 6232 Applicable highlight arguments: guibg, guifg. 6233 6234 *hl-Tooltip* 6235 Tooltip Current font, background and foreground of the tooltips. 6236 Applicable highlight arguments: font, guibg, guifg. 6237 6238 NOTE: For Motif the font argument actually specifies a fontset 6239 at all times, no matter if 'guifontset' is empty, and as such 6240 it is tied to the current |:language| when set. 6241 6242 ============================================================================== 6243 15. Linking groups *:hi-link* *:highlight-link* *E412* *E413* 6244 6245 When you want to use the same highlighting for several syntax groups, you 6246 can do this more easily by linking the groups into one common highlight 6247 group, and give the color attributes only for that group. 6248 6249 To set a link: 6250 6251 :hi[ghlight][!] [default] link {from-group} {to-group} 6252 6253 To remove a link: 6254 6255 :hi[ghlight][!] [default] link {from-group} NONE 6256 6257 Notes: *E414* 6258 - If the {from-group} and/or {to-group} doesn't exist, it is created. You 6259 don't get an error message for a non-existing group. 6260 - As soon as you use a ":highlight" command for a linked group, the link is 6261 removed. 6262 - If there are already highlight settings for the {from-group}, the link is 6263 not made, unless the '!' is given. For a ":highlight link" command in a 6264 sourced file, you don't get an error message. This can be used to skip 6265 links for groups that already have settings. 6266 6267 *:hi-default* *:highlight-default* 6268 The [default] argument is used for setting the default highlighting for a 6269 group. If highlighting has already been specified for the group the command 6270 will be ignored. Also when there is an existing link. 6271 6272 Using [default] is especially useful to overrule the highlighting of a 6273 specific syntax file. For example, the C syntax file contains: > 6274 :highlight default link cComment Comment 6275 If you like Question highlighting for C comments, put this in your vimrc file: > 6276 :highlight link cComment Question 6277 Without the "default" in the C syntax file, the highlighting would be 6278 overruled when the syntax file is loaded. 6279 6280 To have a link survive `:highlight clear`, which is useful if you have 6281 highlighting for a specific filetype and you want to keep it when selecting 6282 another color scheme, put a command like this in the 6283 "after/syntax/{filetype}.vim" file: > 6284 highlight! default link cComment Question 6285 6286 ============================================================================== 6287 16. Cleaning up *:syn-clear* *E391* 6288 6289 If you want to clear the syntax stuff for the current buffer, you can use this 6290 command: > 6291 :syntax clear 6292 6293 This command should be used when you want to switch off syntax highlighting, 6294 or when you want to switch to using another syntax. It's normally not needed 6295 in a syntax file itself, because syntax is cleared by the autocommands that 6296 load the syntax file. 6297 The command also deletes the "b:current_syntax" variable, since no syntax is 6298 loaded after this command. 6299 6300 To clean up specific syntax groups for the current buffer: > 6301 :syntax clear {group-name} ... 6302 This removes all patterns and keywords for {group-name}. 6303 6304 To clean up specific syntax group lists for the current buffer: > 6305 :syntax clear @{grouplist-name} ... 6306 This sets {grouplist-name}'s contents to an empty list. 6307 6308 *:syntax-off* *:syn-off* 6309 If you want to disable syntax highlighting for all buffers, you need to remove 6310 the autocommands that load the syntax files: > 6311 :syntax off 6312 6313 What this command actually does, is executing the command > 6314 :source $VIMRUNTIME/syntax/nosyntax.vim 6315 See the "nosyntax.vim" file for details. Note that for this to work 6316 $VIMRUNTIME must be valid. See |$VIMRUNTIME|. 6317 6318 *:syntax-reset* *:syn-reset* 6319 If you have changed the colors and messed them up, use this command to get the 6320 defaults back: > 6321 6322 :syntax reset 6323 6324 It is a bit of a wrong name, since it does not reset any syntax items, it only 6325 affects the highlighting. 6326 6327 This doesn't change the colors for the 'highlight' option. 6328 6329 Note that the syntax colors that you set in your vimrc file will also be reset 6330 back to their Vim default. 6331 Note that if you are using a color scheme, the colors defined by the color 6332 scheme for syntax highlighting will be lost. 6333 6334 What this actually does is: > 6335 6336 let g:syntax_cmd = "reset" 6337 runtime! syntax/syncolor.vim 6338 6339 Note that this uses the 'runtimepath' option. 6340 6341 *syncolor* 6342 If you want to use different colors for syntax highlighting, you can add a Vim 6343 script file to set these colors. Put this file in a directory in 6344 'runtimepath' which comes after $VIMRUNTIME, so that your settings overrule 6345 the default colors. This way these colors will be used after the ":syntax 6346 reset" command. 6347 6348 For Unix you can use the file ~/.vim/after/syntax/syncolor.vim. Example: > 6349 6350 if &background == "light" 6351 highlight comment ctermfg=darkgreen guifg=darkgreen 6352 else 6353 highlight comment ctermfg=green guifg=green 6354 endif 6355 < 6356 *E679* 6357 Do make sure this syncolor.vim script does not use a "syntax on", set the 6358 'background' option or uses a "colorscheme" command, because it results in an 6359 endless loop. 6360 6361 Note that when a color scheme is used, there might be some confusion whether 6362 your defined colors are to be used or the colors from the scheme. This 6363 depends on the color scheme file. See |:colorscheme|. 6364 6365 *syntax_cmd* 6366 The "syntax_cmd" variable is set to one of these values when the 6367 syntax/syncolor.vim files are loaded: 6368 "on" `:syntax on` command. Highlight colors are overruled but 6369 links are kept 6370 "enable" `:syntax enable` command. Only define colors for groups that 6371 don't have highlighting yet. Use `:highlight default` . 6372 "reset" `:syntax reset` command or loading a color scheme. Define all 6373 the colors. 6374 "skip" Don't define colors. Used to skip the default settings when a 6375 syncolor.vim file earlier in 'runtimepath' has already set 6376 them. 6377 6378 ============================================================================== 6379 17. Highlighting tags *tag-highlight* 6380 6381 If you want to highlight all the tags in your file, you can use the following 6382 mappings. 6383 6384 <F11> -- Generate tags.vim file, and highlight tags. 6385 <F12> -- Just highlight tags based on existing tags.vim file. 6386 > 6387 :map <F11> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12> 6388 :map <F12> :so tags.vim<CR> 6389 6390 WARNING: The longer the tags file, the slower this will be, and the more 6391 memory Vim will consume. 6392 6393 Only highlighting typedefs, unions and structs can be done too. For this you 6394 must use Universal Ctags (found at https://ctags.io) or Exuberant ctags (found 6395 at http://ctags.sf.net). 6396 6397 Put these lines in your Makefile: 6398 6399 # Make a highlight file for types. Requires Universal/Exuberant ctags and awk 6400 types: types.vim 6401 types.vim: *.[ch] 6402 ctags --c-kinds=gstu -o- *.[ch] |\ 6403 awk 'BEGIN{printf("syntax keyword Type\t")}\ 6404 {printf("%s ", $$1)}END{print ""}' > $@ 6405 6406 And put these lines in your .vimrc: > 6407 6408 " load the types.vim highlighting file, if it exists 6409 autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') .. '/types.vim' 6410 autocmd BufRead,BufNewFile *.[ch] if filereadable(fname) 6411 autocmd BufRead,BufNewFile *.[ch] exe 'so ' .. fname 6412 autocmd BufRead,BufNewFile *.[ch] endif 6413 6414 ============================================================================== 6415 18. Window-local syntax *:ownsyntax* 6416 6417 Normally all windows on a buffer share the same syntax settings. It is 6418 possible, however, to set a particular window on a file to have its own 6419 private syntax setting. A possible example would be to edit LaTeX source 6420 with conventional highlighting in one window, while seeing the same source 6421 highlighted differently (so as to hide control sequences and indicate bold, 6422 italic etc regions) in another. The 'scrollbind' option is useful here. 6423 6424 To set the current window to have the syntax "foo", separately from all other 6425 windows on the buffer: > 6426 :ownsyntax foo 6427 < *w:current_syntax* 6428 This will set the "w:current_syntax" variable to "foo". The value of 6429 "b:current_syntax" does not change. This is implemented by saving and 6430 restoring "b:current_syntax", since the syntax files do set 6431 "b:current_syntax". The value set by the syntax file is assigned to 6432 "w:current_syntax". 6433 Note: This resets the 'spell', 'spellcapcheck', 'spellfile' and 'spelloptions' 6434 options. 6435 6436 Once a window has its own syntax, syntax commands executed from other windows 6437 on the same buffer (including :syntax clear) have no effect. Conversely, 6438 syntax commands executed from that window do not affect other windows on the 6439 same buffer. 6440 6441 A window with its own syntax reverts to normal behavior when another buffer 6442 is loaded into that window or the file is reloaded. 6443 When splitting the window, the new window will use the original syntax. 6444 6445 ============================================================================== 6446 19. Color xterms *xterm-color* *color-xterm* 6447 6448 Most color xterms have only eight colors. If you don't get colors with the 6449 default setup, it should work with these lines in your .vimrc: > 6450 :if &term =~ "xterm" 6451 : if has("terminfo") 6452 : set t_Co=8 6453 : set t_Sf=<Esc>[3%p1%dm 6454 : set t_Sb=<Esc>[4%p1%dm 6455 : else 6456 : set t_Co=8 6457 : set t_Sf=<Esc>[3%dm 6458 : set t_Sb=<Esc>[4%dm 6459 : endif 6460 :endif 6461 < [<Esc> is a real escape, type CTRL-V <Esc>] 6462 6463 You might want to change the first "if" to match the name of your terminal, 6464 e.g. "dtterm" instead of "xterm". 6465 6466 Note: Do these settings BEFORE doing ":syntax on". Otherwise the colors may 6467 be wrong. 6468 *xiterm* *rxvt* 6469 The above settings have been mentioned to work for xiterm and rxvt too. 6470 But for using 16 colors in an rxvt these should work with terminfo: > 6471 :set t_AB=<Esc>[%?%p1%{8}%<%t25;%p1%{40}%+%e5;%p1%{32}%+%;%dm 6472 :set t_AF=<Esc>[%?%p1%{8}%<%t22;%p1%{30}%+%e1;%p1%{22}%+%;%dm 6473 < 6474 *colortest.vim* 6475 To test your color setup, a file has been included in the Vim distribution. 6476 To use it, execute this command: > 6477 :runtime syntax/colortest.vim 6478 6479 Some versions of xterm (and other terminals, like the Linux console) can 6480 output lighter foreground colors, even though the number of colors is defined 6481 at 8. Therefore Vim sets the "cterm=bold" attribute for light foreground 6482 colors, when 't_Co' is 8. 6483 6484 *xfree-xterm* 6485 To get 16 colors or more, get the newest xterm version (which should be 6486 included with XFree86 3.3 and later). You can also find the latest version 6487 at: > 6488 http://invisible-island.net/xterm/xterm.html 6489 Here is a good way to configure it. This uses 88 colors and enables the 6490 termcap-query feature, which allows Vim to ask the xterm how many colors it 6491 supports. > 6492 ./configure --disable-bold-color --enable-88-color --enable-tcap-query 6493 If you only get 8 colors, check the xterm compilation settings. 6494 (Also see |UTF8-xterm| for using this xterm with UTF-8 character encoding). 6495 6496 This xterm should work with these lines in your .vimrc (for 16 colors): > 6497 :if has("terminfo") 6498 : set t_Co=16 6499 : set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm 6500 : set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm 6501 :else 6502 : set t_Co=16 6503 : set t_Sf=<Esc>[3%dm 6504 : set t_Sb=<Esc>[4%dm 6505 :endif 6506 < [<Esc> is a real escape, type CTRL-V <Esc>] 6507 6508 Without |+terminfo|, Vim will recognize these settings, and automatically 6509 translate cterm colors of 8 and above to "<Esc>[9%dm" and "<Esc>[10%dm". 6510 Colors above 16 are also translated automatically. 6511 6512 For 256 colors this has been reported to work: > 6513 6514 :set t_AB=<Esc>[48;5;%dm 6515 :set t_AF=<Esc>[38;5;%dm 6516 6517 Or just set the TERM environment variable to "xterm-color" or "xterm-16color" 6518 and try if that works. 6519 6520 You probably want to use these X resources (in your ~/.Xdefaults file): 6521 XTerm*color0: #000000 6522 XTerm*color1: #c00000 6523 XTerm*color2: #008000 6524 XTerm*color3: #808000 6525 XTerm*color4: #0000c0 6526 XTerm*color5: #c000c0 6527 XTerm*color6: #008080 6528 XTerm*color7: #c0c0c0 6529 XTerm*color8: #808080 6530 XTerm*color9: #ff6060 6531 XTerm*color10: #00ff00 6532 XTerm*color11: #ffff00 6533 XTerm*color12: #8080ff 6534 XTerm*color13: #ff40ff 6535 XTerm*color14: #00ffff 6536 XTerm*color15: #ffffff 6537 Xterm*cursorColor: Black 6538 6539 [Note: The cursorColor is required to work around a bug, which changes the 6540 cursor color to the color of the last drawn text. This has been fixed by a 6541 newer version of xterm, but not everybody is using it yet.] 6542 6543 To get these right away, reload the .Xdefaults file to the X Option database 6544 Manager (you only need to do this when you just changed the .Xdefaults file): > 6545 xrdb -merge ~/.Xdefaults 6546 < 6547 *xterm-blink* *xterm-blinking-cursor* 6548 To make the cursor blink in an xterm, see tools/blink.c. Or use Thomas 6549 Dickey's xterm above patchlevel 107 (see above for where to get it), with 6550 these resources: 6551 XTerm*cursorBlink: on 6552 XTerm*cursorOnTime: 400 6553 XTerm*cursorOffTime: 250 6554 XTerm*cursorColor: White 6555 6556 *hpterm-color* 6557 These settings work (more or less) for an hpterm, which only supports 8 6558 foreground colors: > 6559 :if has("terminfo") 6560 : set t_Co=8 6561 : set t_Sf=<Esc>[&v%p1%dS 6562 : set t_Sb=<Esc>[&v7S 6563 :else 6564 : set t_Co=8 6565 : set t_Sf=<Esc>[&v%dS 6566 : set t_Sb=<Esc>[&v7S 6567 :endif 6568 < [<Esc> is a real escape, type CTRL-V <Esc>] 6569 6570 *Eterm* *enlightened-terminal* 6571 These settings have been reported to work for the Enlightened terminal 6572 emulator, or Eterm. They might work for all xterm-like terminals that use the 6573 bold attribute to get bright colors. Add an ":if" like above when needed. > 6574 :set t_Co=16 6575 :set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m 6576 :set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m 6577 < 6578 *TTpro-telnet* 6579 These settings should work for TTpro telnet. Tera Term Pro is a freeware / 6580 open-source program for MS-Windows. > 6581 set t_Co=16 6582 set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{32}%+5;%;%dm 6583 set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm 6584 Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure 6585 that Setup / Font / Enable Bold is NOT enabled. 6586 (info provided by John Love-Jensen <eljay@Adobe.COM>) 6587 6588 6589 ============================================================================== 6590 20. When syntax is slow *:synti* *:syntime* 6591 6592 This is aimed at authors of a syntax file. 6593 6594 If your syntax causes redrawing to be slow, here are a few hints on making it 6595 faster. To see slowness switch on some features that usually interfere, such 6596 as 'relativenumber' and |folding|. 6597 6598 Note: This is only available when compiled with the |+profile| feature. 6599 You may need to build Vim with "huge" features. 6600 6601 To find out what patterns are consuming the most time, get an overview with 6602 this sequence: > 6603 :syntime on 6604 [ redraw the text at least once with CTRL-L ] 6605 :syntime report 6606 6607 This will display a list of syntax patterns that were used, sorted by the time 6608 it took to match them against the text. 6609 6610 :synti[me] on Start measuring syntax times. This will add some 6611 overhead to compute the time spent on syntax pattern 6612 matching. 6613 6614 :synti[me] off Stop measuring syntax times. 6615 6616 :synti[me] clear Set all the counters to zero, restart measuring. 6617 6618 :synti[me] report Show the syntax items used since ":syntime on" in the 6619 current window. Use a wider display to see more of 6620 the output. 6621 6622 The list is sorted by total time. The columns are: 6623 TOTAL Total time in seconds spent on 6624 matching this pattern. 6625 COUNT Number of times the pattern was used. 6626 MATCH Number of times the pattern actually 6627 matched 6628 SLOWEST The longest time for one try. 6629 AVERAGE The average time for one try. 6630 NAME Name of the syntax item. Note that 6631 this is not unique. 6632 PATTERN The pattern being used. 6633 6634 Pattern matching gets slow when it has to try many alternatives. Try to 6635 include as much literal text as possible to reduce the number of ways a 6636 pattern does NOT match. 6637 6638 When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at 6639 all positions in the current and previous line. For example, if the item is 6640 literal text specify the size of that text (in bytes): 6641 6642 "<\@<=span" Matches "span" in "<span". This tries matching with "<" in 6643 many places. 6644 "<\@1<=span" Matches the same, but only tries one byte before "span". 6645 6646 6647 vim:tw=78:sw=4:ts=8:noet:ft=help:norl: