Skip to content

Commit 491433d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents e0f0d5c + dfded98 commit 491433d

Some content is hidden

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

97 files changed

+10428
-1521
lines changed

READMEdir/README_os390.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Getting the source to z/OS:
1111

1212
First get the source code in one big tar file and ftp it a binary to z/OS. If
1313
the tar file is initially compressed with gzip (tar.gz) or bzip2 (tar.bz2)
14-
uncompress it on your PC, as this tools are (most likely) not available on the
15-
mainframe.
14+
uncompress it on your PC, as these tools are (most likely) not available on
15+
the mainframe.
1616

1717
To reduce the size of the tar file you might compress it into a zip file. On
1818
z/OS Unix you might have the command "jar" from java to uncompress a zip. Use:
@@ -82,8 +82,8 @@ WARNING: This instruction was not tested with Vim 7.4 or later.
8282

8383
There are two ways for building VIM with X11 support. The first way is simple
8484
and results in a big executable (~13 Mb), the second needs a few additional
85-
steps and results in a much smaller executable (~4.5 Mb). This examples assume
86-
you want Motif.
85+
steps and results in a much smaller executable (~4.5 Mb). These examples
86+
assume you want Motif.
8787

8888
The easy way:
8989
$ export CC=cc

runtime/autoload/xmlformat.vim

Lines changed: 94 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim plugin for formatting XML
2-
" Last Change: Thu, 07 Dec 2018
3-
" Version: 0.1
2+
" Last Change: 2019 Oct 24
3+
" Version: 0.2
44
" Author: Christian Brabandt <[email protected]>
55
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
66
" License: VIM License
@@ -22,44 +22,73 @@ func! xmlformat#Format()
2222
" do not fall back to internal formatting
2323
return 0
2424
endif
25+
let count_orig = v:count
2526
let sw = shiftwidth()
2627
let prev = prevnonblank(v:lnum-1)
2728
let s:indent = indent(prev)/sw
2829
let result = []
2930
let lastitem = prev ? getline(prev) : ''
3031
let is_xml_decl = 0
31-
" split on `<`, but don't split on very first opening <
32-
for item in split(join(getline(v:lnum, (v:lnum + v:count - 1))), '.\@<=[>]\zs')
33-
if s:EndTag(item)
34-
let s:indent = s:DecreaseIndent()
35-
call add(result, s:Indent(item))
36-
elseif s:EmptyTag(lastitem)
37-
call add(result, s:Indent(item))
38-
elseif s:StartTag(lastitem) && s:IsTag(item)
39-
let s:indent += 1
40-
call add(result, s:Indent(item))
41-
else
42-
if !s:IsTag(item)
43-
" Simply split on '<'
44-
let t=split(item, '.<\@=\zs')
45-
let s:indent+=1
46-
call add(result, s:Indent(t[0]))
47-
let s:indent = s:DecreaseIndent()
48-
call add(result, s:Indent(t[1]))
49-
else
32+
" go through every line, but don't join all content together and join it
33+
" back. We might lose empty lines
34+
let list = getline(v:lnum, (v:lnum + count_orig - 1))
35+
let current = 0
36+
for line in list
37+
" Keep empty input lines?
38+
if empty(line)
39+
call add(result, '')
40+
continue
41+
elseif line !~# '<[/]\?[^>]*>'
42+
let nextmatch = match(list, '<[/]\?[^>]*>', current)
43+
let line .= join(list[(current + 1):(nextmatch-1)], "\n")
44+
call remove(list, current+1, nextmatch-1)
45+
endif
46+
" split on `>`, but don't split on very first opening <
47+
" this means, items can be like ['<tag>', 'tag content</tag>']
48+
for item in split(line, '.\@<=[>]\zs')
49+
if s:EndTag(item)
50+
let s:indent = s:DecreaseIndent()
51+
call add(result, s:Indent(item))
52+
elseif s:EmptyTag(lastitem)
53+
call add(result, s:Indent(item))
54+
elseif s:StartTag(lastitem) && s:IsTag(item)
55+
let s:indent += 1
5056
call add(result, s:Indent(item))
57+
else
58+
if !s:IsTag(item)
59+
" Simply split on '<', if there is one,
60+
" but reformat according to &textwidth
61+
let t=split(item, '.<\@=\zs')
62+
" t should only contain 2 items, but just be safe here
63+
if s:IsTag(lastitem)
64+
let s:indent+=1
65+
endif
66+
let result+=s:FormatContent([t[0]])
67+
if s:EndTag(t[1])
68+
let s:indent = s:DecreaseIndent()
69+
endif
70+
"for y in t[1:]
71+
let result+=s:FormatContent(t[1:])
72+
"endfor
73+
else
74+
call add(result, s:Indent(item))
75+
endif
5176
endif
52-
endif
53-
let lastitem = item
54-
endfor
77+
let lastitem = item
78+
endfor
79+
let current += 1
80+
endfor
5581

