Skip to content

Commit

Permalink
Merge remote-tracking branch 'vim/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ychin committed Mar 23, 2019
2 parents 1204c03 + 63dbfd3 commit 5393ecb
Show file tree
Hide file tree
Showing 93 changed files with 3,430 additions and 2,658 deletions.
1 change: 0 additions & 1 deletion Filelist
Expand Up @@ -12,7 +12,6 @@ SRC_ALL = \
src/README.txt \
src/alloc.h \
src/arabic.c \
src/arabic.h \
src/ascii.h \
src/autocmd.c \
src/beval.c \
Expand Down
12 changes: 6 additions & 6 deletions runtime/autoload/dist/ft.vim
Expand Up @@ -197,7 +197,7 @@ func dist#ft#FTe()
exe 'setf ' . g:filetype_euphoria
else
let n = 1
while n < 100 && n < line("$")
while n < 100 && n <= line("$")
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
setf specman
return
Expand All @@ -211,7 +211,7 @@ endfunc
" Distinguish between HTML, XHTML and Django
func dist#ft#FThtml()
let n = 1
while n < 10 && n < line("$")
while n < 10 && n <= line("$")
if getline(n) =~ '\<DTD\s\+XHTML\s'
setf xhtml
return
Expand All @@ -222,13 +222,13 @@ func dist#ft#FThtml()
endif
let n = n + 1
endwhile
setf html
setf FALLBACK html
endfunc

" Distinguish between standard IDL and MS-IDL
func dist#ft#FTidl()
let n = 1
while n < 50 && n < line("$")
while n < 50 && n <= line("$")
if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
setf msidl
return
Expand Down Expand Up @@ -699,7 +699,7 @@ endfunc

func dist#ft#FTxml()
let n = 1
while n < 100 && n < line("$")
while n < 100 && n <= line("$")
let line = getline(n)
" DocBook 4 or DocBook 5.
let is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
Expand All @@ -725,7 +725,7 @@ endfunc

func dist#ft#FTy()
let n = 1
while n < 100 && n < line("$")
while n < 100 && n <= line("$")
let line = getline(n)
if line =~ '^\s*%'
setf yacc
Expand Down
13 changes: 10 additions & 3 deletions runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 8.1. Last change: 2019 Jan 19
*autocmd.txt* For Vim version 8.1. Last change: 2019 Mar 13


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -621,6 +621,8 @@ CursorMoved After the cursor was moved in Normal or Visual
Not triggered when there is typeahead or when
an operator is pending.
For an example see |match-parens|.
Note: This can not be skipped with
`:noautocmd`.
Careful: This is triggered very often, don't
do anything that the user does not expect or
that is slow.
Expand Down Expand Up @@ -1024,6 +1026,8 @@ TextChanged After a change was made to the text in the
was defined).
Not triggered when there is typeahead or when
an operator is pending.
Note: This can not be skipped with
`:noautocmd`.
Careful: This is triggered very often, don't
do anything that the user does not expect or
that is slow.
Expand Down Expand Up @@ -1465,8 +1469,8 @@ If you want the buffer to be unmodified after changing it, reset the
instead of ":q!".

*autocmd-nested* *E218*
By default, autocommands do not nest. If you use ":e" or ":w" in an
autocommand, Vim does not execute the BufRead and BufWrite autocommands for
By default, autocommands do not nest. For example, if you use ":e" or ":w" in
an autocommand, Vim does not execute the BufRead and BufWrite autocommands for
those commands. If you do want this, use the "nested" flag for those commands
in which you want nesting. For example: >
:autocmd FileChangedShell *.c nested e!
Expand Down Expand Up @@ -1612,5 +1616,8 @@ following command. Example: >
This will write the file without triggering the autocommands defined by the
gzip plugin.

Note that some autocommands are not triggered right away, but only later.
This specifically applies to |CursorMoved| and |TextChanged|.


vim:tw=78:ts=8:noet:ft=help:norl:
6 changes: 3 additions & 3 deletions runtime/doc/diff.txt
@@ -1,4 +1,4 @@
*diff.txt* For Vim version 8.1. Last change: 2017 Oct 03
*diff.txt* For Vim version 8.1. Last change: 2019 Feb 27


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -179,8 +179,8 @@ loaded. Since Vim doesn't allow having two buffers for the same file, you
need another buffer. This command is useful: >
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_
\ | diffthis | wincmd p | diffthis
(this is in |vimrc_example.vim|). Use ":DiffOrig" to see the differences
between the current buffer and the file it was loaded from.
(this is in |defaults.vim|). Use ":DiffOrig" to see the differences between
the current buffer and the file it was loaded from.

