diff options
Diffstat (limited to 'runtime/lua')
27 files changed, 723 insertions, 582 deletions
diff --git a/runtime/lua/vim/F.lua b/runtime/lua/vim/F.lua index 16c834b371..5ed60ca8ab 100644 --- a/runtime/lua/vim/F.lua +++ b/runtime/lua/vim/F.lua @@ -5,13 +5,14 @@ local F = {} --- If all arguments are nil, returns nil. --- --- Examples: ---- <pre> +--- +--- ```lua --- local a = nil --- local b = nil --- local c = 42 --- local d = true --- assert(vim.F.if_nil(a, b, c, d) == 42) ---- </pre> +--- ``` --- ---@param ... any ---@return any diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 64aeb64736..0215cae0cb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -70,23 +70,24 @@ vim.log = { --- Run a system command --- --- Examples: ---- <pre>lua --- ---- local on_exit = function(obj) ---- print(obj.code) ---- print(obj.signal) ---- print(obj.stdout) ---- print(obj.stderr) ---- end +--- ```lua --- ---- -- Run asynchronously ---- vim.system({'echo', 'hello'}, { text = true }, on_exit) +--- local on_exit = function(obj) +--- print(obj.code) +--- print(obj.signal) +--- print(obj.stdout) +--- print(obj.stderr) +--- end --- ---- -- Run synchronously ---- local obj = vim.system({'echo', 'hello'}, { text = true }):wait() ---- -- { code = 0, signal = 0, stdout = 'hello', stderr = '' } +--- -- Run asynchronously +--- vim.system({'echo', 'hello'}, { text = true }, on_exit) --- ---- </pre> +--- -- Run synchronously +--- local obj = vim.system({'echo', 'hello'}, { text = true }):wait() +--- -- { code = 0, signal = 0, stdout = 'hello', stderr = '' } +--- +--- ``` --- --- See |uv.spawn()| for more details. --- @@ -200,7 +201,8 @@ do --- (such as the |TUI|) pastes text into the editor. --- --- Example: To remove ANSI color codes when pasting: - --- <pre>lua + --- + --- ```lua --- vim.paste = (function(overridden) --- return function(lines, phase) --- for i,line in ipairs(lines) do @@ -210,7 +212,7 @@ do --- overridden(lines, phase) --- end --- end)(vim.paste) - --- </pre> + --- ``` --- ---@see |paste| ---@alias paste_phase -1 | 1 | 2 | 3 @@ -361,32 +363,33 @@ local VIM_CMD_ARG_MAX = 20 --- command. --- --- Example: ---- <pre>lua ---- vim.cmd('echo 42') ---- vim.cmd([[ ---- augroup My_group ---- autocmd! ---- autocmd FileType c setlocal cindent ---- augroup END ---- ]]) --- ---- -- Ex command :echo "foo" ---- -- Note string literals need to be double quoted. ---- vim.cmd('echo "foo"') ---- vim.cmd { cmd = 'echo', args = { '"foo"' } } ---- vim.cmd.echo({ args = { '"foo"' } }) ---- vim.cmd.echo('"foo"') +--- ```lua +--- vim.cmd('echo 42') +--- vim.cmd([[ +--- augroup My_group +--- autocmd! +--- autocmd FileType c setlocal cindent +--- augroup END +--- ]]) +--- +--- -- Ex command :echo "foo" +--- -- Note string literals need to be double quoted. +--- vim.cmd('echo "foo"') +--- vim.cmd { cmd = 'echo', args = { '"foo"' } } +--- vim.cmd.echo({ args = { '"foo"' } }) +--- vim.cmd.echo('"foo"') --- ---- -- Ex command :write! myfile.txt ---- vim.cmd('write! myfile.txt') ---- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } ---- vim.cmd.write { args = { "myfile.txt" }, bang = true } ---- vim.cmd.write { "myfile.txt", bang = true } +--- -- Ex command :write! myfile.txt +--- vim.cmd('write! myfile.txt') +--- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true } +--- vim.cmd.write { args = { "myfile.txt" }, bang = true } +--- vim.cmd.write { "myfile.txt", bang = true } --- ---- -- Ex command :colorscheme blue ---- vim.cmd('colorscheme blue') ---- vim.cmd.colorscheme('blue') ---- </pre> +--- -- Ex command :colorscheme blue +--- vim.cmd('colorscheme blue') +--- vim.cmd.colorscheme('blue') +--- ``` --- ---@param command string|table Command(s) to execute. --- If a string, executes multiple lines of Vim script at once. In this @@ -871,9 +874,10 @@ end --- "Pretty prints" the given arguments and returns them unmodified. --- --- Example: ---- <pre>lua ---- local hl_normal = vim.print(vim.api.nvim_get_hl_by_name('Normal', true)) ---- </pre> +--- +--- ```lua +--- local hl_normal = vim.print(vim.api.nvim_get_hl_by_name('Normal', true)) +--- ``` --- --- @see |vim.inspect()| --- @see |:=| @@ -900,10 +904,12 @@ end --- Translate keycodes. --- --- Example: ---- <pre>lua ---- local k = vim.keycode ---- vim.g.mapleader = k'<bs>' ---- </pre> +--- +--- ```lua +--- local k = vim.keycode +--- vim.g.mapleader = k'<bs>' +--- ``` +--- --- @param str string String to be converted. --- @return string --- @see |nvim_replace_termcodes()| diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 7cd0d825a1..6573c68493 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -127,11 +127,16 @@ function vim.api.nvim__unpack(str) end function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) end --- Activates buffer-update events on a channel, or as Lua callbacks. ---- Example (Lua): capture buffer updates in a global `events` variable (use "vim.print(events)" to see its contents): +--- Example (Lua): capture buffer updates in a global `events` variable (use +--- "vim.print(events)" to see its contents): +--- --- ```lua ---- events = {} ---- vim.api.nvim_buf_attach(0, false, { ---- on_lines=function(...) table.insert(events, {...}) end}) +--- events = {} +--- vim.api.nvim_buf_attach(0, false, { +--- on_lines = function(...) +--- table.insert(events, {...}) +--- end, +--- }) --- ``` --- --- @param buffer integer Buffer handle, or 0 for current buffer @@ -314,29 +319,32 @@ function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end --- Region can be given as (row,col) tuples, or valid extmark ids (whose --- positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1) --- respectively, thus the following are equivalent: +--- --- ```lua ---- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {}) ---- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {}) +--- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {}) +--- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {}) --- ``` +--- --- If `end` is less than `start`, traversal works backwards. (Useful with --- `limit`, to get the first marks prior to a given position.) --- Note: when using extmark ranges (marks with a end_row/end_col position) --- the `overlap` option might be useful. Otherwise only the start position of --- an extmark will be considered. --- Example: +--- --- ```lua ---- local api = vim.api ---- local pos = api.nvim_win_get_cursor(0) ---- local ns = api.nvim_create_namespace('my-plugin') ---- -- Create new extmark at line 1, column 1. ---- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {}) ---- -- Create new extmark at line 3, column 1. ---- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {}) ---- -- Get extmarks only from line 3. ---- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {}) ---- -- Get all marks in this buffer + namespace. ---- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {}) ---- vim.print(ms) +--- local api = vim.api +--- local pos = api.nvim_win_get_cursor(0) +--- local ns = api.nvim_create_namespace('my-plugin') +--- -- Create new extmark at line 1, column 1. +--- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {}) +--- -- Create new extmark at line 3, column 1. +--- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {}) +--- -- Get extmarks only from line 3. +--- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {}) +--- -- Get all marks in this buffer + namespace. +--- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {}) +--- vim.print(ms) --- ``` --- --- @param buffer integer Buffer handle, or 0 for current buffer @@ -775,6 +783,7 @@ function vim.api.nvim_command_output(command) end --- Create or get an autocommand group `autocmd-groups`. --- To get an existing group id, do: +--- --- ```lua --- local id = vim.api.nvim_create_augroup("MyGroup", { --- clear = false @@ -790,6 +799,7 @@ function vim.api.nvim_create_augroup(name, opts) end --- Creates an `autocommand` event handler, defined by `callback` (Lua function or Vimscript function name string) or `command` (Ex command string). --- Example using Lua callback: +--- --- ```lua --- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { --- pattern = {"*.c", "*.h"}, @@ -798,17 +808,21 @@ function vim.api.nvim_create_augroup(name, opts) end --- end --- }) --- ``` +--- --- Example using an Ex command as the handler: +--- --- ```lua --- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { --- pattern = {"*.c", "*.h"}, --- command = "echo 'Entering a C or C++ file'", --- }) --- ``` ---- Note: `pattern` is NOT automatically expanded (unlike with `:autocmd`), thus names like ---- "$HOME" and "~" must be expanded explicitly: +--- +--- Note: `pattern` is NOT automatically expanded (unlike with `:autocmd`), +--- thus names like "$HOME" and "~" must be expanded explicitly: +--- --- ```lua ---- pattern = vim.fn.expand("~") .. "/some/path/*.py" +--- pattern = vim.fn.expand("~") .. "/some/path/*.py" --- ``` --- --- @param event any (string|array) Event(s) that will trigger the handler @@ -870,10 +884,11 @@ function vim.api.nvim_create_namespace(name) end --- Creates a global `user-commands` command. --- For Lua usage see `lua-guide-commands-create`. --- Example: +--- --- ```vim ---- :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true}) ---- :SayHello ---- Hello world! +--- :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true}) +--- :SayHello +--- Hello world! --- ``` --- --- @param name string Name of the new user command. Must begin with an uppercase @@ -1084,6 +1099,7 @@ function vim.api.nvim_execute_lua(code, args) end --- with escape_ks=false) to replace `keycodes`, then pass the result to --- nvim_feedkeys(). --- Example: +--- --- ```vim --- :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true) --- :call nvim_feedkeys(key, 'n', v:false) @@ -1111,19 +1127,21 @@ function vim.api.nvim_get_api_info() end --- Get all autocommands that match the corresponding {opts}. --- These examples will get autocommands matching ALL the given criteria: +--- --- ```lua ---- -- Matches all criteria ---- autocommands = vim.api.nvim_get_autocmds({ ---- group = "MyGroup", ---- event = {"BufEnter", "BufWinEnter"}, ---- pattern = {"*.c", "*.h"} ---- }) ---- ---- -- All commands from one group ---- autocommands = vim.api.nvim_get_autocmds({ ---- group = "MyGroup", ---- }) +--- -- Matches all criteria +--- autocommands = vim.api.nvim_get_autocmds({ +--- group = "MyGroup", +--- event = {"BufEnter", "BufWinEnter"}, +--- pattern = {"*.c", "*.h"} +--- }) +--- +--- -- All commands from one group +--- autocommands = vim.api.nvim_get_autocmds({ +--- group = "MyGroup", +--- }) --- ``` +--- --- NOTE: When multiple patterns or events are provided, it will find all the --- autocommands that match any combination of them. --- @@ -1149,6 +1167,7 @@ function vim.api.nvim_get_chan_info(chan) end --- Returns the 24-bit RGB value of a `nvim_get_color_map()` color name or --- "#rrggbb" hexadecimal string. --- Example: +--- --- ```vim --- :echo nvim_get_color_by_name("Pink") --- :echo nvim_get_color_by_name("#cbcbcb") @@ -1471,14 +1490,18 @@ function vim.api.nvim_open_term(buffer, opts) end --- could let floats hover outside of the main window like a tooltip, but this --- should not be used to specify arbitrary WM screen positions. --- Example (Lua): window-relative float +--- --- ```lua --- vim.api.nvim_open_win(0, false, --- {relative='win', row=3, col=3, width=12, height=3}) --- ``` +--- --- Example (Lua): buffer-relative float (travels as buffer is scrolled) +--- --- ```lua --- vim.api.nvim_open_win(0, false, --- {relative='win', width=12, height=3, bufpos={100,10}}) +--- }) --- ``` --- --- @param buffer integer Buffer to display, or 0 for current buffer @@ -1856,10 +1879,13 @@ function vim.api.nvim_set_hl_ns_fast(ns_id) end --- Unlike `:map`, leading/trailing whitespace is accepted as part of the --- {lhs} or {rhs}. Empty {rhs} is `<Nop>`. `keycodes` are replaced as usual. --- Example: +--- --- ```vim --- call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true}) --- ``` +--- --- is equivalent to: +--- --- ```vim --- nmap <nowait> <Space><NL> <Nop> --- ``` diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index d7b76a803c..0a6dd3e151 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -131,7 +131,8 @@ function vim.str_utf_pos(str) end --- The result can be added to {index} to get the starting byte of a character. --- --- Examples: ---- <pre>lua +--- +--- ```lua --- -- The character 'æ' is stored as the bytes '\xc3\xa6' (using UTF-8) --- --- -- Returns 0 because the index is pointing at the first byte of a character @@ -139,7 +140,7 @@ function vim.str_utf_pos(str) end --- --- -- Returns -1 because the index is pointing at the second byte of a character --- vim.str_utf_start('æ', 2) ---- </pre> +--- ``` --- --- @param str string --- @param index number @@ -150,7 +151,8 @@ function vim.str_utf_start(str, index) end --- to. --- --- Examples: ---- <pre>lua +--- +--- ```lua --- -- The character 'æ' is stored as the bytes '\xc3\xa6' (using UTF-8) --- --- -- Returns 0 because the index is pointing at the last byte of a character @@ -158,7 +160,7 @@ function vim.str_utf_start(str, index) end --- --- -- Returns 1 because the index is pointing at the penultimate byte of a character --- vim.str_utf_end('æ', 1) ---- </pre> +--- ``` --- --- @param str string --- @param index number @@ -204,7 +206,8 @@ function vim.schedule(callback) end --- this time. --- --- Examples: ---- <pre>lua +--- +--- ```lua --- --- --- --- -- Wait for 100 ms, allowing other events to process @@ -226,7 +229,7 @@ function vim.schedule(callback) end --- if vim.wait(10000, function() return vim.g.timer_result end) then --- print('Only waiting a little bit of time!') --- end ---- </pre> +--- ``` --- --- @param time integer Number of milliseconds to wait --- @param callback? fun(): boolean Optional callback. Waits until {callback} returns true @@ -258,22 +261,23 @@ function vim.wait(time, callback, interval, fast_only) end --- likewise experimental). --- --- Example (stub for a |ui-popupmenu| implementation): ---- <pre>lua ---- ---- ns = vim.api.nvim_create_namespace('my_fancy_pum') ---- ---- vim.ui_attach(ns, {ext_popupmenu=true}, function(event, ...) ---- if event == "popupmenu_show" then ---- local items, selected, row, col, grid = ... ---- print("display pum ", #items) ---- elseif event == "popupmenu_select" then ---- local selected = ... ---- print("selected", selected) ---- elseif event == "popupmenu_hide" then ---- print("FIN") ---- end ---- end) ---- </pre> +--- +--- ```lua +--- ns = vim.api.nvim_create_namespace('my_fancy_pum') +--- +--- vim.ui_attach(ns, {ext_popupmenu=true}, function(event, ...) +--- if event == "popupmenu_show" then +--- local items, selected, row, col, grid = ... +--- print("display pum ", #items) +--- elseif event == "popupmenu_select" then +--- local selected = ... +--- print("selected", selected) +--- elseif event == "popupmenu_hide" then +--- print("FIN") +--- end +--- end) +--- ``` +--- --- @param ns integer --- @param options table<string, any> --- @param callback fun() diff --git a/runtime/lua/vim/_meta/diff.lua b/runtime/lua/vim/_meta/diff.lua index 246ac0c75a..f265139448 100644 --- a/runtime/lua/vim/_meta/diff.lua +++ b/runtime/lua/vim/_meta/diff.lua @@ -6,24 +6,25 @@ --- either directly or via callback arguments, are 1-based. --- --- Examples: ---- <pre>lua ---- vim.diff('a\\n', 'b\\nc\\n') ---- -- => ---- -- @@ -1 +1,2 @@ ---- -- -a ---- -- +b ---- -- +c --- ---- vim.diff('a\\n', 'b\\nc\\n', {result_type = 'indices'}) ---- -- => ---- -- { ---- -- {1, 1, 1, 2} ---- -- } ---- </pre> +--- ```lua +--- vim.diff('a\n', 'b\nc\n') +--- -- => +--- -- @@ -1 +1,2 @@ +--- -- -a +--- -- +b +--- -- +c --- ---- @param a string First string to compare ---- @param b string Second string to compare ---- @param opts table<string,any> Optional parameters: +--- vim.diff('a\n', 'b\nc\n', {result_type = 'indices'}) +--- -- => +--- -- { +--- -- {1, 1, 1, 2} +--- -- } +--- ``` +--- +---@param a string First string to compare +---@param b string Second string to compare +---@param opts table<string,any> Optional parameters: --- - `on_hunk` (callback): --- Invoked for each hunk in the diff. Return a negative number --- to cancel the callback for any remaining hunks. @@ -64,6 +65,6 @@ --- Use the indent heuristic for the internal --- diff library. --- ---- @return string|table|nil +---@return string|table|nil --- See {opts.result_type}. `nil` if {opts.on_hunk} is given. function vim.diff(a, b, opts) end diff --git a/runtime/lua/vim/_meta/json.lua b/runtime/lua/vim/_meta/json.lua index 76a6c7b733..edf905c7c6 100644 --- a/runtime/lua/vim/_meta/json.lua +++ b/runtime/lua/vim/_meta/json.lua @@ -1,8 +1,8 @@ ---- @meta +---@meta -- luacheck: no unused args ---- @defgroup vim.json +---@defgroup vim.json --- --- This module provides encoding and decoding of Lua objects to and --- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|. @@ -14,24 +14,23 @@ --- - Decodes empty array as `{}` (empty Lua table). --- --- Example: ---- <pre>lua ---- :lua vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}')) ---- --> { bar = {}, foo = vim.empty_dict(), zub = vim.NIL } ---- </pre> ---- Parameters: ~ ---- • {str} Stringified JSON data. ---- • {opts} Options map keys: ---- • luanil: { object: bool, array: bool } ---- • `luanil.object=true` converts `null` in JSON objects to ---- Lua `nil` instead of `vim.NIL`. ---- • `luanil.array=true` converts `null` in JSON arrays to Lua ---- `nil` instead of `vim.NIL`. ---- @param str string ---- @param opts? table<string, any> ---- @return any +--- +--- ```lua +--- vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}')) +--- -- { bar = {}, foo = vim.empty_dict(), zub = vim.NIL } +--- ``` +--- +---@param str string Stringified JSON data. +---@param opts? table<string,any> Options table with keys: +--- - luanil: (table) Table with keys: +--- * object: (boolean) When true, converts `null` in JSON objects +--- to Lua `nil` instead of |vim.NIL|. +--- * array: (boolean) When true, converts `null` in JSON arrays +--- to Lua `nil` instead of |vim.NIL|. +---@return any function vim.json.decode(str, opts) end --- Encodes (or "packs") Lua object {obj} as JSON in a Lua string. ---- @param obj any ---- @return string +---@param obj any +---@return string function vim.json.encode(obj) end diff --git a/runtime/lua/vim/_meta/misc.lua b/runtime/lua/vim/_meta/misc.lua index 8a76755962..0d70e16314 100644 --- a/runtime/lua/vim/_meta/misc.lua +++ b/runtime/lua/vim/_meta/misc.lua @@ -5,9 +5,11 @@ --- Invokes |vim-function| or |user-function| {func} with arguments {...}. --- See also |vim.fn|. --- Equivalent to: ---- <pre>lua ---- vim.fn[func]({...}) ---- </pre> +--- +--- ```lua +--- vim.fn[func]({...}) +--- ``` +--- --- @param func fun() --- @param ... any function vim.call(func, ...) end diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 92dc4b2c7f..af676fa961 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -141,6 +141,7 @@ vim.bo.ai = vim.bo.autoindent --- :set autoread< --- ``` --- +--- --- @type boolean vim.o.autoread = true vim.o.ar = vim.o.autoread @@ -354,6 +355,7 @@ vim.go.bkc = vim.go.backupcopy --- ``` --- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` +--- --- See also 'backup' and 'writebackup' options. --- If you want to hide your backup files on Unix, consider this value: --- ``` @@ -409,9 +411,9 @@ vim.go.bex = vim.go.backupext --- --- Note that environment variables are not expanded. If you want to use --- $HOME you must expand it explicitly, e.g.: ---- ``` ---- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' --- +--- ```vim +--- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*' --- ``` --- Note that the default also makes sure that "crontab -e" works (when a --- backup would be made by renaming the original file crontab won't see @@ -833,6 +835,7 @@ vim.bo.cino = vim.bo.cinoptions --- set cinscopedecls+=signals,public\ slots,private\ slots --- ``` --- +--- --- @type string vim.o.cinscopedecls = "public,protected,private" vim.o.cinsd = vim.o.cinscopedecls @@ -916,11 +919,11 @@ vim.go.cwh = vim.go.cmdwinheight --- The screen column can be an absolute number, or a number preceded with --- '+' or '-', which is added to or subtracted from 'textwidth'. --- ``` ---- --- :set cc=+1 " highlight column after 'textwidth' --- :set cc=+1,+2,+3 " highlight three columns after 'textwidth' --- :hi ColorColumn ctermbg=lightgrey guibg=lightgrey --- ``` +--- --- When 'textwidth' is zero then the items with '-' and '+' are not used. --- A maximum of 256 columns are highlighted. --- @@ -1418,6 +1421,7 @@ vim.wo.crb = vim.wo.cursorbind --- au WinEnter * set cursorline cursorcolumn --- ``` --- +--- --- @type boolean vim.o.cursorcolumn = false vim.o.cuc = vim.o.cursorcolumn @@ -1499,6 +1503,7 @@ vim.go.debug = vim.o.debug --- let &l:define = '^\s*\ze\k\+\s*=\s*function(' --- ``` --- +--- --- @type string vim.o.define = "" vim.o.def = vim.o.define @@ -1679,6 +1684,7 @@ vim.go.dex = vim.go.diffexpr --- :set diffopt-=internal " do NOT use the internal diff parser --- ``` --- +--- --- @type string vim.o.diffopt = "internal,filler,closeoff" vim.o.dip = vim.o.diffopt @@ -1729,6 +1735,7 @@ vim.go.dg = vim.go.digraph --- ``` --- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces --- ``` +--- --- Editing the same file twice will result in a warning. Using "/tmp" on --- is discouraged: if the system crashes you lose the swap file. And --- others on the computer may be able to see the files. @@ -1917,6 +1924,7 @@ vim.go.efm = vim.go.errorformat --- :set ei=WinEnter,WinLeave --- ``` --- +--- --- @type string vim.o.eventignore = "" vim.o.ei = vim.o.eventignore @@ -2634,14 +2642,12 @@ vim.go.gp = vim.go.grepprg --- To disable cursor-styling, reset the option: --- ``` --- :set guicursor= ---- --- ``` --- To enable mode shapes, "Cursor" highlight, and blinking: --- ``` --- :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50 --- \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor --- \,sm:block-blinkwait175-blinkoff150-blinkon175 ---- --- ``` --- The option is a comma-separated list of parts. Each part consists of a --- mode-list and an argument-list: @@ -2719,6 +2725,7 @@ vim.go.gp = vim.go.grepprg --- :highlight Cursor gui=NONE guifg=bg guibg=fg --- ``` --- +--- --- @type string vim.o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20" vim.o.gcr = vim.o.guicursor @@ -2790,6 +2797,7 @@ vim.go.gcr = vim.go.guicursor --- :set guifont=Andale_Mono:h7.5:w4.5 --- ``` --- +--- --- @type string vim.o.guifont = "" vim.o.gfn = vim.o.guifont @@ -2944,6 +2952,7 @@ vim.go.gtl = vim.go.guitablabel --- :let &guitabtooltip = "line one\nline two" --- ``` --- +--- --- @type string vim.o.guitabtooltip = "" vim.o.gtt = vim.o.guitabtooltip @@ -3206,6 +3215,7 @@ vim.go.inc = vim.go.include --- ``` --- :setlocal includeexpr=tr(v:fname,'.','/') --- ``` +--- --- Also used for the `gf` command if an unmodified file name can't be --- found. Allows doing "gf" on the name after an 'include' statement. --- Also used for `<cfile>`. @@ -3258,6 +3268,7 @@ vim.bo.inex = vim.bo.includeexpr --- autocmd CmdlineLeave /,\? :set nohlsearch --- augroup END --- ``` +--- --- CTRL-L can be used to add one character from after the current match --- to the command line. If 'ignorecase' and 'smartcase' are set and the --- command line has no uppercase characters, the added character is @@ -3565,6 +3576,7 @@ vim.go.kp = vim.go.keywordprg --- ``` --- :set langmap=zy,yz,ZY,YZ --- ``` +--- --- The 'langmap' option is a list of parts, separated with commas. Each --- part can be in one of two forms: --- 1. A list of pairs. Each pair is a "from" character immediately @@ -3762,6 +3774,7 @@ vim.go.lw = vim.go.lispwords --- ``` --- :set list lcs=tab:\ \ --- ``` +--- --- Note that list mode will also affect formatting (set with 'textwidth' --- or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for --- changing the way tabs are displayed. @@ -3790,6 +3803,7 @@ vim.wo.list = vim.o.list --- >-- --- etc. --- ``` +--- --- tab:xyz The 'z' is always used, then 'x' is prepended, and --- then 'y' is used as many times as will fit. Thus --- "tab:<->" displays: @@ -3801,6 +3815,7 @@ vim.wo.list = vim.o.list --- <--> --- etc. --- ``` +--- --- When "tab:" is omitted, a tab is shown as ^I. --- *lcs-space* --- space:c Character to show for a space. When omitted, spaces @@ -3816,6 +3831,7 @@ vim.wo.list = vim.o.list --- ``` --- ---+---+-- --- ``` +--- --- *lcs-lead* --- lead:c Character to show for leading spaces. When omitted, --- leading spaces are blank. Overrides the "space" and @@ -3824,6 +3840,7 @@ vim.wo.list = vim.o.list --- ``` --- :set listchars+=tab:>-,lead:. --- ``` +--- --- *lcs-leadmultispace* --- leadmultispace:c... --- Like the `lcs-multispace` value, but for leading @@ -3834,6 +3851,7 @@ vim.wo.list = vim.o.list --- ``` --- ---+---+--XXX --- ``` +--- --- Where "XXX" denotes the first non-blank characters in --- the line. --- *lcs-trail* @@ -3941,6 +3959,7 @@ vim.go.mef = vim.go.makeef --- :set makeencoding=char " system locale is used --- ``` --- +--- --- @type string vim.o.makeencoding = "" vim.o.menc = vim.o.makeencoding @@ -3986,13 +4005,11 @@ vim.go.mp = vim.go.makeprg --- '>' (for HTML): --- ``` --- :set mps+=<:> ---- --- ``` --- A more exotic example, to jump between the '=' and ';' in an --- assignment, useful for languages like C and Java: --- ``` --- :au FileType c,cpp,java set mps+==:; ---- --- ``` --- For a more advanced way of using "%", see the matchit.vim plugin in --- the $VIMRUNTIME/plugin directory. `add-local-help` @@ -4078,6 +4095,7 @@ vim.go.mis = vim.go.menuitems --- ``` --- {start},{inc},{added} --- ``` +--- --- For most languages the uncompressed word tree fits in memory. {start} --- gives the amount of memory in Kbyte that can be used before any --- compression is done. It should be a bit smaller than the amount of @@ -4196,6 +4214,7 @@ vim.go.more = vim.o.more --- ``` --- :set mouse=nv --- ``` +--- --- To temporarily disable mouse support, hold the shift key while using --- the mouse. --- @@ -4299,6 +4318,7 @@ vim.go.mh = vim.go.mousehide --- :map <4-S-LeftDrag> <4-RightDrag> --- :map <4-S-LeftRelease> <4-RightRelease> --- ``` +--- --- Mous |