56-
if !empty(result)
57-
exe v:lnum. ",". (v:lnum + v:count - 1). 'd'
82+
if !empty(result)
83+
let lastprevline = getline(v:lnum + count_orig)
84+
let delete_lastline = v:lnum + count_orig - 1 == line('$')
85+
exe v:lnum. ",". (v:lnum + count_orig - 1). 'd'
5886
call append(v:lnum - 1, result)
5987
" Might need to remove the last line, if it became empty because of the
6088
" append() call
6189
let last = v:lnum + len(result)
62-
if getline(last) is ''
90+
" do not use empty(), it returns true for `empty(0)`
91+
if getline(last) is '' && lastprevline is '' && delete_lastline
6392
exe last. 'd'
6493
endif
6594
endif
@@ -88,6 +117,7 @@ func! s:StartTag(tag)
88117
let is_comment = s:IsComment(a:tag)
89118
return a:tag =~? '^\s*<[^/?]' && !is_comment
90119
endfunc
120+
" Check if tag is a Comment start {{{1
91121
func! s:IsComment(tag)
92122
return a:tag =~? '<!--'
93123
endfunc
@@ -108,6 +138,43 @@ endfunc
108138
func! s:EmptyTag(tag)
109139
return a:tag =~ '/>\s*$'
110140
endfunc
141+
" Format input line according to textwidth {{{1
142+
func! s:FormatContent(list)
143+
let result=[]
144+
let limit = 80
145+
if &textwidth > 0
146+
let limit = &textwidth
147+
endif
148+
let column=0
149+
let idx = -1
150+
let add_indent = 0
151+
let cnt = 0
152+
for item in a:list
153+
for word in split(item, '\s\+\S\+\zs')
154+
let column += strdisplaywidth(word, column)
155+
if match(word, "^\\s*\n\\+\\s*$") > -1
156+
call add(result, '')
157+
let idx += 1
158+
let column = 0
159+
let add_indent = 1
160+
elseif column > limit || cnt == 0
161+
let add = s:Indent(s:Trim(word))
162+
call add(result, add)
163+
let column = strdisplaywidth(add)
164+
let idx += 1
165+
else
166+
if add_indent
167+
let result[idx] = s:Indent(s:Trim(word))
168+
else
169+
let result[idx] .= ' '. s:Trim(word)
170+
endif
171+
let add_indent = 0
172+
endif
173+
let cnt += 1
174+
endfor
175+
endfor
176+
return result
177+
endfunc
111178
" Restoration And Modelines: {{{1
112179
let &cpo= s:keepcpo
113180
unlet s:keepcpo

runtime/doc/autocmd.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ Name triggered by ~
268268
|BufCreate| just after adding a buffer to the buffer list
269269
|BufDelete| before deleting a buffer from the buffer list
270270
|BufWipeout| before completely deleting a buffer
271-
|TerminalOpen| after a terminal buffer was created
272271

273272
|BufFilePre| before changing the name of the current buffer
274273
|BufFilePost| after changing the name of the current buffer
@@ -304,6 +303,10 @@ Name triggered by ~
304303
|VimLeavePre| before exiting Vim, before writing the viminfo file
305304
|VimLeave| before exiting Vim, after writing the viminfo file
306305