A buffer that is unloaded cannot be used for the diff. But it does work for
hidden buffers. You can use ":hide" to close a window without unloading the
Expand Down
47 changes: 32 additions & 15 deletions runtime/doc/eval.txt
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.1. Last change: 2019 Feb 22
*eval.txt* For Vim version 8.1. Last change: 2019 Mar 02


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -2672,6 +2672,7 @@ test_null_partial() Funcref null value for testing
test_null_string() String null value for testing
test_option_not_set({name}) none reset flag indicating option was set
test_override({expr}, {val}) none test with Vim internal overrides
test_refcount({expr}) Number get the reference count of {expr}
test_scrollbar({which}, {value}, {dragging})
none scroll in the GUI for testing
test_settime({expr}) none set current time for testing
Expand Down Expand Up @@ -3538,7 +3539,7 @@ complete_check() *complete_check()*

*confirm()*
confirm({msg} [, {choices} [, {default} [, {type}]]])
Confirm() offers the user a dialog, from which a choice can be
confirm() offers the user a dialog, from which a choice can be
made. It returns the number of the choice. For the first
choice this is 1.
Note: confirm() is only supported when compiled with dialog
Expand Down Expand Up @@ -4061,7 +4062,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
all "README" files in the current directory and below: >
:echo expand("**/README")
<
Expand() can also be used to expand variables and environment
expand() can also be used to expand variables and environment
variables that are only known in a shell. But this can be
slow, because a shell may be used to do the expansion. See
|expr-env-expand|.
Expand Down Expand Up @@ -4964,10 +4965,16 @@ getloclist({nr} [, {what}]) *getloclist()*
If the optional {what} dictionary argument is supplied, then
returns the items listed in {what} as a dictionary. Refer to
|getqflist()| for the supported items in {what}.
If {what} contains 'filewinid', then returns the id of the
window used to display files from the location list. This
field is applicable only when called from a location list
window. See |location-list-file-window| for more details.

In addition to the items supported by |getqflist()| in {what},
the following item is supported by |getloclist()|:

filewinid id of the window used to display files
from the location list. This field is
applicable only when called from a
location list window. See
|location-list-file-window| for more
details.

getmatches() *getmatches()*
Returns a |List| with all matches previously defined by
Expand Down Expand Up @@ -5069,6 +5076,9 @@ getqflist([{what}]) *getqflist()*
nr get information for this quickfix list; zero
means the current quickfix list and "$" means
the last quickfix list
qfbufnr number of the buffer displayed in the quickfix
window. Returns 0 if the quickfix buffer is
not present. See |quickfix-buffer|.
size number of entries in the quickfix list
title get the list title |quickfix-title|
winid get the quickfix |window-ID|
Expand Down Expand Up @@ -5097,6 +5107,8 @@ getqflist([{what}]) *getqflist()*
items quickfix list entries. If not present, set to
an empty list.
nr quickfix list number. If not present, set to 0
qfbufnr number of the buffer displayed in the quickfix
window. If not present, set to 0.
size number of entries in the quickfix list. If not
present, set to 0.
title quickfix list title text. If not present, set
Expand Down Expand Up @@ -9578,6 +9590,11 @@ test_override({name}, {val}) *test_override()*
< The value of "starting" is saved. It is restored by: >
call test_override('starting', 0)
test_refcount({expr}) *test_refcount()*
Return the reference count of {expr}. When {expr} is of a
type that does not have a reference count, returns -1. Only
to be used for testing.

test_scrollbar({which}, {value}, {dragging}) *test_scrollbar()*
Pretend using scrollbar {which} to move it to position
{value}. {which} can be:
Expand Down Expand Up @@ -11208,14 +11225,14 @@ This does NOT work: >
commands are skipped.
When {pattern} is omitted all errors are caught.
Examples: >
:catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
:catch /^Vim\%((\a\+)\)\=:E/ " catch all Vim errors
:catch /^Vim\%((\a\+)\)\=:/ " catch errors and interrupts
:catch /^Vim(write):/ " catch all errors in :write
:catch /^Vim\%((\a\+)\)\=:E123/ " catch error E123
:catch /my-exception/ " catch user exception
:catch /.*/ " catch everything
:catch " same as /.*/
:catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
:catch /^Vim\%((\a\+)\)\=:E/ " catch all Vim errors
:catch /^Vim\%((\a\+)\)\=:/ " catch errors and interrupts
:catch /^Vim(write):/ " catch all errors in :write
:catch /^Vim\%((\a\+)\)\=:E123:/ " catch error E123
:catch /my-exception/ " catch user exception
:catch /.*/ " catch everything
:catch " same as /.*/
<
Another character can be used instead of / around the
{pattern}, so long as it does not have a special
Expand Down
64 changes: 50 additions & 14 deletions runtime/doc/if_lua.txt
Expand Up @@ -10,11 +10,12 @@ The Lua Interface to Vim *lua* *Lua*
2. The vim module |lua-vim|
3. List userdata |lua-list|
4. Dict userdata |lua-dict|
5. Funcref userdata |lua-funcref|
6. Buffer userdata |lua-buffer|
7. Window userdata |lua-window|
8. The luaeval function |lua-luaeval|
9. Dynamic loading |lua-dynamic|
5. Blob userdata |lua-blob|
6. Funcref userdata |lua-funcref|
7. Buffer userdata |lua-buffer|
8. Window userdata |lua-window|
9. luaeval() Vim function |lua-luaeval|
10. Dynamic loading |lua-dynamic|

