aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-04-30 04:30:21 -0700
committerGitHub <noreply@github.com>2024-04-30 04:30:21 -0700
commit71cf75f96a67aeb79ac3af6aa829bac81bd2d33d (patch)
treeb6582df55b2956fb2077f2d79c2cc7b6acf37c84 /runtime/lua/vim
parentefaf37a2b9450d56acbf48a44c3c791d00d70199 (diff)
downloadrneovim-71cf75f96a67aeb79ac3af6aa829bac81bd2d33d.tar.gz
rneovim-71cf75f96a67aeb79ac3af6aa829bac81bd2d33d.tar.bz2
rneovim-71cf75f96a67aeb79ac3af6aa829bac81bd2d33d.zip
docs: misc #24163
- Also delete old perl scripts which are not used since 8+ years ago. fix #23251 fix #27367 ref https://github.com/neovim/neovim/issues/2252#issuecomment-1902662577 Helped-by: Daniel Kongsgaard <dakongsgaard@gmail.com> Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_defaults.lua2
-rw-r--r--runtime/lua/vim/_meta/api.lua6
-rw-r--r--runtime/lua/vim/_meta/options.lua1
-rw-r--r--runtime/lua/vim/highlight.lua31
-rw-r--r--runtime/lua/vim/iter.lua22
5 files changed, 25 insertions, 37 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 1094f22793..29f8e71264 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -255,7 +255,7 @@ do
vim.api.nvim_create_autocmd('TermRequest', {
group = nvim_terminal_augroup,
- desc = 'Respond to OSC foreground/background color requests',
+ desc = 'Handles OSC foreground/background color requests',
callback = function(args)
--- @type integer
local channel = vim.bo[args.buf].channel
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index f56c256da6..7d20d90990 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -897,8 +897,8 @@ function vim.api.nvim_create_augroup(name, opts) end
--- • callback (function|string) optional: Lua function (or
--- Vimscript function name, if string) called when the event(s)
--- is triggered. Lua callback can return a truthy value (not
---- `false` or `nil`) to delete the autocommand. Receives a
---- table argument with these keys:
+--- `false` or `nil`) to delete the autocommand. Receives one
+--- argument, a table with these keys: *event-args*
--- • id: (number) autocommand id
--- • event: (string) name of the triggered event
--- `autocmd-events`
@@ -907,7 +907,7 @@ function vim.api.nvim_create_augroup(name, opts) end
--- • buf: (number) expanded value of <abuf>
--- • file: (string) expanded value of <afile>
--- • data: (any) arbitrary data passed from
---- `nvim_exec_autocmds()`
+--- `nvim_exec_autocmds()` *event-data*
--- • command (string) optional: Vim command to execute on event.
--- Cannot be used with {callback}
--- • once (boolean) optional: defaults to false. Run the
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index b51f82401b..428b7c4d4f 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -7446,6 +7446,7 @@ vim.bo.vts = vim.bo.vartabstop
---
--- Level Messages ~
--- ----------------------------------------------------------------------
+--- 1 Enables Lua tracing (see above). Does not produce messages.
--- 2 When a file is ":source"'ed, or `shada` file is read or written.
--- 3 UI info, terminal capabilities.
--- 4 Shell commands.
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index 09d3ea5707..cdc0f0a0b1 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -1,26 +1,3 @@
----@brief
----
---- Nvim includes a function for highlighting a selection on yank.
----
---- To enable it, add the following to your `init.vim`:
----
---- ```vim
---- au TextYankPost * silent! lua vim.highlight.on_yank()
---- ```
----
---- You can customize the highlight group and the duration of the highlight via:
----
---- ```vim
---- au TextYankPost * silent! lua vim.highlight.on_yank {higroup="IncSearch", timeout=150}
---- ```
----
---- If you want to exclude visual selections from highlighting on yank, use:
----
---- ```vim
---- au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false}
---- ```
----
-
local api = vim.api
local M = {}
@@ -97,7 +74,13 @@ local yank_ns = api.nvim_create_namespace('hlyank')
local yank_timer --- @type uv.uv_timer_t?
local yank_cancel --- @type fun()?
---- Highlight the yanked text
+--- Highlight the yanked text during a |TextYankPost| event.
+---
+--- Add the following to your `init.vim`:
+---
+--- ```vim
+--- autocmd TextYankPost * silent! lua vim.highlight.on_yank {higroup='Visual', timeout=300}
+--- ```
---
--- @param opts table|nil Optional parameters
--- - higroup highlight group for yanked region (default "IncSearch")
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua
index 04137e18d4..f887a9070b 100644
--- a/runtime/lua/vim/iter.lua
+++ b/runtime/lua/vim/iter.lua
@@ -450,20 +450,24 @@ function Iter:join(delim)
return table.concat(self:totable(), delim)
end
---- Folds ("reduces") an iterator into a single value.
+--- Folds ("reduces") an iterator into a single value. [Iter:reduce()]()
---
--- Examples:
---
--- ```lua
--- -- Create a new table with only even values
---- local t = { a = 1, b = 2, c = 3, d = 4 }
---- local it = vim.iter(t)
---- it:filter(function(k, v) return v % 2 == 0 end)
---- it:fold({}, function(t, k, v)
---- t[k] = v
---- return t
---- end)
---- -- { b = 2, d = 4 }
+--- vim.iter({ a = 1, b = 2, c = 3, d = 4 })
+--- :filter(function(k, v) return v % 2 == 0 end)
+--- :fold({}, function(acc, k, v)
+--- acc[k] = v
+--- return acc
+--- end) --> { b = 2, d = 4 }
+---
+--- -- Get the "maximum" item of an iterable.
+--- vim.iter({ -99, -4, 3, 42, 0, 0, 7 })
+--- :fold({}, function(acc, v)
+--- acc.max = math.max(v, acc.max or v) return acc
+--- end) --> { max = 42 }
--- ```
---
---@generic A