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