Skip to content

Commit dabe5a2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents bbbdc47 + 10efcd5 commit dabe5a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2314
-950
lines changed

runtime/autoload/tohtml.vim

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim autoload file for the tohtml plugin.
22
" Maintainer: Ben Fritz <fritzophrenic@gmail.com>
3-
" Last Change: 2013 Sep 03
3+
" Last Change: 2018 Nov 11
44
"
55
" Additional contributors:
66
"
@@ -544,12 +544,16 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
544544
" add required javascript in reverse order so we can just call append again
545545
" and again without adjusting {{{
546546

547-
" insert script closing tag
548-
call append(style_start, [
549-
\ '',
550-
\ s:settings.use_xhtml ? '//]]>' : '-->',
551-
\ "</script>"
552-
\ ])
547+
let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy)
548+
549+
" insert script closing tag if needed
550+
if s:uses_script
551+
call append(style_start, [
552+
\ '',
553+
\ s:settings.use_xhtml ? '//]]>' : '-->',
554+
\ "</script>"
555+
\ ])
556+
endif
553557

554558
" insert script which corrects the size of small input elements in
555559
" prevent_copy mode. See 2html.vim for details on why this is needed and how
@@ -575,55 +579,61 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
575579
\ '}'
576580
\ ])
577581
endif
578-
"
582+
579583
" insert javascript to get IDs from line numbers, and to open a fold before
580584
" jumping to any lines contained therein
581-
call append(style_start, [
582-
\ " /* Always jump to new location even if the line was hidden inside a fold, or",
583-
\ " * we corrected the raw number to a line ID.",
584-
\ " */",
585-
\ " if (lineElem) {",
586-
\ " lineElem.scrollIntoView(true);",
587-
\ " }",
588-
\ " return true;",
589-
\ "}",
590-
\ "if ('onhashchange' in window) {",
591-
\ " window.onhashchange = JumpToLine;",
592-
\ "}"
593-
\ ])
594-
if s:settings.dynamic_folds
585+
if s:settings.line_ids
586+
call append(style_start, [
587+
\ " /* Always jump to new location even if the line was hidden inside a fold, or",
588+
\ " * we corrected the raw number to a line ID.",
589+
\ " */",
590+
\ " if (lineElem) {",
591+
\ " lineElem.scrollIntoView(true);",
592+
\ " }",
593+
\ " return true;",
594+
\ "}",
595+
\ "if ('onhashchange' in window) {",
596+
\ " window.onhashchange = JumpToLine;",
597+
\ "}"
598+
\ ])
599+
600+
if s:settings.dynamic_folds
601+
call append(style_start, [
602+
\ "",
603+
\ " /* navigate upwards in the DOM tree to open all folds containing the line */",
604+
\ " var node = lineElem;",
605+
\ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')",
606+
\ " {",
607+
\ " if (node.className == 'closed-fold')",
608+
\ " {",
609+
\ " /* toggle open the fold ID (remove window ID) */",
610+
\ " toggleFold(node.id.substr(4));",
611+
\ " }",
612+
\ " node = node.parentNode;",
613+
\ " }",
614+
\ ])
615+
endif
616+
endif
617+
618+
if s:settings.line_ids
595619
call append(style_start, [
596620
\ "",
597-
\ " /* navigate upwards in the DOM tree to open all folds containing the line */",
598-
\ " var node = lineElem;",
599-
\ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')",
600-
\ " {",
601-
\ " if (node.className == 'closed-fold')",
602-
\ " {",
603-
\ " /* toggle open the fold ID (remove window ID) */",
604-
\ " toggleFold(node.id.substr(4));",
605-
\ " }",
606-
\ " node = node.parentNode;",
621+
\ "/* function to open any folds containing a jumped-to line before jumping to it */",
622+
\ "function JumpToLine()",
623+
\ "{",
624+
\ " var lineNum;",
625+
\ " lineNum = window.location.hash;",
626+
\ " lineNum = lineNum.substr(1); /* strip off '#' */",
627+
\ "",
628+
\ " if (lineNum.indexOf('L') == -1) {",
629+
\ " lineNum = 'L'+lineNum;",
630+
\ " }",
631+
\ " if (lineNum.indexOf('W') == -1) {",
632+
\ " lineNum = 'W1'+lineNum;",
607633
\ " }",
634+
\ " var lineElem = document.getElementById(lineNum);"
608635
\ ])
609636
endif
610-
call append(style_start, [
611-
\ "",
612-
\ "/* function to open any folds containing a jumped-to line before jumping to it */",
613-
\ "function JumpToLine()",
614-
\ "{",
615-
\ " var lineNum;",
616-
\ " lineNum = window.location.hash;",
617-
\ " lineNum = lineNum.substr(1); /* strip off '#' */",
618-
\ "",
619-
\ " if (lineNum.indexOf('L') == -1) {",
620-
\ " lineNum = 'L'+lineNum;",
621-
\ " }",
622-
\ " if (lineNum.indexOf('W') == -1) {",
623-
\ " lineNum = 'W1'+lineNum;",
624-
\ " }",
625-
\ " lineElem = document.getElementById(lineNum);"
626-
\ ])
627637

