Mercurial > vim
comparison runtime/doc/syntax.txt @ 2642:840c3cadb842
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 16 Nov 2010 20:34:40 +0100 |
parents | fae782ef63dd |
children | 916c90b37ea9 |
comparison
equal
deleted
inserted
replaced
2641:b803b2776880 | 2642:840c3cadb842 |
---|---|
1 *syntax.txt* For Vim version 7.3. Last change: 2010 Sep 23 | 1 *syntax.txt* For Vim version 7.3. Last change: 2010 Oct 7 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
388 Or use the ":TOhtml" user command. It is defined in a standard plugin. | 388 Or use the ":TOhtml" user command. It is defined in a standard plugin. |
389 ":TOhtml" also works with a range and in a Visual area: > | 389 ":TOhtml" also works with a range and in a Visual area: > |
390 | 390 |
391 :10,40TOhtml | 391 :10,40TOhtml |
392 | 392 |
393 Warning: This is slow! The script must process every character of every line. | 393 Warning: This can be slow! The script must process every character of every |
394 Because it is so slow, by default a progress bar is displayed in the | 394 line. Because it can take a long time, by default a progress bar is displayed |
395 statusline for each step that usually takes a long time. If you don't like | 395 in the statusline for each major step in the conversion process. If you don't |
396 seeing this progress bar, you can disable it and get a very minor speed | 396 like seeing this progress bar, you can disable it and get a very minor speed |
397 improvement with: > | 397 improvement with: > |
398 | 398 |
399 let g:html_no_progress = 1 | 399 let g:html_no_progress = 1 |
400 | 400 |
401 ":TOhtml" has another special feature: if the window is in diff mode, it will | 401 ":TOhtml" has another special feature: if the window is in diff mode, it will |
473 risk of making some things look a bit different, use: > | 473 risk of making some things look a bit different, use: > |
474 :let g:html_no_pre = 1 | 474 :let g:html_no_pre = 1 |
475 This will use <br> at the end of each line and use " " for repeated | 475 This will use <br> at the end of each line and use " " for repeated |
476 spaces. | 476 spaces. |
477 | 477 |
478 The current value of 'encoding' is used to specify the charset of the HTML | 478 For diff mode on a single file (with g:html_diff_one_file) a sequence of more |
479 file. This only works for those values of 'encoding' that have an equivalent | 479 than 3 filler lines is displayed as three lines with the middle line |
480 HTML charset name. To overrule this set g:html_use_encoding to the name of | 480 mentioning the total number of inserted lines. If you prefer to see all the |
481 the charset to be used: > | 481 inserted lines as with the side-by-side diff, use: > |
482 :let g:html_use_encoding = "foobar" | 482 :let g:html_whole_filler = 1 |
483 To omit the line that specifies the charset, set g:html_use_encoding to an | 483 And to go back to displaying up to three lines again: > |
484 empty string: > | 484 :unlet g:html_whole_filler |
485 < | |
486 TOhtml uses the current value of 'fileencoding' if set, or 'encoding' if not, | |
487 to determine the charset and 'fileencoding' of the HTML file. In general, this | |
488 works for the encodings mentioned specifically by name in |encoding-names|, but | |
489 TOhtml will only automatically use those encodings which are widely supported. | |
490 However, you can override this to support specific encodings that may not be | |
491 automatically detected by default. | |
492 | |
493 To overrule all automatic charset detection, set g:html_use_encoding to the | |
494 name of the charset to be used. TOhtml will try to determine the appropriate | |
495 'fileencoding' setting from the charset, but you may need to set it manually | |
496 if TOhtml cannot determine the encoding. It is recommended to set this | |
497 variable to something widely supported, like UTF-8, for anything you will be | |
498 hosting on a webserver: > | |
499 :let g:html_use_encoding = "UTF-8" | |
500 You can also use this option to omit the line that specifies the charset | |
501 entirely, by setting g:html_use_encoding to an empty string: > | |
485 :let g:html_use_encoding = "" | 502 :let g:html_use_encoding = "" |
486 To go back to the automatic mechanism, delete the g:html_use_encoding | 503 To go back to the automatic mechanism, delete the g:html_use_encoding |
487 variable: > | 504 variable: > |
488 :unlet g:html_use_encoding | 505 :unlet g:html_use_encoding |
506 | |
507 If you specify a charset with g:html_use_encoding for which TOhtml cannot | |
508 automatically detect the corresponding 'fileencoding' setting, you can use | |
509 g:html_encoding_override to allow TOhtml to detect the correct encoding. | |
510 This is a dictionary of charset-encoding pairs that will replace existing | |
511 pairs automatically detected by TOhtml, or supplement with new pairs. For | |
512 example, to allow TOhtml to detect the HTML charset "windows-1252" properly as | |
513 the encoding "8bit-cp1252", use: > | |
514 :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'} | |
489 < | 515 < |
490 For diff mode a sequence of more than 3 filler lines is displayed as three | 516 The g:html_charset_override is similar, it allows TOhtml to detect the HTML |
491 lines with the middle line mentioning the total number of inserted lines. If | 517 charset for any 'fileencoding' or 'encoding' which is not detected |
492 you prefer to see all the inserted lines use: > | 518 automatically. You can also use it to override specific existing |
493 :let g:html_whole_filler = 1 | 519 encoding-charset pairs. For example, TOhtml will by default use UTF-8 for all |
494 And to go back to displaying up to three lines again: > | 520 Unicode/UCS encodings. To use UTF-16 and UTF-32 instead, use: > |
495 :unlet g:html_whole_filler | 521 :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'} |
496 < | 522 |
523 Note that documents encoded in either UTF-32 or UTF-16 have known | |
524 compatibility problems with at least one major browser. | |
525 | |
497 *convert-to-XML* *convert-to-XHTML* | 526 *convert-to-XML* *convert-to-XHTML* |
498 An alternative is to have the script generate XHTML (XML compliant HTML). To | 527 If you do not like plain HTML, an alternative is to have the script generate |
499 do this set the "html_use_xhtml" variable: > | 528 XHTML (XML compliant HTML). To do this set the "html_use_xhtml" variable: > |
500 :let g:html_use_xhtml = 1 | 529 :let g:html_use_xhtml = 1 |
501 | 530 |
502 Any of these options can be enabled or disabled by setting them explicitly to | 531 Any of the on/off options listed above can be enabled or disabled by setting |
503 the desired value, or restored to their default by removing the variable using | 532 them explicitly to the desired value, or restored to their default by removing |
504 |:unlet|. | 533 the variable using |:unlet|. |
505 | 534 |
506 Remarks: | 535 Remarks: |
507 - This only works in a version with GUI support. If the GUI is not actually | |
508 running (possible for X11) it still works, but not very well (the colors | |
509 may be wrong). | |
510 - Some truly ancient browsers may not show the background colors. | 536 - Some truly ancient browsers may not show the background colors. |
511 - From most browsers you can also print the file (in color)! | 537 - From most browsers you can also print the file (in color)! |
538 - This version of TOhtml may work with older versions of Vim, but some | |
539 features such as conceal support will not function, and the colors may be | |
540 incorrect for an old Vim without GUI support compiled in. | |
512 | 541 |
513 Here is an example how to run the script over all .c and .h files from a | 542 Here is an example how to run the script over all .c and .h files from a |
514 Unix shell: > | 543 Unix shell: > |
515 for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done | 544 for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done |
516 < | 545 < |