{Vi does not have any of these commands}

Expand Down Expand Up @@ -140,6 +141,14 @@ Vim evaluation and command execution, and others.
:echo luaeval('vim.dict(t)')
:" {'1': 3.141593, '2': v:false,
:" 'say': 'hi'}
<
vim.blob([arg]) Returns an empty blob or, if "arg" is a Lua
string, returns a blob b such that b is
equivalent to "arg" as a byte string.
Examples: >
:lua s = "12ab\x00\x80\xfe\xff"
:echo luaeval('vim.blob(s)')
:" 0z31326162.0080FEFF
<
vim.funcref({name}) Returns a Funcref to function {name} (see
|Funcref|). It is equivalent to Vim's
Expand Down Expand Up @@ -260,7 +269,34 @@ Examples:
<

==============================================================================
5. Funcref userdata *lua-funcref*
5. Blob userdata *lua-blob*

Blob userdata represent vim blobs. A blob "b" has the following properties:

Properties
----------
o "#b" is the length of blob "b", equivalent to "len(b)" in Vim.
o "b[k]" returns the k-th item in "b"; "b" is zero-indexed, as in Vim.
To modify the k-th item, simply do "b[k] = number"; in particular,
"b[#b] = number" can append a byte to tail.

Methods
-------
o "b:add(bytes)" appends "bytes" to the end of "b".

Examples:
>
:let b = 0z001122
:lua b = vim.eval('b') -- same 'b'
:lua print(b, b[0], #b)
:lua b[1] = 32
:lua b[#b] = 0x33 -- append a byte to tail
:lua b:add("\x80\x81\xfe\xff")
:echo b
<

==============================================================================
6. Funcref userdata *lua-funcref*

Funcref userdata represent funcref variables in Vim. Funcrefs that were
defined with a "dict" attribute need to be obtained as a dictionary key
Expand Down Expand Up @@ -293,7 +329,7 @@ Examples:
<

==============================================================================
6. Buffer userdata *lua-buffer*
7. Buffer userdata *lua-buffer*

Buffer userdata represent vim buffers. A buffer userdata "b" has the following
properties and methods:
Expand Down Expand Up @@ -345,7 +381,7 @@ Examples:
<

==============================================================================
7. Window userdata *lua-window*
8. Window userdata *lua-window*

Window objects represent vim windows. A window userdata "w" has the following
properties and methods:
Expand Down Expand Up @@ -377,7 +413,7 @@ Examples:
<

==============================================================================
8. The luaeval function *lua-luaeval* *lua-eval*
9. luaeval() Vim function *lua-luaeval* *lua-eval*

The (dual) equivalent of "vim.eval" for passing Lua values to Vim is
"luaeval". "luaeval" takes an expression string and an optional argument and
Expand All @@ -390,10 +426,10 @@ returns the result of the expression. It is semantically equivalent in Lua to:
end
<
Note that "_A" receives the argument to "luaeval". Lua numbers, strings, and
list, dict, and funcref userdata are converted to their Vim respective types,
while Lua booleans are converted to numbers. An error is thrown if conversion
of any of the remaining Lua types, including userdata other than lists, dicts,
and funcrefs, is attempted.
list, dict, blob, and funcref userdata are converted to their Vim respective
types, while Lua booleans are converted to numbers. An error is thrown if
conversion of any of the remaining Lua types, including userdata other than
lists, dicts, blobs, and funcrefs, is attempted.

Examples: >
Expand All @@ -408,7 +444,7 @@ Examples: >
==============================================================================
9. Dynamic loading *lua-dynamic*
10. Dynamic loading *lua-dynamic*

On MS-Windows and Unix the Lua library can be loaded dynamically. The
|:version| output then includes |+lua/dyn|.
Expand Down

0 comments on commit 5393ecb

Please sign in to comment.