628638
" Insert javascript to toggle matching folds open and closed in all windows,
629639
" if dynamic folding is active.
@@ -648,11 +658,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
648658
\ ])
649659
endif
650660

651-
" insert script tag; javascript is always needed for the line number
652-
" normalization for URL hashes
653-
call append(style_start, [
654-
\ "<script type='text/javascript'>",
655-
\ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
661+
if s:uses_script
662+
" insert script tag; javascript is always needed for the line number
663+
" normalization for URL hashes
664+
call append(style_start, [
665+
\ "<script type='text/javascript'>",
666+
\ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
667+
endif
656668

657669
" Insert styles from all the generated html documents and additional styles
658670
" for the table-based layout of the side-by-side diff. The diff should take
@@ -767,7 +779,7 @@ func! tohtml#GetUserSettings() "{{{
767779
if user_settings.no_pre == 0
768780
call tohtml#GetOption(user_settings,
769781
\ 'expand_tabs',
770-
\ &expandtab || &ts != 8 || user_settings.number_lines ||
782+
\ &expandtab || &ts != 8 || &vts != '' || user_settings.number_lines ||
771783
\ (user_settings.dynamic_folds && !user_settings.no_foldcolumn))
772784
else
773785
let user_settings.expand_tabs = 1

runtime/doc/change.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right*
476476
*<*
477477
<{motion} Shift {motion} lines one 'shiftwidth' leftwards.
478478

479+
If the 'vartabstop' feature is enabled, and the
480+
'shiftwidth' option is set to zero, the amount of
481+
indent is calculated at the first non-blank character
482+
in the line.
479483
*<<*
480484
<< Shift [count] lines one 'shiftwidth' leftwards.
481485

@@ -487,6 +491,10 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right*
487491
*>*
488492
>{motion} Shift {motion} lines one 'shiftwidth' rightwards.
489493

494+
If the 'vartabstop' feature is enabled, and the
495+
'shiftwidth' option is set to zero, the amount of
496+
indent is calculated at the first non-blank character
497+
in the line.
490498
*>>*
491499
>> Shift [count] lines one 'shiftwidth' rightwards.
492500

runtime/doc/eval.txt

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ append({lnum}, {text}) Number append {text} below line {lnum}
20262026
appendbufline({expr}, {lnum}, {text})
20272027
Number append {text} below line {lnum}
20282028
in buffer {expr}
2029-
argc( [{winid}]) Number number of files in the argument list
2029+
argc([{winid}]) Number number of files in the argument list
20302030
argidx() Number current index in the argument list
20312031
arglistid([{winnr} [, {tabnr}]]) Number argument list id
20322032
argv({nr} [, {winid}]) String {nr} entry of the argument list
@@ -2206,6 +2206,7 @@ gettabvar({nr}, {varname} [, {def}])
22062206
any variable {varname} in tab {nr} or {def}
22072207
gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
22082208
any {name} in {winnr} in tab page {tabnr}
2209+
gettagstack([{nr}]) Dict get the tag stack of window {nr}
22092210
getwininfo([{winid}]) List list of info about each window
22102211
getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
22112212
getwinposx() Number X coord in pixels of the Vim window
@@ -2307,7 +2308,6 @@ perleval({expr}) any evaluate |Perl| expression
23072308
pow({x}, {y}) Float {x} to the power of {y}
23082309
prevnonblank({lnum}) Number line nr of non-blank line <= {lnum}
23092310
printf({fmt}, {expr1}...) String format text
2310-
prompt_addtext({buf}, {expr}) none add text to a prompt buffer
23112311
prompt_setcallback({buf}, {expr}) none set prompt callback function
23122312
prompt_setinterrupt({buf}, {text}) none set prompt interrupt function
23132313
prompt_setprompt({buf}, {text}) none set prompt text
@@ -2378,12 +2378,14 @@ settabvar({nr}, {varname}, {val}) none set {varname} in tab page {nr} to {val}
23782378
settabwinvar({tabnr}, {winnr}, {varname}, {val})
23792379
none set {varname} in window {winnr} in tab
23802380
page {tabnr} to {val}
2381+
settagstack({nr}, {dict} [, {action}])
2382+
Number modify tag stack using {dict}
23812383
setwinvar({nr}, {varname}, {val}) none set {varname} in window {nr} to {val}
23822384
sha256({string}) String SHA256 checksum of {string}
23832385
shellescape({string} [, {special}])
23842386
String escape {string} for use as shell
23852387
command argument
2386-
shiftwidth() Number effective value of 'shiftwidth'
2388+
shiftwidth([{col}]) Number effective value of 'shiftwidth'
23872389
simplify({filename}) String simplify filename as much as possible
23882390
sin({expr}) Float sine of {expr}
23892391
sinh({expr}) Float hyperbolic sine of {expr}
@@ -4971,6 +4973,34 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
49714973
To obtain all window-local variables use: >
49724974
gettabwinvar({tabnr}, {winnr}, '&')
49734975
4976+
gettagstack([{nr}]) *gettagstack()*
4977+
The result is a Dict, which is the tag stack of window {nr}.
4978+
{nr} can be the window number or the |window-ID|.
4979+
When {nr} is not specified, the current window is used.
4980+
When window {nr} doesn't exist, an empty Dict is returned.
4981+
4982+
The returned dictionary contains the following entries:
4983+
curidx Current index in the stack. When at
4984+
top of the stack, set to (length + 1).
4985+
Index of bottom of the stack is 1.
4986+
items List of items in the stack. Each item
4987+
is a dictionary containing the
4988+
entries described below.
4989+
length Number of entries in the stack.
4990+
4991+
Each item in the stack is a dictionary with the following
4992+
entries:
4993+
bufnr buffer number of the current jump
4994+
from cursor position before the tag jump.
4995+
See |getpos()| for the format of the
4996+
returned list.
4997+
matchnr current matching tag number. Used when
4998+
multiple matching tags are found for a
4999+
name.
5000+
tagname name of the tag
5001+
5002+
See |tagstack| for more information about the tag stack.
5003+
49745004
getwininfo([{winid}]) *getwininfo()*
49755005
Returns information about windows as a List with Dictionaries.
49765006

@@ -7535,6 +7565,37 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
75357565
:call settabwinvar(3, 2, "myvar", "foobar")
75367566
< This function is not available in the |sandbox|.
75377567

7568+
settagstack({nr}, {dict} [, {action}]) *settagstack()*
7569+
Modify the tag stack of the window {nr} using {dict}.
7570+
{nr} can be the window number or the |window-ID|.
7571+
7572+
For a list of supported items in {dict}, refer to
7573+
|gettagstack()|
7574+
*E962*
7575+
If {action} is not present or is set to 'r', then the tag
7576+
stack is replaced. If {action} is set to 'a', then new entries
7577+
from {dict} are pushed onto the tag stack.
7578+
7579+
Returns zero for success, -1 for failure.
7580+
7581+
Examples:
7582+
Set current index of the tag stack to 4: >
7583+
call settagstack(1005, {'curidx' : 4})
7584+
7585+
< Empty the tag stack of window 3: >
7586+
call settagstack(3, {'items' : []})
7587+
7588+
< Push a new item onto the tag stack: >
7589+
let pos = [bufnr('myfile.txt'), 10, 1, 0]
7590+
let newtag = [{'tagname' : 'mytag', 'from' : pos}]
7591+
call settagstack(2, {'items' : newtag}, 'a')
7592+
7593+
< Save and restore the tag stack: >
7594+
let stack = gettagstack(1003)
7595+
" do something else
7596+
call settagstack(1003, stack)
7597+
unlet stack
7598+
<
75387599
setwinvar({nr}, {varname}, {val}) *setwinvar()*
75397600
Like |settabwinvar()| for the current tab page.
75407601
Examples: >
@@ -7577,11 +7638,17 @@ shellescape({string} [, {special}]) *shellescape()*
75777638
< See also |::S|.
75787639

75797640

7580-
shiftwidth() *shiftwidth()*
7641+
shiftwidth([{col}]) *shiftwidth()*
75817642
Returns the effective value of 'shiftwidth'. This is the
75827643
'shiftwidth' value unless it is zero, in which case it is the
75837644
'tabstop' value. This function was introduced with patch
7584-
7.3.694 in 2012, everybody should have it by now.
7645+
7.3.694 in 2012, everybody should have it by now (however it
7646+
did not allow for the optional {col} argument until 8.1.542).
7647+
7648+
When there is one argument {col} this is used as column number
7649+
for which to return the 'shiftwidth' value. This matters for the
7650+
'vartabstop' feature. If the 'vartabstop' setting is enabled and
7651+
no {col} argument is given, column 1 will be assumed.
75857652

75867653

75877654
simplify({filename}) *simplify()*

runtime/doc/gui.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ be used to complete the name of the menu item.
879879
't': |:tlmenu| Terminal mode
880880
'i': |:imenu| Insert mode
881881
'c': |:cmenu| Cmdline mode
882-
882+
883883

884884
If the console-mode vim has been compiled with WANT_MENU defined, you can
885885
use :emenu to access useful menu items you may have got used to from GUI

runtime/doc/if_perl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ The Perl patches for Vim were made by:
4545
Matt Gerassimof
4646

4747
Perl for MS-Windows (and other platforms) can be found at:
48-
http://www.perl.org/ The ActiveState one should work, Strawberry Perl is a
49-
good alternative.
48+
http://www.perl.org/
49+
The ActiveState one should work, Strawberry Perl is a good alternative.
5050

5151
==============================================================================
5252
3. Using the Perl interface *perl-using*

runtime/doc/indent.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,14 @@ the use of square and curly brackets, and otherwise by community convention.
603603
These conventions are not universally followed, so the Clojure indent script
604604
offers a few configurable options, listed below.
605605

606-
If the current vim does not include searchpairpos(), the indent script falls
606+
If the current vim does not include |searchpairpos()|, the indent script falls
607607
back to normal 'lisp' indenting, and the following options are ignored.
608608

609609
*g:clojure_maxlines*
610610

611-
Set maximum scan distance of searchpairpos(). Larger values trade performance
612-
for correctness when dealing with very long forms. A value of 0 will scan
613-
without limits.
611+
Set maximum scan distance of |searchpairpos()|. Larger values trade
612+
performance for correctness when dealing with very long forms. A value of 0
613+
will scan without limits.
614614
>
615615
" Default
616616
let g:clojure_maxlines = 100
@@ -936,14 +936,14 @@ given are the defaults. Note that the variables are set to an expression, so
936936
that you can change the value of 'shiftwidth' later.
937937

938938
Indent after an open paren: >
939-
let g:pyindent_open_paren = '&sw * 2'
939+
let g:pyindent_open_paren = 'shiftwidth() * 2'
940940
Indent after a nested paren: >
941-
let g:pyindent_nested_paren = '&sw'
941+
let g:pyindent_nested_paren = 'shiftwidth()'
942942
Indent for a continuation line: >
943-
let g:pyindent_continue = '&sw * 2'
943+
let g:pyindent_continue = 'shiftwidth() * 2'
944944
945-
The method uses searchpair() to look back for unclosed parenthesis. This can
946-
sometimes be slow, thus it timeouts after 150 msec. If you notice the
945+
The method uses |searchpair()| to look back for unclosed parenthesis. This
946+
can sometimes be slow, thus it timeouts after 150 msec. If you notice the
947947
indenting isn't correct, you can set a larger timeout in msec: >
948948
let g:pyindent_searchpair_timeout = 500
949949
@@ -1039,7 +1039,7 @@ Furthermore, setting the variable b:verilog_indent_width to change the
10391039
indenting width (default is 'shiftwidth'): >
10401040
10411041
let b:verilog_indent_width = 4
1042-
let b:verilog_indent_width = &sw * 2
1042+
let b:verilog_indent_width = shiftwidth() * 2
10431043
10441044
In addition, you can turn the verbose mode for debug issue: >
10451045
@@ -1162,7 +1162,7 @@ VIM *ft-vim-indent*
11621162
For indenting Vim scripts there is one variable that specifies the amount of
11631163
indent for a continuation line, a line that starts with a backslash: >
11641164
1165-
:let g:vim_indent_cont = &sw * 3
1165+
:let g:vim_indent_cont = shiftwidth() * 3
11661166
11671167
Three times shiftwidth is the default value.
11681168

0 commit comments

Comments
 (0)