run docgen.sh

This commit is contained in:
Timothée Sterle 2021-02-15 00:04:21 +01:00
parent 16423fe3a9
commit f157976b3f
No known key found for this signature in database
GPG Key ID: 136D558122196ED5
2 changed files with 8 additions and 34 deletions

View File

@ -45,7 +45,6 @@
* [Using meta-accessors](#using-meta-accessors-1)
* [Caveats](#caveats-4)
* [Calling Vimscript functions](#calling-vimscript-functions)
* [vim.call()](#vimcall)
* [vim.fn.{function}()](#vimfnfunction)
* [Tips](#tips-4)
* [Caveats](#caveats-5)
@ -774,7 +773,7 @@ vim.fn.jobstart('ls', { on_stdout = print_stdout })
```
Strings with invalid Lua names can be used with `vim.fn[variable]`.
For example, hashes (`#`) are no valid characters for indentifiers in Lua, so autoload functions have to be called with this syntax:
For example, hashes (`#`) are not valid characters for indentifiers in Lua, so autoload functions have to be called with this syntax:
```lua
vim.fn['my#autoload#function']()

View File

@ -39,7 +39,7 @@ is easy to learn, especially if you have experience with similar scripting
languages like JavaScript. You may already know more Lua than you realise!
Note: the version of Lua that Neovim embeds is LuaJIT 2.1.0, which
maintains compatibility with Lua 5.1 (with a few 5.2 extensions)
maintains compatibility with Lua 5.1 (with a few 5.2 extensions).
Existing tutorials for writing Lua in Neovim~
@ -844,37 +844,11 @@ This is a known issue:
CALLING VIMSCRIPT FUNCTIONS
*luaguide-calling-vimscript-functions*
vim.call()~
`vim.call()` calls a Vimscript function. This can either be a built-in
Vim function or a user function. Again, data types are converted back
and forth from Lua to Vimscript.
It takes in the name of the function followed by the arguments you want
to pass to that function:
>
print(vim.call('printf', 'Hello from %s', 'Lua'))
local reversed_list = vim.call('reverse', { 'a', 'b', 'c' })
print(vim.inspect(reversed_list)) -- { "c", "b", "a" }
local function print_stdout(chan_id, data, name)
print(data[1])
end
vim.call('jobstart', 'ls', { on_stdout = print_stdout })
vim.call('my#autoload#function')
<
See also:
- |vim.call()|
vim.fn.{function}()~
`vim.fn` does the exact same thing as `vim.call()`, but looks more like
a native Lua function call:
`vim.fn` is for calling a Vimscript function.
The Vimscript function can either be a built-in Vim function or a user
function. Data types are converted back and forth from Lua to Vimscript.
>
print(vim.fn.printf('Hello from %s', 'Lua'))
@ -889,8 +863,9 @@ a native Lua function call:
vim.fn.jobstart('ls', { on_stdout = print_stdout })
<
Hashes `#` aren't valid characters for indentifiers in Lua, so autoload
functions have to be called with this syntax:
Strings with invalid Lua names can be used with `vim.fn[variable]`.
For example, hashes (`#`) are not valid characters for indentifiers in
Lua, so autoload functions have to be called with this syntax:
>
vim.fn['my#autoload#function']()