306+
Terminal
307+
|TerminalOpen| after a terminal buffer was created
308+
|TerminalWinOpen| after a terminal buffer was created in a new window
309+
307310
Various
308311
|FileChangedShell| Vim notices that a file changed since editing started
309312
|FileChangedShellPost| After handling a file changed since editing started
@@ -1088,6 +1091,12 @@ TerminalOpen Just after a terminal buffer was created, with
10881091
`:terminal` or |term_start()|. This event is
10891092
triggered even if the buffer is created
10901093
without a window, with the ++hidden option.
1094+
*TerminalWinOpen*
1095+
TerminalWinOpen Just after a terminal buffer was created, with
1096+
`:terminal` or |term_start()|. This event is
1097+
triggered only if the buffer is created
1098+
with a window. Can be used to set window
1099+
local options for the terminal window.
10911100
*TermResponse*
10921101
TermResponse After the response to |t_RV| is received from
10931102
the terminal. The value of |v:termresponse|

runtime/doc/change.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,13 @@ inside of strings can change! Also see 'softtabstop' option. >
999999
delete and yank) ({.%#:} only work with put).
10001000

10011001
*:reg* *:registers*
1002-
:reg[isters] Display the contents of all numbered and named
1003-
registers. If a register is written to for |:redir|
1004-
it will not be listed.
1002+
:reg[isters] Display the type and contents of all numbered and
1003+
named registers. If a register is written to for
1004+
|:redir| it will not be listed.
1005+
Type can be one of:
1006+
"c" for |characterwise| text
1007+
"l" for |linewise| text
1008+
"b" for |blockwise-visual| text
10051009

10061010

10071011
:reg[isters] {arg} Display the contents of the numbered and named

runtime/doc/eval.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.1. Last change: 2019 Oct 13
1+
*eval.txt* For Vim version 8.1. Last change: 2019 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4254,8 +4254,8 @@ expandcmd({expr}) *expandcmd()*
42544254
Expand special items in {expr} like what is done for an Ex
42554255
command such as `:edit`. This expands special keywords, like
42564256
with |expand()|, and environment variables, anywhere in
4257-
{expr}. Returns the expanded string.
4258-
Example: >
4257+
{expr}. "~user" and "~/path" are only expanded at the start.
4258+
Returns the expanded string. Example: >
42594259
:echo expandcmd('make %<.o')
42604260
42614261
< Can also be used as a |method|: >
@@ -6504,8 +6504,8 @@ listener_add({callback} [, {buf}]) *listener_add()*
65046504
a:bufnr the buffer that was changed
65056505
a:start first changed line number
65066506
a:end first line number below the change
6507-
a:added total number of lines added, negative if lines
6508-
were deleted
6507+
a:added number of lines added, negative if lines were
6508+
deleted
65096509
a:changes a List of items with details about the changes
65106510

65116511
Example: >
@@ -7518,7 +7518,7 @@ pum_getpos() *pum_getpos()*
75187518
row top screen row (0 first row)
75197519
col leftmost screen column (0 first col)
75207520
size total nr of items
7521-
scrollbar |TRUE| if visible
7521+
scrollbar |TRUE| if scrollbar is visible
75227522

75237523
The values are the same as in |v:event| during
75247524
|CompleteChanged|.

runtime/doc/helphelp.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*helphelp.txt* For Vim version 8.1. Last change: 2019 May 04
1+
*helphelp.txt* For Vim version 8.1. Last change: 2019 Oct 18
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -102,7 +102,11 @@ Help on help files *helphelp*
102102
current file. See |help-translated|.
103103

104104
*:helpc* *:helpclose*
105-
:helpc[lose] Close one help window, if there is one.
105+
:helpc[lose] Close one help window, if there is one.
106+
Vim will try to restore the window layout (including
107+
cursor position) to the same layout it was before
108+
opening the help window initially. This might cause
109+
triggering several autocommands.
106110

107111
*:helpg* *:helpgrep*
108112
:helpg[rep] {pattern}[@xx]

runtime/doc/map.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*map.txt* For Vim version 8.1. Last change: 2019 Jun 02
1+
*map.txt* For Vim version 8.1. Last change: 2019 Oct 20
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar

runtime/doc/message.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*message.txt* For Vim version 8.1. Last change: 2019 Aug 23
1+
*message.txt* For Vim version 8.1. Last change: 2019 Oct 19
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar

runtime/doc/options.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 8.1. Last change: 2019 Oct 20
1+
*options.txt* For Vim version 8.1. Last change: 2019 Oct 26
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -6646,10 +6646,10 @@ A jump table for the options with a short description can be found at |Q_op|.
66466646
For Unix the default it "| tee". The stdout of the compiler is saved
66476647
in a file and echoed to the screen. If the 'shell' option is "csh" or
66486648
"tcsh" after initializations, the default becomes "|& tee". If the
6649-
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh" or "bash" the
6650-
default becomes "2>&1| tee". This means that stderr is also included.
6651-
Before using the 'shell' option a path is removed, thus "/bin/sh" uses
6652-
"sh".
6649+
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
6650+
"bash" or "fish" the default becomes "2>&1| tee". This means that
6651+
stderr is also included. Before using the 'shell' option a path is
6652+
removed, thus "/bin/sh" uses "sh".
66536653
The initialization of this option is done after reading the ".vimrc"
66546654
and the other initializations, so that when the 'shell' option is set
66556655
there, the 'shellpipe' option changes automatically, unless it was
@@ -6689,13 +6689,14 @@ A jump table for the options with a short description can be found at |Q_op|.
66896689
The name of the temporary file can be represented by "%s" if necessary
66906690
(the file name is appended automatically if no %s appears in the value
66916691
of this option).
6692-
The default is ">". For Unix, if the 'shell' option is "csh", "tcsh"
6693-
or "zsh" during initializations, the default becomes ">&". If the
6694-
'shell' option is "sh", "ksh" or "bash" the default becomes
6695-
">%s 2>&1". This means that stderr is also included.
6696-
For Win32, the Unix checks are done and additionally "cmd" is checked
6697-
for, which makes the default ">%s 2>&1". Also, the same names with
6698-
".exe" appended are checked for.
6692+
The default is ">". For Unix, if the 'shell' option is "csh" or
6693+
"tcsh" during initializations, the default becomes ">&". If the
6694+
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh",
6695+
"zsh-beta","bash" or "fish", the default becomes ">%s 2>&1". This
6696+
means that stderr is also included. For Win32, the Unix checks are
6697+
done and additionally "cmd" is checked for, which makes the default
6698+
">%s 2>&1". Also, the same names with ".exe" appended are checked
6699+
for.
66996700
The initialization of this option is done after reading the ".vimrc"
67006701
and the other initializations, so that when the 'shell' option is set
67016702
there, the 'shellredir' option changes automatically unless it was

runtime/doc/popup.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*popup.txt* For Vim version 8.1. Last change: 2019 Sep 25
1+
*popup.txt* For Vim version 8.1. Last change: 2019 Oct 20
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -305,16 +305,16 @@ popup_findinfo() *popup_findinfo()*
305305
Get the |window-ID| for the popup info window, as it used by
306306
the popup menu. See |complete-popup|. The info popup is
307307
hidden when not used, it can be deleted with |popup_clear()|
308-
and |popup_close()|.
309-
Return zero if there is none.
308+
and |popup_close()|. Use |popup_show()| to reposition it to
309+
the item in the popup menu.
310+
Returns zero if there is none.
310311

311312

312313
popup_findpreview() *popup_findpreview()*
313314
Get the |window-ID| for the popup preview window.
314315
Return zero if there is none.
315316

316317

317-
318318
popup_getoptions({id}) *popup_getoptions()*
319319
Return the {options} for popup {id} in a Dict.
320320
A zero value means the option was not set. For "zindex" the

runtime/doc/quickfix.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*quickfix.txt* For Vim version 8.1. Last change: 2019 Aug 06
1+
*quickfix.txt* For Vim version 8.1. Last change: 2019 Oct 22
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -486,7 +486,7 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
486486
etc.
487487
< When the current file can't be |abandon|ed and the [!]
488488
is not present, the command fails.
489-
When an error is detected execution stops.
489+
When going to the next entry fails execution stops.
490490
The last buffer (or where an error occurred) becomes
491491
the current buffer.
492492
{cmd} can contain '|' to concatenate several commands.

0 commit comments

Comments
 (0)