aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt31
1 files changed, 27 insertions, 4 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 367b5c36d2..135a1b42de 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -530,6 +530,16 @@ Example: File-change detection *watch-file*
vim.api.nvim_command(
"command! -nargs=1 Watch call luaeval('watch_file(_A)', expand('<args>'))")
<
+ *fswatch-limitations*
+When on Linux and using fswatch, you may need to increase the maximum number
+of `inotify` watches and queued events as the default limit can be too low. To
+increase the limit, run: >sh
+ sysctl fs.inotify.max_user_watches=100000
+ sysctl fs.inotify.max_queued_events=100000
+<
+This will increase the limit to 100000 watches and queued events. These lines
+can be added to `/etc/sysctl.conf` to make the changes persistent.
+
Example: TCP echo-server *tcp-server*
1. Save this code to a file.
2. Execute it with ":luafile %".
@@ -1161,6 +1171,7 @@ Lua list copies the list object to Vimscript and does NOT modify the Lua list: >
vim.print(list) --> "{ 1, 2, 3 }"
<
+
vim.call({func}, {...}) *vim.call()*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
See also |vim.fn|.
@@ -1239,6 +1250,7 @@ vim.v *vim.v*
|v:| variables.
Invalid or unset key returns `nil`.
+
*lua-options*
*lua-vim-options*
*lua-vim-set*
@@ -1262,6 +1274,7 @@ window-scoped options. Note that this must NOT be confused with
|local-options| and |:setlocal|. There is also |vim.go| that only accesses the
global value of a |global-local| option, see |:setglobal|.
+
*vim.opt_local*
*vim.opt_global*
*vim.opt*
@@ -2190,8 +2203,8 @@ vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more tables.
Parameters: ~
- • {behavior} (`"error"|"keep"|"force"`) (string) Decides what to do if
- a key is found in more than one map:
+ • {behavior} (`'error'|'keep'|'force'`) Decides what to do if a key is
+ found in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
@@ -2207,8 +2220,8 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more tables.
Parameters: ~
- • {behavior} (`string`) Decides what to do if a key is found in more
- than one map:
+ • {behavior} (`'error'|'keep'|'force'`) Decides what to do if a key is
+ found in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
@@ -3897,6 +3910,7 @@ Iter:enumerate() *Iter:enumerate()*
<
Example: >lua
+
local it = vim.iter(vim.gsplit('abc', '')):enumerate()
it:next()
-- 1 'a'
@@ -3931,6 +3945,7 @@ Iter:find({f}) *Iter:find()*
found.
Examples: >lua
+
local it = vim.iter({ 3, 6, 9, 12 })
it:find(12)
-- 12
@@ -4011,6 +4026,7 @@ Iter:last() *Iter:last()*
Drains the iterator and returns the last item.
Example: >lua
+
local it = vim.iter(vim.gsplit('abcdefg', ''))
it:last()
-- 'g'
@@ -4051,6 +4067,7 @@ Iter:next() *Iter:next()*
Gets the next value from the iterator.
Example: >lua
+
local it = vim.iter(string.gmatch('1 2 3', '%d+')):map(tonumber)
it:next()
-- 1
@@ -4082,6 +4099,7 @@ Iter:nth({n}) *Iter:nth()*
Gets the nth value of an iterator (and advances to it).
Example: >lua
+
local it = vim.iter({ 3, 6, 9, 12 })
it:nth(2)
-- 6
@@ -4099,6 +4117,7 @@ Iter:nthback({n}) *Iter:nthback()*
Gets the nth value from the end of a |list-iterator| (and advances to it).
Example: >lua
+
local it = vim.iter({ 3, 6, 9, 12 })
it:nthback(2)
-- 9
@@ -4116,6 +4135,7 @@ Iter:peek() *Iter:peek()*
Gets the next value in a |list-iterator| without consuming it.
Example: >lua
+
local it = vim.iter({ 3, 6, 9, 12 })
it:peek()
-- 3
@@ -4150,6 +4170,7 @@ Iter:rev() *Iter:rev()*
Reverses a |list-iterator| pipeline.
Example: >lua
+
local it = vim.iter({ 3, 6, 9, 12 }):rev()
it:totable()
-- { 12, 9, 6, 3 }
@@ -4166,6 +4187,7 @@ Iter:rfind({f}) *Iter:rfind()*
found.
Examples: >lua
+
local it = vim.iter({ 1, 2, 3, 2, 1 }):enumerate()
it:rfind(1)
-- 5 1
@@ -4186,6 +4208,7 @@ Iter:skip({n}) *Iter:skip()*
Skips `n` values of an iterator pipeline.
Example: >lua
+
local it = vim.iter({ 3, 6, 9, 12 }):skip(2)
it:next()
-- 9