1- *syntax.txt* For Vim version 7.3. Last change: 2013 Jun 24
1+ *syntax.txt* For Vim version 7.3. Last change: 2013 Jun 26
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -379,12 +379,12 @@ settings, depending on which syntax is active. Example: >
379379 2HTML *2html.vim* *convert-to-HTML*
380380
381381This is not a syntax file itself, but a script that converts the current
382- window into HTML. Vim opens a new window in which it builds the HTML file.
382+ window into HTML. Vim opens a new window in which it builds the HTML file.
383383
384- After you save the resulting file, you can view it with any browser. The
385- colors should be exactly the same as you see them in Vim. You can jump to
386- specific lines by adding (for example) #L123 or #123 to the end of the URL in
387- your browser's address bar (#123 only with javascript support) . And with
384+ After you save the resulting file, you can view it with any browser. The
385+ colors should be exactly the same as you see them in Vim. With
386+ | g:html_line_ids | you can jump to specific lines by adding (for example) #L123
387+ or #123 to the end of the URL in your browser's address bar. And with
388388| g:html_dynamic_folds | enabled, you can show or hide the text that is folded
389389in Vim.
390390
@@ -425,15 +425,14 @@ and last line to be converted. Example, using the last set Visual area: >
425425 | g:html_end_line | to the start and end of the range,
426426 respectively. Default range is the entire buffer.
427427
428- If the current window is part of a | diff | , unless
429- | g:html_diff_one_file | is set, :TOhtml will convert
430- all windows which are part of the diff in the current
431- tab and place them side-by-side in a <table> element
432- in the generated HTML. When this happens you can jump
433- to lines in specific windows with (for example) #W1L42
434- for line 42 in the first diffed window, or #W3L87 for
435- line 87 in the third. Omitting the window ID will
436- default to the first window if javascript is enabled.
428+ If the current window is part of a | diff | , unless
429+ | g:html_diff_one_file | is set, :TOhtml will convert
430+ all windows which are part of the diff in the current
431+ tab and place them side-by-side in a <table> element
432+ in the generated HTML. With | g:html_line_ids | you can
433+ jump to lines in specific windows with (for example)
434+ #W1L42 for line 42 in the first diffed window, or
435+ #W3L87 for line 87 in the third.
437436
438437 Examples: >
439438
@@ -443,9 +442,9 @@ and last line to be converted. Example, using the last set Visual area: >
443442<
444443 *g:html_diff_one_file*
445444Default: 0.
446- When 0, all windows involved in a | diff | in the current tab page are converted
447- to HTML and placed side-by-side in a <table> element.
448- When 1, only the current buffer is converted.
445+ When 0, and using | :TOhtml | all windows involved in a | diff | in the current tab
446+ page are converted to HTML and placed side-by-side in a <table> element. When
447+ 1, only the current buffer is converted.
449448Example: >
450449
451450 let g:html_diff_one_file = 1
@@ -494,6 +493,23 @@ Force to omit the line numbers: >
494493 :let g:html_number_lines = 0
495494 Go back to the default to use 'number' by deleting the variable: >
496495 :unlet g:html_number_lines
496+ <
497+ *g:html_line_ids*
498+ Default: 1 if | g:html_number_lines | is set, 0 otherwise.
499+ When 1, adds an HTML id attribute to each line number, or to an empty <span>
500+ inserted for that purpose if no line numbers are shown. This ID attribute
501+ takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view
502+ pages, and is used to jump to a specific line (in a specific window of a diff
503+ view). Javascript is inserted to open any closed dynamic folds
504+ (| g:html_dynamic_folds | ) containing the specificed line before jumping. The
505+ javascript also allows omitting the window ID in the url, and the leading L.
506+ For example: >
507+
508+ page.html#L123 jumps to line 123 in a single-buffer file
509+ page.html#123 does the same
510+
511+ diff.html#W1L42 jumps to line 42 in the first window in a diff
512+ diff.html#42 does the same
497513<
498514 *g:html_use_css*
499515Default: 1.
@@ -603,6 +619,25 @@ they will not be openable without a foldcolumn.
603619>
604620 :let g:html_hover_unfold = 1
605621<
622+ *g:html_id_expr*
623+ Default: ""
624+ Dynamic folding and jumping to line IDs rely on unique IDs within the document
625+ to work. If generated HTML is copied into a larger document, these IDs are no
626+ longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can
627+ evaluate to get a unique string to append to each ID used in a given document,
628+ so that the full IDs will be unique even when combined with other content in a
629+ larger HTML document. Example, to append _ and the buffer number to each ID: >
630+
631+ :let g:html_id_expr = '"_".bufnr("%")'
632+ <
633+ To append a string "_mystring" to the end of each ID: >
634+
635+ :let g:html_id_expr = '"_mystring"'
636+ <
637+ Note, when converting a diff view to HTML, the expression will only be
638+ evaluated for the first window in the diff, and the result used for all the
639+ windows.
640+
606641 *TOhtml-wrap-text* *g:html_pre_wrap*
607642Default: current 'wrap' setting.
608643When 0, if | g:html_no_pre | is 0 or unset, the text in the generated HTML does
0 commit comments