neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

api.lua (113085B)


      1 --- @meta _
      2 -- THIS FILE IS GENERATED
      3 -- DO NOT EDIT
      4 error('Cannot require a meta file')
      5 
      6 --- This file embeds vimdoc as the function descriptions
      7 --- so ignore any doc related errors.
      8 --- @diagnostic disable: undefined-doc-name,luadoc-miss-symbol
      9 
     10 vim.api = {}
     11 
     12 --- @param buffer integer
     13 --- @param keys boolean
     14 --- @param dot boolean
     15 --- @return string
     16 function vim.api.nvim__buf_debug_extmarks(buffer, keys, dot) end
     17 
     18 --- @param buffer integer
     19 --- @return table<string,any>
     20 function vim.api.nvim__buf_stats(buffer) end
     21 
     22 --- EXPERIMENTAL: this API may change in the future.
     23 ---
     24 --- Sets info for the completion item at the given index. If the info text was shown in a window,
     25 --- returns the window and buffer ids, or empty dict if not shown.
     26 ---
     27 --- @param index integer Completion candidate index
     28 --- @param opts vim.api.keyset.complete_set Optional parameters.
     29 --- - info: (string) info text.
     30 --- @return table<string,number> # Dict containing these keys:
     31 --- - winid: (number) floating window id
     32 --- - bufnr: (number) buffer id in floating window
     33 function vim.api.nvim__complete_set(index, opts) end
     34 
     35 --- @return string
     36 function vim.api.nvim__get_lib_dir() end
     37 
     38 --- Find files in runtime directories
     39 ---
     40 --- @param pat string[] pattern of files to search for
     41 --- @param all boolean whether to return all matches or only the first
     42 --- @param opts vim.api.keyset.runtime is_lua: only search Lua subdirs
     43 --- @return string[] # list of absolute paths to the found files
     44 function vim.api.nvim__get_runtime(pat, all, opts) end
     45 
     46 --- Returns object given as argument.
     47 ---
     48 --- This API function is used for testing. One should not rely on its presence
     49 --- in plugins.
     50 ---
     51 --- @param obj any Object to return.
     52 --- @return any # its argument.
     53 function vim.api.nvim__id(obj) end
     54 
     55 --- Returns array given as argument.
     56 ---
     57 --- This API function is used for testing. One should not rely on its presence
     58 --- in plugins.
     59 ---
     60 --- @param arr any[] Array to return.
     61 --- @return any[] # its argument.
     62 function vim.api.nvim__id_array(arr) end
     63 
     64 --- Returns dict given as argument.
     65 ---
     66 --- This API function is used for testing. One should not rely on its presence
     67 --- in plugins.
     68 ---
     69 --- @param dct table<string,any> Dict to return.
     70 --- @return table<string,any> # its argument.
     71 function vim.api.nvim__id_dict(dct) end
     72 
     73 --- Returns floating-point value given as argument.
     74 ---
     75 --- This API function is used for testing. One should not rely on its presence
     76 --- in plugins.
     77 ---
     78 --- @param flt number Value to return.
     79 --- @return number # its argument.
     80 function vim.api.nvim__id_float(flt) end
     81 
     82 --- NB: if your UI doesn't use hlstate, this will not return hlstate first time.
     83 --- @param grid integer
     84 --- @param row integer
     85 --- @param col integer
     86 --- @return any[]
     87 function vim.api.nvim__inspect_cell(grid, row, col) end
     88 
     89 --- For testing. The condition in schar_cache_clear_if_full is hard to
     90 --- reach, so this function can be used to force a cache clear in a test.
     91 function vim.api.nvim__invalidate_glyph_cache() end
     92 
     93 --- EXPERIMENTAL: this API will change in the future.
     94 ---
     95 --- Get the properties for namespace
     96 ---
     97 --- @param ns_id integer Namespace
     98 --- @return vim.api.keyset.ns_opts # Map defining the namespace properties, see |nvim__ns_set()|
     99 function vim.api.nvim__ns_get(ns_id) end
    100 
    101 --- EXPERIMENTAL: this API will change in the future.
    102 ---
    103 --- Set some properties for namespace
    104 ---
    105 --- @param ns_id integer Namespace
    106 --- @param opts vim.api.keyset.ns_opts Optional parameters to set:
    107 --- - wins: a list of windows to be scoped in
    108 function vim.api.nvim__ns_set(ns_id, opts) end
    109 
    110 --- EXPERIMENTAL: this API may change in the future.
    111 ---
    112 --- Instruct Nvim to redraw various components.
    113 ---
    114 ---
    115 --- @see `:help :redraw`
    116 --- @param opts vim.api.keyset.redraw Optional parameters.
    117 --- - win: Target a specific `window-ID` as described below.
    118 --- - buf: Target a specific buffer number as described below.
    119 --- - flush: Update the screen with pending updates.
    120 --- - valid: When present mark `win`, `buf`, or all windows for
    121 ---   redraw. When `true`, only redraw changed lines (useful for
    122 ---   decoration providers). When `false`, forcefully redraw.
    123 --- - range: Redraw a range in `buf`, the buffer in `win` or the
    124 ---   current buffer (useful for decoration providers). Expects a
    125 ---   tuple `[first, last]` with the first and last line number
    126 ---   of the range, 0-based end-exclusive `api-indexing`.
    127 --- - cursor: Immediately update cursor position on the screen in
    128 ---   `win` or the current window.
    129 --- - statuscolumn: Redraw the 'statuscolumn' in `buf`, `win` or
    130 ---   all windows.
    131 --- - statusline: Redraw the 'statusline' in `buf`, `win` or all
    132 ---   windows.
    133 --- - winbar: Redraw the 'winbar' in `buf`, `win` or all windows.
    134 --- - tabline: Redraw the 'tabline'.
    135 function vim.api.nvim__redraw(opts) end
    136 
    137 --- @return any[]
    138 function vim.api.nvim__runtime_inspect() end
    139 
    140 --- @param path string
    141 function vim.api.nvim__screenshot(path) end
    142 
    143 --- Gets internal stats.
    144 ---
    145 --- @return table<string,any> # Map of various internal stats.
    146 function vim.api.nvim__stats() end
    147 
    148 --- @param str string
    149 --- @return any
    150 function vim.api.nvim__unpack(str) end
    151 
    152 --- @deprecated
    153 --- @param buffer integer
    154 --- @param ns_id integer
    155 --- @param hl_group string
    156 --- @param line integer
    157 --- @param col_start integer
    158 --- @param col_end integer
    159 --- @return integer
    160 function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) end
    161 
    162 --- Activates `api-buffer-updates` events on a channel, or as Lua callbacks.
    163 ---
    164 --- Example (Lua): capture buffer updates in a global `events` variable
    165 --- (use "vim.print(events)" to see its contents):
    166 ---
    167 --- ```lua
    168 --- events = {}
    169 --- vim.api.nvim_buf_attach(0, false, {
    170 ---   on_lines = function(...)
    171 ---     table.insert(events, {...})
    172 ---   end,
    173 --- })
    174 --- ```
    175 ---
    176 ---
    177 --- @see vim.api.nvim_buf_detach
    178 --- @see `:help api-buffer-updates-lua`
    179 --- @param buffer integer Buffer id, or 0 for current buffer
    180 --- @param send_buffer boolean True if the initial notification should contain the
    181 --- whole buffer: first notification will be `nvim_buf_lines_event`.
    182 --- Else the first notification will be `nvim_buf_changedtick_event`.
    183 --- Not for Lua callbacks.
    184 --- @param opts vim.api.keyset.buf_attach Optional parameters.
    185 --- - on_lines: Called on linewise changes. Not called on buffer reload (`:checktime`,
    186 ---   `:edit`, …), see `on_reload:`. Return a [lua-truthy] value to detach. Args:
    187 ---   - the string "lines"
    188 ---   - buffer id
    189 ---   - b:changedtick
    190 ---   - first line that changed (zero-indexed)
    191 ---   - last line that was changed
    192 ---   - last line in the updated range
    193 ---   - byte count of previous contents
    194 ---   - deleted_codepoints (if `utf_sizes` is true)
    195 ---   - deleted_codeunits (if `utf_sizes` is true)
    196 --- - on_bytes: Called on granular changes (compared to on_lines). Not called on buffer
    197 ---   reload (`:checktime`, `:edit`, …), see `on_reload:`. Return a [lua-truthy] value
    198 ---   to detach. Args:
    199 ---   - the string "bytes"
    200 ---   - buffer id
    201 ---   - b:changedtick
    202 ---   - start row of the changed text (zero-indexed)
    203 ---   - start column of the changed text
    204 ---   - byte offset of the changed text (from the start of
    205 ---       the buffer)
    206 ---   - old end row of the changed text (offset from start row)
    207 ---   - old end column of the changed text
    208 ---     (if old end row = 0, offset from start column)
    209 ---   - old end byte length of the changed text
    210 ---   - new end row of the changed text (offset from start row)
    211 ---   - new end column of the changed text
    212 ---     (if new end row = 0, offset from start column)
    213 ---   - new end byte length of the changed text
    214 --- - on_changedtick: Called on [changetick] increment without text change. Args:
    215 ---   - the string "changedtick"
    216 ---   - buffer id
    217 ---   - b:changedtick
    218 --- - on_detach: Called on detach. Args:
    219 ---   - the string "detach"
    220 ---   - buffer id
    221 --- - on_reload: Called on whole-buffer load (`:checktime`, `:edit`, …). Clients should
    222 ---   typically re-fetch the entire buffer contents. Args:
    223 ---   - the string "reload"
    224 ---   - buffer id
    225 --- - utf_sizes: include UTF-32 and UTF-16 size of the replaced
    226 ---   region, as args to `on_lines`.
    227 --- - preview: also attach to command preview (i.e. 'inccommand')
    228 ---   events.
    229 --- @return boolean # False if attach failed (invalid parameter, or buffer isn't loaded);
    230 --- otherwise True.
    231 function vim.api.nvim_buf_attach(buffer, send_buffer, opts) end
    232 
    233 --- Call a function with buffer as temporary current buffer.
    234 ---
    235 --- This temporarily switches current buffer to "buffer".
    236 --- If the current window already shows "buffer", the window is not switched.
    237 --- If a window inside the current tabpage (including a float) already shows the
    238 --- buffer, then one of those windows will be set as current window temporarily.
    239 --- Otherwise a temporary scratch window (called the "autocmd window" for
    240 --- historical reasons) will be used.
    241 ---
    242 --- This is useful e.g. to call Vimscript functions that only work with the
    243 --- current buffer/window currently, like `jobstart(…, {'term': v:true})`.
    244 ---
    245 --- @param buffer integer Buffer id, or 0 for current buffer
    246 --- @param fun function Function to call inside the buffer (currently Lua callable
    247 --- only)
    248 --- @return any # Return value of function.
    249 function vim.api.nvim_buf_call(buffer, fun) end
    250 
    251 --- @deprecated
    252 --- @param buffer integer
    253 --- @param ns_id integer
    254 --- @param line_start integer
    255 --- @param line_end integer
    256 function vim.api.nvim_buf_clear_highlight(buffer, ns_id, line_start, line_end) end
    257 
    258 --- Clears `namespace`d objects (highlights, `extmarks`, virtual text) from
    259 --- a region.
    260 ---
    261 --- Lines are 0-indexed. `api-indexing`  To clear the namespace in the entire
    262 --- buffer, specify line_start=0 and line_end=-1.
    263 ---
    264 --- @param buffer integer Buffer id, or 0 for current buffer
    265 --- @param ns_id integer Namespace to clear, or -1 to clear all namespaces.
    266 --- @param line_start integer Start of range of lines to clear
    267 --- @param line_end integer End of range of lines to clear (exclusive) or -1 to clear
    268 --- to end of buffer.
    269 function vim.api.nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end) end
    270 
    271 --- Creates a buffer-local command `user-commands`.
    272 ---
    273 --- @see vim.api.nvim_create_user_command
    274 --- @param buffer integer Buffer id, or 0 for current buffer.
    275 --- @param name string
    276 --- @param command any
    277 --- @param opts vim.api.keyset.user_command
    278 function vim.api.nvim_buf_create_user_command(buffer, name, command, opts) end
    279 
    280 --- Removes an `extmark`.
    281 ---
    282 --- @param buffer integer Buffer id, or 0 for current buffer
    283 --- @param ns_id integer Namespace id from `nvim_create_namespace()`
    284 --- @param id integer Extmark id
    285 --- @return boolean # true if the extmark was found, else false
    286 function vim.api.nvim_buf_del_extmark(buffer, ns_id, id) end
    287 
    288 --- Unmaps a buffer-local `mapping` for the given mode.
    289 ---
    290 ---
    291 --- @see vim.api.nvim_del_keymap
    292 --- @param buffer integer Buffer id, or 0 for current buffer
    293 --- @param mode string
    294 --- @param lhs string
    295 function vim.api.nvim_buf_del_keymap(buffer, mode, lhs) end
    296 
    297 --- Deletes a named mark in the buffer. See `mark-motions`.
    298 ---
    299 --- Note:
    300 --- only deletes marks set in the buffer, if the mark is not set
    301 --- in the buffer it will return false.
    302 ---
    303 --- @see vim.api.nvim_buf_set_mark
    304 --- @see vim.api.nvim_del_mark
    305 --- @param buffer integer Buffer to set the mark on
    306 --- @param name string Mark name
    307 --- @return boolean # true if the mark was deleted, else false.
    308 function vim.api.nvim_buf_del_mark(buffer, name) end
    309 
    310 --- Delete a buffer-local user-defined command.
    311 ---
    312 --- Only commands created with `:command-buffer` or
    313 --- `nvim_buf_create_user_command()` can be deleted with this function.
    314 ---
    315 --- @param buffer integer Buffer id, or 0 for current buffer.
    316 --- @param name string Name of the command to delete.
    317 function vim.api.nvim_buf_del_user_command(buffer, name) end
    318 
    319 --- Removes a buffer-scoped (b:) variable
    320 ---
    321 --- @param buffer integer Buffer id, or 0 for current buffer
    322 --- @param name string Variable name
    323 function vim.api.nvim_buf_del_var(buffer, name) end
    324 
    325 --- Deletes a buffer and its metadata (like `:bwipeout`).
    326 ---
    327 --- To get `:bdelete` behavior, reset 'buflisted' and pass `unload=true`:
    328 --- ```lua
    329 --- vim.bo.buflisted = false
    330 --- vim.api.nvim_buf_delete(0, { unload = true })
    331 --- ```
    332 ---
    333 --- @param buffer integer Buffer id, or 0 for current buffer
    334 --- @param opts vim.api.keyset.buf_delete Optional parameters. Keys:
    335 --- - force:  Force deletion, ignore unsaved changes.
    336 --- - unload: Unloaded only (`:bunload`), do not delete.
    337 function vim.api.nvim_buf_delete(buffer, opts) end
    338 
    339 --- Gets a changed tick of a buffer
    340 ---
    341 --- @param buffer integer Buffer id, or 0 for current buffer
    342 --- @return integer # `b:changedtick` value.
    343 function vim.api.nvim_buf_get_changedtick(buffer) end
    344 
    345 --- Gets a map of buffer-local `user-commands`.
    346 ---
    347 --- @param buffer integer Buffer id, or 0 for current buffer
    348 --- @param opts vim.api.keyset.get_commands Optional parameters. Currently not used.
    349 --- @return vim.api.keyset.command_info # Map of maps describing commands.
    350 function vim.api.nvim_buf_get_commands(buffer, opts) end
    351 
    352 --- Gets the position (0-indexed) of an `extmark`.
    353 ---
    354 --- @param buffer integer Buffer id, or 0 for current buffer
    355 --- @param ns_id integer Namespace id from `nvim_create_namespace()`
    356 --- @param id integer Extmark id
    357 --- @param opts vim.api.keyset.get_extmark Optional parameters. Keys:
    358 --- - details: Whether to include the details dict
    359 --- - hl_name: Whether to include highlight group name instead of id, true if omitted
    360 --- @return [integer, integer, vim.api.keyset.extmark_details?] # 0-indexed (row, col, details?) tuple or empty list () if extmark id was absent.  The
    361 --- optional `details` dictionary contains the same keys as `opts` in |nvim_buf_set_extmark()|,
    362 --- except for `id`, `conceal_lines` and `ephemeral`. It also contains the following keys:
    363 ---
    364 --- - ns_id: |namespace| id
    365 --- - invalid: boolean that indicates whether the mark is hidden because the entirety of
    366 --- text span range is deleted. See also the key `invalidate` in |nvim_buf_set_extmark()|.
    367 function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
    368 
    369 --- Gets `extmarks` in "traversal order" from a `charwise` region defined by
    370 --- buffer positions (inclusive, 0-indexed `api-indexing`).
    371 ---
    372 --- Region can be given as (row,col) tuples, or valid extmark ids (whose
    373 --- positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
    374 --- respectively, thus the following are equivalent:
    375 ---
    376 --- ```lua
    377 --- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
    378 --- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {})
    379 --- ```
    380 ---
    381 --- If `end` is less than `start`, marks are returned in reverse order.
    382 --- (Useful with `limit`, to get the first marks prior to a given position.)
    383 ---
    384 --- Note: For a reverse range, `limit` does not actually affect the traversed
    385 --- range, just how many marks are returned
    386 ---
    387 --- Note: when using extmark ranges (marks with a end_row/end_col position)
    388 --- the `overlap` option might be useful. Otherwise only the start position
    389 --- of an extmark will be considered.
    390 ---
    391 --- Note: legacy signs placed through the `:sign` commands are implemented
    392 --- as extmarks and will show up here. Their details array will contain a
    393 --- `sign_name` field.
    394 ---
    395 --- Example:
    396 ---
    397 --- ```lua
    398 --- local api = vim.api
    399 --- local pos = api.nvim_win_get_cursor(0)
    400 --- local ns  = api.nvim_create_namespace('my-plugin')
    401 --- -- Create new extmark at line 1, column 1.
    402 --- local m1  = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
    403 --- -- Create new extmark at line 3, column 1.
    404 --- local m2  = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
    405 --- -- Get extmarks only from line 3.
    406 --- local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
    407 --- -- Get all marks in this buffer + namespace.
    408 --- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
    409 --- vim.print(ms)
    410 --- ```
    411 ---
    412 --- @param buffer integer Buffer id, or 0 for current buffer
    413 --- @param ns_id integer Namespace id from `nvim_create_namespace()` or -1 for all namespaces
    414 --- @param start any Start of range: a 0-indexed (row, col) or valid extmark id
    415 --- (whose position defines the bound). `api-indexing`
    416 --- @param end_ any End of range (inclusive): a 0-indexed (row, col) or valid
    417 --- extmark id (whose position defines the bound). `api-indexing`
    418 --- @param opts vim.api.keyset.get_extmarks Optional parameters. Keys:
    419 --- - limit:  Maximum number of marks to return
    420 --- - details: Whether to include the details dict
    421 --- - hl_name: Whether to include highlight group name instead of id, true if omitted
    422 --- - overlap: Also include marks which overlap the range, even if
    423 ---            their start position is less than `start`
    424 --- - type: Filter marks by type: "highlight", "sign", "virt_text" and "virt_lines"
    425 --- @return vim.api.keyset.get_extmark_item[] # List of `[extmark_id, row, col, details?]` tuples in "traversal order". For the
    426 --- `details` dictionary, see |nvim_buf_get_extmark_by_id()|.
    427 function vim.api.nvim_buf_get_extmarks(buffer, ns_id, start, end_, opts) end
    428 
    429 --- Gets a list of buffer-local `mapping` definitions.
    430 ---
    431 --- @param buffer integer Buffer id, or 0 for current buffer
    432 --- @param mode string Mode short-name ("n", "i", "v", ...)
    433 --- @return vim.api.keyset.get_keymap[] # Array of |maparg()|-like dictionaries describing mappings.
    434 --- The "buffer" key holds the associated buffer id.
    435 function vim.api.nvim_buf_get_keymap(buffer, mode) end
    436 
    437 --- Gets a line-range from the buffer.
    438 ---
    439 --- Indexing is zero-based, end-exclusive. Negative indices are interpreted
    440 --- as length+1+index: -1 refers to the index past the end. So to get the
    441 --- last element use start=-2 and end=-1.
    442 ---
    443 --- Out-of-bounds indices are clamped to the nearest valid value, unless
    444 --- `strict_indexing` is set.
    445 ---
    446 ---
    447 --- @see vim.api.nvim_buf_get_text
    448 --- @param buffer integer Buffer id, or 0 for current buffer
    449 --- @param start integer First line index
    450 --- @param end_ integer Last line index, exclusive
    451 --- @param strict_indexing boolean Whether out-of-bounds should be an error.
    452 --- @return string[] # Array of lines, or empty array for unloaded buffer.
    453 function vim.api.nvim_buf_get_lines(buffer, start, end_, strict_indexing) end
    454 
    455 --- Returns a `(row,col)` tuple representing the position of the named mark.
    456 --- "End of line" column position is returned as `v:maxcol` (big number).
    457 --- See `mark-motions`.
    458 ---
    459 --- Marks are (1,0)-indexed. `api-indexing`
    460 ---
    461 --- @see vim.api.nvim_buf_set_mark
    462 --- @see vim.api.nvim_buf_del_mark
    463 --- @param buffer integer Buffer id, or 0 for current buffer
    464 --- @param name string Mark name
    465 --- @return [integer, integer] # (row, col) tuple, (0, 0) if the mark is not set, or is an
    466 --- uppercase/file mark set in another buffer.
    467 function vim.api.nvim_buf_get_mark(buffer, name) end
    468 
    469 --- Gets the full file name for the buffer
    470 ---
    471 --- @param buffer integer Buffer id, or 0 for current buffer
    472 --- @return string # Buffer name
    473 function vim.api.nvim_buf_get_name(buffer) end
    474 
    475 --- @deprecated
    476 --- @param buffer integer
    477 --- @return integer
    478 function vim.api.nvim_buf_get_number(buffer) end
    479 
    480 --- Returns the byte offset of a line (0-indexed). `api-indexing`
    481 ---
    482 --- Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte.
    483 --- 'fileformat' and 'fileencoding' are ignored. The line index just after the
    484 --- last line gives the total byte-count of the buffer. A final EOL byte is
    485 --- counted if it would be written, see 'eol'.
    486 ---
    487 --- Unlike `line2byte()`, throws error for out-of-bounds indexing.
    488 --- Returns -1 for unloaded buffer.
    489 ---
    490 --- @param buffer integer Buffer id, or 0 for current buffer
    491 --- @param index integer Line index
    492 --- @return integer # Integer byte offset, or -1 for unloaded buffer.
    493 function vim.api.nvim_buf_get_offset(buffer, index) end
    494 
    495 --- @deprecated
    496 --- @param buffer integer
    497 --- @param name string
    498 --- @return any
    499 function vim.api.nvim_buf_get_option(buffer, name) end
    500 
    501 --- Gets a range from the buffer (may be partial lines, unlike `nvim_buf_get_lines()`).
    502 ---
    503 --- Indexing is zero-based. Row indices are end-inclusive, and column indices
    504 --- are end-exclusive.
    505 ---
    506 --- Prefer `nvim_buf_get_lines()` when retrieving entire lines.
    507 ---
    508 --- @param buffer integer Buffer id, or 0 for current buffer
    509 --- @param start_row integer First line index
    510 --- @param start_col integer Starting column (byte offset) on first line
    511 --- @param end_row integer Last line index, inclusive
    512 --- @param end_col integer Ending column (byte offset) on last line, exclusive
    513 --- @param opts vim.api.keyset.empty Optional parameters. Currently unused.
    514 --- @return string[] # Array of lines, or empty array for unloaded buffer.
    515 function vim.api.nvim_buf_get_text(buffer, start_row, start_col, end_row, end_col, opts) end
    516 
    517 --- Gets a buffer-scoped (b:) variable.
    518 ---
    519 --- @param buffer integer Buffer id, or 0 for current buffer
    520 --- @param name string Variable name
    521 --- @return any # Variable value
    522 function vim.api.nvim_buf_get_var(buffer, name) end
    523 
    524 --- Checks if a buffer is valid and loaded. See `api-buffer` for more info
    525 --- about unloaded buffers.
    526 ---
    527 --- @param buffer integer Buffer id, or 0 for current buffer
    528 --- @return boolean # true if the buffer is valid and loaded, false otherwise.
    529 function vim.api.nvim_buf_is_loaded(buffer) end
    530 
    531 --- Checks if a buffer is valid.
    532 ---
    533 --- Note:
    534 --- Even if a buffer is valid it may have been unloaded. See |api-buffer|
    535 --- for more info about unloaded buffers.
    536 ---
    537 ---
    538 --- @param buffer integer Buffer id, or 0 for current buffer
    539 --- @return boolean # true if the buffer is valid, false otherwise.
    540 function vim.api.nvim_buf_is_valid(buffer) end
    541 
    542 --- Returns the number of lines in the given buffer.
    543 ---
    544 --- @param buffer integer Buffer id, or 0 for current buffer
    545 --- @return integer # Line count, or 0 for unloaded buffer. |api-buffer|
    546 function vim.api.nvim_buf_line_count(buffer) end
    547 
    548 --- Creates or updates an `extmark`.
    549 ---
    550 --- By default a new extmark is created when no id is passed in, but it is also
    551 --- possible to create a new mark by passing in a previously unused id or move
    552 --- an existing mark by passing in its id. The caller must then keep track of
    553 --- existing and unused ids itself. (Useful over RPC, to avoid waiting for the
    554 --- return value.)
    555 ---
    556 --- Using the optional arguments, it is possible to use this to highlight
    557 --- a range of text, and also to associate virtual text to the mark.
    558 ---
    559 --- If present, the position defined by `end_col` and `end_row` should be after
    560 --- the start position in order for the extmark to cover a range.
    561 --- An earlier end position is not an error, but then it behaves like an empty
    562 --- range (no highlighting).
    563 ---
    564 --- @param buffer integer Buffer id, or 0 for current buffer
    565 --- @param ns_id integer Namespace id from `nvim_create_namespace()`
    566 --- @param line integer Line where to place the mark, 0-based. `api-indexing`
    567 --- @param col integer Column where to place the mark, 0-based. `api-indexing`
    568 --- @param opts vim.api.keyset.set_extmark Optional parameters.
    569 --- - id : id of the extmark to edit.
    570 --- - end_row : ending line of the mark, 0-based inclusive.
    571 --- - end_col : ending col of the mark, 0-based exclusive.
    572 --- - hl_group : highlight group used for the text range. This and below
    573 ---     highlight groups can be supplied either as a string or as an integer,
    574 ---     the latter of which can be obtained using `nvim_get_hl_id_by_name()`.
    575 ---
    576 ---     Multiple highlight groups can be stacked by passing an array (highest
    577 ---     priority last).
    578 --- - hl_eol : when true, for a multiline highlight covering the
    579 ---            EOL of a line, continue the highlight for the rest
    580 ---            of the screen line (just like for diff and
    581 ---            cursorline highlight).
    582 --- - virt_text : [](virtual-text) to link to this mark.
    583 ---     A list of `[text, highlight]` tuples, each representing a
    584 ---     text chunk with specified highlight. `highlight` element
    585 ---     can either be a single highlight group, or an array of
    586 ---     multiple highlight groups that will be stacked
    587 ---     (highest priority last).
    588 --- - virt_text_pos : position of virtual text. Possible values:
    589 ---   - "eol": right after eol character (default).
    590 ---   - "eol_right_align": display right aligned in the window
    591 ---                        unless the virtual text is longer than
    592 ---                        the space available. If the virtual
    593 ---                        text is too long, it is truncated to
    594 ---                        fit in the window after the EOL
    595 ---                        character. If the line is wrapped, the
    596 ---                        virtual text is shown after the end of
    597 ---                        the line rather than the previous
    598 ---                        screen line.
    599 ---   - "overlay": display over the specified column, without
    600 ---                shifting the underlying text.
    601 ---   - "right_align": display right aligned in the window.
    602 ---   - "inline": display at the specified column, and
    603 ---               shift the buffer text to the right as needed.
    604 --- - virt_text_win_col : position the virtual text at a fixed
    605 ---                       window column (starting from the first
    606 ---                       text column of the screen line) instead
    607 ---                       of "virt_text_pos".
    608 --- - virt_text_hide : hide the virtual text when the background
    609 ---                    text is selected or hidden because of
    610 ---                    scrolling with 'nowrap' or 'smoothscroll'.
    611 ---                    Currently only affects "overlay" virt_text.
    612 --- - virt_text_repeat_linebreak : repeat the virtual text on
    613 ---                                wrapped lines.
    614 --- - hl_mode : control how highlights are combined with the
    615 ---             highlights of the text. Currently only affects
    616 ---             virt_text highlights, but might affect `hl_group`
    617 ---             in later versions.
    618 ---   - "replace": only show the virt_text color. This is the default.
    619 ---   - "combine": combine with background text color.
    620 ---   - "blend": blend with background text color.
    621 ---              Not supported for "inline" virt_text.
    622 ---
    623 --- - virt_lines : virtual lines to add next to this mark
    624 ---     This should be an array over lines, where each line in
    625 ---     turn is an array over `[text, highlight]` tuples. In
    626 ---     general, buffer and window options do not affect the
    627 ---     display of the text. In particular 'wrap'
    628 ---     and 'linebreak' options do not take effect, so
    629 ---     the number of extra screen lines will always match
    630 ---     the size of the array. However the 'tabstop' buffer
    631 ---     option is still used for hard tabs. By default lines are
    632 ---     placed below the buffer line containing the mark.
    633 ---
    634 --- - virt_lines_above: place virtual lines above instead.
    635 --- - virt_lines_leftcol: Place virtual lines in the leftmost
    636 ---                       column of the window, bypassing
    637 ---                       sign and number columns.
    638 --- - virt_lines_overflow: controls how to handle virtual lines wider
    639 ---     than the window. Currently takes the one of the following values:
    640 ---   - "trunc": truncate virtual lines on the right (default).
    641 ---   - "scroll": virtual lines can scroll horizontally with 'nowrap',
    642 ---      otherwise the same as "trunc".
    643 --- - ephemeral : for use with `nvim_set_decoration_provider()`
    644 ---     callbacks. The mark will only be used for the current
    645 ---     redraw cycle, and not be permanently stored in the buffer.
    646 --- - right_gravity : boolean that indicates the direction
    647 ---     the extmark will be shifted in when new text is inserted
    648 ---     (true for right, false for left). Defaults to true.
    649 --- - end_right_gravity : boolean that indicates the direction
    650 ---     the extmark end position (if it exists) will be shifted
    651 ---     in when new text is inserted (true for right, false
    652 ---     for left). Defaults to false.
    653 --- - undo_restore : Restore the exact position of the mark
    654 ---     if text around the mark was deleted and then restored by undo.
    655 ---     Defaults to true.
    656 --- - invalidate : boolean that indicates whether to hide the
    657 ---     extmark if the entirety of its range is deleted. For
    658 ---     hidden marks, an "invalid" key is added to the "details"
    659 ---     array of `nvim_buf_get_extmarks()` and family. If
    660 ---     "undo_restore" is false, the extmark is deleted instead.
    661 --- - priority: a priority value for the highlight group, sign
    662 ---     attribute or virtual text. For virtual text, item with
    663 ---     highest priority is drawn last. For example treesitter
    664 ---     highlighting uses a value of 100.
    665 --- - strict: boolean that indicates extmark should not be placed
    666 ---     if the line or column value is past the end of the
    667 ---     buffer or end of the line respectively. Defaults to true.
    668 --- - sign_text: string of length 1-2 used to display in the
    669 ---     sign column.
    670 --- - sign_hl_group: highlight group used for the sign column text.
    671 --- - number_hl_group: highlight group used for the number column.
    672 --- - line_hl_group: highlight group used for the whole line.
    673 --- - cursorline_hl_group: highlight group used for the sign
    674 ---     column text when the cursor is on the same line as the
    675 ---     mark and 'cursorline' is enabled.
    676 --- - conceal: string which should be either empty or a single
    677 ---     character. Enable concealing similar to `:syn-conceal`.
    678 ---     When a character is supplied it is used as `:syn-cchar`.
    679 ---     "hl_group" is used as highlight for the cchar if provided,
    680 ---     otherwise it defaults to `hl-Conceal`.
    681 --- - conceal_lines: string which should be empty. When
    682 ---     provided, lines in the range are not drawn at all
    683 ---     (according to 'conceallevel'); the next unconcealed line
    684 ---     is drawn instead.
    685 --- - spell: boolean indicating that spell checking should be
    686 ---     performed within this extmark
    687 --- - ui_watched: boolean that indicates the mark should be drawn
    688 ---     by a UI. When set, the UI will receive win_extmark events.
    689 ---     Note: the mark is positioned by virt_text attributes. Can be
    690 ---     used together with virt_text.
    691 --- - url: A URL to associate with this extmark. In the TUI, the OSC 8 control
    692 ---     sequence is used to generate a clickable hyperlink to this URL.
    693 --- @return integer # Id of the created/updated extmark
    694 function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
    695 
    696 --- Sets a buffer-local `mapping` for the given mode.
    697 ---
    698 ---
    699 --- @see vim.api.nvim_set_keymap
    700 --- @param buffer integer Buffer id, or 0 for current buffer
    701 --- @param mode string
    702 --- @param lhs string
    703 --- @param rhs string
    704 --- @param opts vim.api.keyset.keymap
    705 function vim.api.nvim_buf_set_keymap(buffer, mode, lhs, rhs, opts) end
    706 
    707 --- Sets (replaces) a line-range in the buffer.
    708 ---
    709 --- Indexing is zero-based, end-exclusive. Negative indices are interpreted
    710 --- as length+1+index: -1 refers to the index past the end. So to change
    711 --- or delete the last line use start=-2 and end=-1.
    712 ---
    713 --- To insert lines at a given index, set `start` and `end` to the same index.
    714 --- To delete a range of lines, set `replacement` to an empty array.
    715 ---
    716 --- Out-of-bounds indices are clamped to the nearest valid value, unless
    717 --- `strict_indexing` is set.
    718 ---
    719 ---
    720 --- @see vim.api.nvim_buf_set_text
    721 --- @param buffer integer Buffer id, or 0 for current buffer
    722 --- @param start integer First line index
    723 --- @param end_ integer Last line index, exclusive
    724 --- @param strict_indexing boolean Whether out-of-bounds should be an error.
    725 --- @param replacement string[] Array of lines to use as replacement
    726 function vim.api.nvim_buf_set_lines(buffer, start, end_, strict_indexing, replacement) end
    727 
    728 --- Sets a named mark in the given buffer, all marks are allowed
    729 --- file/uppercase, visual, last change, etc. See `mark-motions`.
    730 ---
    731 --- Marks are (1,0)-indexed. `api-indexing`
    732 ---
    733 --- Note:
    734 --- Passing 0 as line deletes the mark
    735 ---
    736 ---
    737 --- @see vim.api.nvim_buf_del_mark
    738 --- @see vim.api.nvim_buf_get_mark
    739 --- @param buffer integer Buffer to set the mark on
    740 --- @param name string Mark name
    741 --- @param line integer Line number
    742 --- @param col integer Column/row number
    743 --- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
    744 --- @return boolean # true if the mark was set, else false.
    745 function vim.api.nvim_buf_set_mark(buffer, name, line, col, opts) end
    746 
    747 --- Sets the full file name for a buffer, like `:file_f`
    748 ---
    749 --- @param buffer integer Buffer id, or 0 for current buffer
    750 --- @param name string Buffer name
    751 function vim.api.nvim_buf_set_name(buffer, name) end
    752 
    753 --- @deprecated
    754 --- @param buffer integer
    755 --- @param name string
    756 --- @param value any
    757 function vim.api.nvim_buf_set_option(buffer, name, value) end
    758 
    759 --- Sets (replaces) a range in the buffer
    760 ---
    761 --- This is recommended over `nvim_buf_set_lines()` when only modifying parts of
    762 --- a line, as extmarks will be preserved on non-modified parts of the touched
    763 --- lines.
    764 ---
    765 --- Indexing is zero-based. Row indices are end-inclusive, and column indices
    766 --- are end-exclusive.
    767 ---
    768 --- To insert text at a given `(row, column)` location, use `start_row = end_row
    769 --- = row` and `start_col = end_col = col`. To delete the text in a range, use
    770 --- `replacement = {}`.
    771 ---
    772 --- Note:
    773 --- Prefer |nvim_buf_set_lines()| (for performance) to add or delete entire lines.
    774 --- Prefer |nvim_paste()| or |nvim_put()| to insert (instead of replace) text at cursor.
    775 ---
    776 ---
    777 --- @param buffer integer Buffer id, or 0 for current buffer
    778 --- @param start_row integer First line index
    779 --- @param start_col integer Starting column (byte offset) on first line
    780 --- @param end_row integer Last line index, inclusive
    781 --- @param end_col integer Ending column (byte offset) on last line, exclusive
    782 --- @param replacement string[] Array of lines to use as replacement
    783 function vim.api.nvim_buf_set_text(buffer, start_row, start_col, end_row, end_col, replacement) end
    784 
    785 --- Sets a buffer-scoped (b:) variable
    786 ---
    787 --- @param buffer integer Buffer id, or 0 for current buffer
    788 --- @param name string Variable name
    789 --- @param value any Variable value
    790 function vim.api.nvim_buf_set_var(buffer, name, value) end
    791 
    792 --- @deprecated
    793 --- @param buffer integer
    794 --- @param src_id integer
    795 --- @param line integer
    796 --- @param chunks any[]
    797 --- @param opts vim.api.keyset.empty
    798 --- @return integer
    799 function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) end
    800 
    801 --- Calls a Vimscript `Dictionary-function` with the given arguments.
    802 ---
    803 --- On execution error: fails with Vimscript error, updates v:errmsg.
    804 ---
    805 --- @param dict any Dict, or String evaluating to a Vimscript `self` dict
    806 --- @param fn string Name of the function defined on the Vimscript dict
    807 --- @param args any[] Function arguments packed in an Array
    808 --- @return any # Result of the function call
    809 function vim.api.nvim_call_dict_function(dict, fn, args) end
    810 
    811 --- Calls a Vimscript function with the given arguments.
    812 ---
    813 --- On execution error: fails with Vimscript error, updates v:errmsg.
    814 ---
    815 --- @param fn string Function to call
    816 --- @param args any[] Function arguments packed in an Array
    817 --- @return any # Result of the function call
    818 function vim.api.nvim_call_function(fn, args) end
    819 
    820 --- Sends raw data to channel `chan`. `channel-bytes`
    821 --- - For a job, it writes it to the stdin of the process.
    822 --- - For the stdio channel `channel-stdio`, it writes to Nvim's stdout.
    823 --- - For an internal terminal instance (`nvim_open_term()`) it writes directly to terminal output.
    824 ---
    825 --- This function writes raw data, not RPC messages. Use `vim.rpcrequest()` and `vim.rpcnotify()` if
    826 --- the channel expects RPC messages (i.e. it was created with `rpc=true`).
    827 ---
    828 --- To write data to the `TUI` host terminal, see `nvim_ui_send()`.
    829 ---
    830 --- @param chan integer Channel id
    831 --- @param data string Data to write. 8-bit clean: may contain NUL bytes.
    832 function vim.api.nvim_chan_send(chan, data) end
    833 
    834 --- Clears all autocommands selected by {opts}. To delete autocmds see `nvim_del_autocmd()`.
    835 ---
    836 --- @param opts vim.api.keyset.clear_autocmds Parameters
    837 --- - event: (vim.api.keyset.events|vim.api.keyset.events[])
    838 ---      Examples:
    839 ---      - event: "pat1"
    840 ---      - event: { "pat1" }
    841 ---      - event: { "pat1", "pat2", "pat3" }
    842 --- - pattern: (string|table)
    843 ---     - pattern or patterns to match exactly.
    844 ---         - For example, if you have `*.py` as that pattern for the autocmd,
    845 ---           you must pass `*.py` exactly to clear it. `test.py` will not
    846 ---           match the pattern.
    847 ---     - defaults to clearing all patterns.
    848 ---     - NOTE: Cannot be used with {buffer}
    849 --- - buffer: (bufnr)
    850 ---     - clear only `autocmd-buflocal` autocommands.
    851 ---     - NOTE: Cannot be used with {pattern}
    852 --- - group: (string|int) The augroup name or id.
    853 ---     - NOTE: If not passed, will only delete autocmds *not* in any group.
    854 function vim.api.nvim_clear_autocmds(opts) end
    855 
    856 --- Executes an Ex command.
    857 ---
    858 --- Unlike `nvim_command()` this command takes a structured Dict instead of a String. This
    859 --- allows for easier construction and manipulation of an Ex command. This also allows for things
    860 --- such as having spaces inside a command argument, expanding filenames in a command that otherwise
    861 --- doesn't expand filenames, etc. Command arguments may also be Number, Boolean or String.
    862 ---
    863 --- The first argument may also be used instead of count for commands that support it in order to
    864 --- make their usage simpler with `vim.cmd()`. For example, instead of
    865 --- `vim.cmd.bdelete{ count = 2 }`, you may do `vim.cmd.bdelete(2)`.
    866 ---
    867 --- On execution error: fails with Vimscript error, updates v:errmsg.
    868 ---
    869 ---
    870 --- @see vim.api.nvim_exec2
    871 --- @see vim.api.nvim_command
    872 --- @param cmd vim.api.keyset.cmd Command to execute. Must be a Dict that can contain the same values as
    873 --- the return value of `nvim_parse_cmd()` except "addr", "nargs" and "nextcmd"
    874 --- which are ignored if provided. All values except for "cmd" are optional.
    875 --- @param opts vim.api.keyset.cmd_opts Optional parameters.
    876 --- - output: (boolean, default false) Whether to return command output.
    877 --- @return string # Command output (non-error, non-shell |:!|) if `output` is true, else empty string.
    878 function vim.api.nvim_cmd(cmd, opts) end
    879 
    880 --- Executes an Ex command.
    881 ---
    882 --- On execution error: fails with Vimscript error, updates v:errmsg.
    883 ---
    884 --- Prefer `nvim_cmd()` or `nvim_exec2()` instead. To modify an Ex command in a structured way
    885 --- before executing it, modify the result of `nvim_parse_cmd()` then pass it to `nvim_cmd()`.
    886 ---
    887 --- @param command string Ex command string
    888 function vim.api.nvim_command(command) end
    889 
    890 --- @deprecated
    891 --- @see vim.api.nvim_exec2
    892 --- @param command string
    893 --- @return string
    894 function vim.api.nvim_command_output(command) end
    895 
    896 --- Create or get an autocommand group `autocmd-groups`.
    897 ---
    898 --- To get an existing group id, do:
    899 ---
    900 --- ```lua
    901 --- local id = vim.api.nvim_create_augroup('my.lsp.config', {
    902 ---     clear = false
    903 --- })
    904 --- ```
    905 ---
    906 --- @see `:help autocmd-groups`
    907 --- @param name string String: The name of the group
    908 --- @param opts vim.api.keyset.create_augroup Dict Parameters
    909 --- - clear (bool) optional: defaults to true. Clear existing
    910 --- commands if the group already exists `autocmd-groups`.
    911 --- @return integer # Integer id of the created group.
    912 function vim.api.nvim_create_augroup(name, opts) end
    913 
    914 --- Creates an `autocommand` event handler, defined by `callback` (Lua function or Vimscript
    915 --- function _name_ string) or `command` (Ex command string).
    916 ---
    917 --- Example using Lua callback:
    918 ---
    919 --- ```lua
    920 --- vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
    921 ---   pattern = {'*.c', '*.h'},
    922 ---   callback = function(ev)
    923 ---     print(string.format('event fired: %s', vim.inspect(ev)))
    924 ---   end
    925 --- })
    926 --- ```
    927 ---
    928 --- Example using an Ex command as the handler:
    929 ---
    930 --- ```lua
    931 --- vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
    932 ---   pattern = {'*.c', '*.h'},
    933 ---   command = "echo 'Entering a C or C++ file'",
    934 --- })
    935 --- ```
    936 ---
    937 --- Note: `pattern` is NOT automatically expanded (unlike with `:autocmd`), thus names like "$HOME"
    938 --- and "~" must be expanded explicitly:
    939 ---
    940 --- ```lua
    941 --- pattern = vim.fn.expand('~') .. '/some/path/*.py'
    942 --- ```
    943 ---
    944 --- @see `:help autocommand`
    945 --- @see vim.api.nvim_del_autocmd
    946 --- @param event vim.api.keyset.events|vim.api.keyset.events[] Event(s) that will trigger the handler (`callback` or `command`).
    947 --- @param opts vim.api.keyset.create_autocmd Options dict:
    948 --- - group (string|integer) optional: autocommand group name or id to match against.
    949 --- - pattern (string|array) optional: pattern(s) to match literally `autocmd-pattern`.
    950 --- - buffer (integer) optional: buffer number for buffer-local autocommands
    951 --- `autocmd-buflocal`. Cannot be used with {pattern}.
    952 --- - desc (string) optional: description (for documentation and troubleshooting).
    953 --- - callback (function|string) optional: Lua function (or Vimscript function name, if
    954 --- string) called when the event(s) is triggered. Lua callback can return a truthy
    955 --- value (not `false` or `nil`) to delete the autocommand, and receives one argument, a
    956 --- table with these keys: [event-args]()
    957 ---     - id: (number) autocommand id
    958 ---     - event: (vim.api.keyset.events) name of the triggered event `autocmd-events`
    959 ---     - group: (number|nil) autocommand group id, if any
    960 ---     - file: (string) [<afile>] (not expanded to a full path)
    961 ---     - match: (string) [<amatch>] (expanded to a full path)
    962 ---     - buf: (number) [<abuf>]
    963 ---     - data: (any) arbitrary data passed from [nvim_exec_autocmds()] [event-data]()
    964 --- - command (string) optional: Vim command to execute on event. Cannot be used with
    965 --- {callback}
    966 --- - once (boolean) optional: defaults to false. Run the autocommand
    967 --- only once `autocmd-once`.
    968 --- - nested (boolean) optional: defaults to false. Run nested
    969 --- autocommands `autocmd-nested`.
    970 --- @return integer # Autocommand id (number)
    971 function vim.api.nvim_create_autocmd(event, opts) end
    972 
    973 --- Creates a new, empty, unnamed buffer.
    974 ---
    975 --- @see buf_open_scratch
    976 --- @param listed boolean Sets 'buflisted'
    977 --- @param scratch boolean Creates a "throwaway" `scratch-buffer` for temporary work
    978 --- (always 'nomodified'). Also sets 'nomodeline' on the buffer.
    979 --- @return integer # Buffer id, or 0 on error
    980 ---
    981 function vim.api.nvim_create_buf(listed, scratch) end
    982 
    983 --- Creates a new namespace or gets an existing one. [namespace]()
    984 ---
    985 --- Namespaces are used for buffer highlights and virtual text, see
    986 --- `nvim_buf_set_extmark()`.
    987 ---
    988 --- Namespaces can be named or anonymous. If `name` matches an existing
    989 --- namespace, the associated id is returned. If `name` is an empty string
    990 --- a new, anonymous namespace is created.
    991 ---
    992 --- @param name string Namespace name or empty string
    993 --- @return integer # Namespace id
    994 function vim.api.nvim_create_namespace(name) end
    995 
    996 --- Creates a global `user-commands` command.
    997 ---
    998 --- For Lua usage see `lua-guide-commands-create`.
    999 ---
   1000 --- Example:
   1001 ---
   1002 --- ```vim
   1003 --- :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true})
   1004 --- :SayHello
   1005 --- Hello world!
   1006 --- ```
   1007 ---
   1008 --- @param name string Name of the new user command. Must begin with an uppercase letter.
   1009 --- @param command string|fun(args: vim.api.keyset.create_user_command.command_args) Replacement command to execute when this user command is executed. When called
   1010 --- from Lua, the command can also be a Lua function. The function is called with a
   1011 --- single table argument that contains the following keys:
   1012 --- - name: (string) Command name
   1013 --- - args: (string) The args passed to the command, if any [<args>]
   1014 --- - fargs: (table) The args split by unescaped whitespace (when more than one
   1015 --- argument is allowed), if any [<f-args>]
   1016 --- - nargs: (string) Number of arguments `:command-nargs`
   1017 --- - bang: (boolean) "true" if the command was executed with a ! modifier [<bang>]
   1018 --- - line1: (number) The starting line of the command range [<line1>]
   1019 --- - line2: (number) The final line of the command range [<line2>]
   1020 --- - range: (number) The number of items in the command range: 0, 1, or 2 [<range>]
   1021 --- - count: (number) Any count supplied [<count>]
   1022 --- - reg: (string) The optional register, if specified [<reg>]
   1023 --- - mods: (string) Command modifiers, if any [<mods>]
   1024 --- - smods: (table) Command modifiers in a structured format. Has the same
   1025 --- structure as the "mods" key of `nvim_parse_cmd()`.
   1026 --- @param opts vim.api.keyset.user_command Optional flags
   1027 --- - `desc` (string) Command description.
   1028 --- - `force` (boolean, default true) Override any previous definition.
   1029 --- - `complete` `:command-complete` command or function like `:command-completion-customlist`.
   1030 --- - `preview` (function) Preview handler for 'inccommand' `:command-preview`
   1031 --- - Set boolean `command-attributes` such as `:command-bang` or `:command-bar` to
   1032 ---   true (but not `:command-buffer`, use `nvim_buf_create_user_command()` instead).
   1033 function vim.api.nvim_create_user_command(name, command, opts) end
   1034 
   1035 --- Delete an autocommand group by id.
   1036 ---
   1037 --- To get a group id one can use `nvim_get_autocmds()`.
   1038 ---
   1039 --- NOTE: behavior differs from `:augroup-delete`. When deleting a group, autocommands contained in
   1040 --- this group will also be deleted and cleared. This group will no longer exist.
   1041 --- @see vim.api.nvim_del_augroup_by_name
   1042 --- @see vim.api.nvim_create_augroup
   1043 --- @param id integer Integer The id of the group.
   1044 function vim.api.nvim_del_augroup_by_id(id) end
   1045 
   1046 --- Delete an autocommand group by name.
   1047 ---
   1048 --- NOTE: behavior differs from `:augroup-delete`. When deleting a group, autocommands contained in
   1049 --- this group will also be deleted and cleared. This group will no longer exist.
   1050 --- @see `:help autocmd-groups`
   1051 --- @param name string String The name of the group.
   1052 function vim.api.nvim_del_augroup_by_name(name) end
   1053 
   1054 --- Deletes an autocommand by id.
   1055 ---
   1056 --- @param id integer Integer Autocommand id returned by `nvim_create_autocmd()`
   1057 function vim.api.nvim_del_autocmd(id) end
   1058 
   1059 --- Deletes the current line.
   1060 ---
   1061 function vim.api.nvim_del_current_line() end
   1062 
   1063 --- Unmaps a global `mapping` for the given mode.
   1064 ---
   1065 --- To unmap a buffer-local mapping, use `nvim_buf_del_keymap()`.
   1066 ---
   1067 --- @see vim.api.nvim_set_keymap
   1068 --- @param mode string
   1069 --- @param lhs string
   1070 function vim.api.nvim_del_keymap(mode, lhs) end
   1071 
   1072 --- Deletes an uppercase/file named mark. See `mark-motions`.
   1073 ---
   1074 --- Note:
   1075 --- Lowercase name (or other buffer-local mark) is an error.
   1076 ---
   1077 --- @see vim.api.nvim_buf_del_mark
   1078 --- @see vim.api.nvim_get_mark
   1079 --- @param name string Mark name
   1080 --- @return boolean # true if the mark was deleted, else false.
   1081 function vim.api.nvim_del_mark(name) end
   1082 
   1083 --- Delete a user-defined command.
   1084 ---
   1085 --- @param name string Name of the command to delete.
   1086 function vim.api.nvim_del_user_command(name) end
   1087 
   1088 --- Removes a global (g:) variable.
   1089 ---
   1090 --- @param name string Variable name
   1091 function vim.api.nvim_del_var(name) end
   1092 
   1093 --- Prints a message given by a list of `[text, hl_group]` "chunks".
   1094 ---
   1095 --- Example:
   1096 --- ```lua
   1097 --- vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {})
   1098 --- ```
   1099 ---
   1100 --- @param chunks [string, integer|string?][] List of `[text, hl_group]` pairs, where each is a `text` string highlighted by
   1101 --- the (optional) name or ID `hl_group`.
   1102 --- @param history boolean if true, add to `message-history`.
   1103 --- @param opts vim.api.keyset.echo_opts Optional parameters.
   1104 --- - id: message id for updating existing message.
   1105 --- - err: Treat the message like `:echoerr`. Sets `hl_group` to `hl-ErrorMsg` by default.
   1106 --- - kind: Set the `ui-messages` kind with which this message will be emitted.
   1107 --- - verbose: Message is controlled by the 'verbose' option. Nvim invoked with `-V3log`
   1108 ---   will write the message to the "log" file instead of standard output.
   1109 --- - title: The title for `progress-message`.
   1110 --- - status: Current status of the `progress-message`. Can be
   1111 ---   one of the following values
   1112 ---   - success: The progress item completed successfully
   1113 ---   - running: The progress is ongoing
   1114 ---   - failed: The progress item failed
   1115 ---   - cancel: The progressing process should be canceled. NOTE: Cancel must be handled by
   1116 ---     progress initiator by listening for the `Progress` event
   1117 --- - percent: How much progress is done on the progress message
   1118 --- - data: dictionary containing additional information
   1119 --- @return integer|string # Message id.
   1120 --- - -1 means nvim_echo didn't show a message
   1121 function vim.api.nvim_echo(chunks, history, opts) end
   1122 
   1123 --- @deprecated
   1124 --- @param str string
   1125 function vim.api.nvim_err_write(str) end
   1126 
   1127 --- @deprecated
   1128 --- @param str string
   1129 function vim.api.nvim_err_writeln(str) end
   1130 
   1131 --- Evaluates a Vimscript `expression`. Dicts and Lists are recursively expanded.
   1132 ---
   1133 --- On execution error: fails with Vimscript error, updates v:errmsg.
   1134 ---
   1135 --- @param expr string Vimscript expression string
   1136 --- @return any # Evaluation result or expanded object
   1137 function vim.api.nvim_eval(expr) end
   1138 
   1139 --- Evaluates statusline string.
   1140 ---
   1141 --- @param str string Statusline string (see 'statusline').
   1142 --- @param opts vim.api.keyset.eval_statusline Optional parameters.
   1143 --- - winid: (number) `window-ID` of the window to use as context for statusline.
   1144 --- - maxwidth: (number) Maximum width of statusline.
   1145 --- - fillchar: (string) Character to fill blank spaces in the statusline (see
   1146 ---                      'fillchars'). Treated as single-width even if it isn't.
   1147 --- - highlights: (boolean) Return highlight information.
   1148 --- - use_winbar: (boolean) Evaluate winbar instead of statusline.
   1149 --- - use_tabline: (boolean) Evaluate tabline instead of statusline. When true, {winid}
   1150 ---                          is ignored. Mutually exclusive with {use_winbar}.
   1151 --- - use_statuscol_lnum: (number) Evaluate statuscolumn for this line number instead of statusline.
   1152 --- @return vim.api.keyset.eval_statusline_ret # Dict containing statusline information, with these keys:
   1153 --- - str: (string) Characters that will be displayed on the statusline.
   1154 --- - width: (number) Display width of the statusline.
   1155 --- - highlights: Array containing highlight information of the statusline. Only included when
   1156 ---               the "highlights" key in {opts} is true. Each element of the array is a
   1157 ---               |Dict| with these keys:
   1158 ---     - start: (number) Byte index (0-based) of first character that uses the highlight.
   1159 ---     - group: (string) Deprecated. Use `groups` instead.
   1160 ---     - groups: (array) Names of stacked highlight groups (highest priority last).
   1161 function vim.api.nvim_eval_statusline(str, opts) end
   1162 
   1163 --- @deprecated
   1164 --- @see vim.api.nvim_exec2
   1165 --- @param src string
   1166 --- @param output boolean
   1167 --- @return string
   1168 function vim.api.nvim_exec(src, output) end
   1169 
   1170 --- Executes Vimscript (multiline block of Ex commands), like anonymous
   1171 --- `:source`.
   1172 ---
   1173 --- Unlike `nvim_command()` this function supports heredocs, script-scope (s:),
   1174 --- etc.
   1175 ---
   1176 --- On execution error: fails with Vimscript error, updates v:errmsg.
   1177 ---
   1178 ---
   1179 --- @see `:help execute()`
   1180 --- @see vim.api.nvim_command
   1181 --- @see vim.api.nvim_cmd
   1182 --- @param src string Vimscript code
   1183 --- @param opts vim.api.keyset.exec_opts Optional parameters.
   1184 --- - output: (boolean, default false) Whether to capture and return
   1185 ---           all (non-error, non-shell `:!`) output.
   1186 --- @return table<string,any> # Dict containing information about execution, with these keys:
   1187 --- - output: (string|nil) Output if `opts.output` is true.
   1188 function vim.api.nvim_exec2(src, opts) end
   1189 
   1190 --- Execute all autocommands for {event} that match the corresponding
   1191 ---  {opts} `autocmd-execute`.
   1192 --- @see `:help :doautocmd`
   1193 --- @param event vim.api.keyset.events|vim.api.keyset.events[] The event or events to execute
   1194 --- @param opts vim.api.keyset.exec_autocmds Dict of autocommand options:
   1195 --- - group (string|integer) optional: the autocommand group name or
   1196 --- id to match against. `autocmd-groups`.
   1197 --- - pattern (string|array) optional: defaults to "*" `autocmd-pattern`. Cannot be used
   1198 --- with {buffer}.
   1199 --- - buffer (integer) optional: buffer number `autocmd-buflocal`. Cannot be used with
   1200 --- {pattern}.
   1201 --- - modeline (bool) optional: defaults to true. Process the
   1202 --- modeline after the autocommands [<nomodeline>].
   1203 --- - data (any): arbitrary data to send to the autocommand callback. See
   1204 --- `nvim_create_autocmd()` for details.
   1205 function vim.api.nvim_exec_autocmds(event, opts) end
   1206 
   1207 --- Sends input-keys to Nvim, subject to various quirks controlled by `mode`
   1208 --- flags. This is a blocking call, unlike `nvim_input()`.
   1209 ---
   1210 --- On execution error: does not fail, but updates v:errmsg.
   1211 ---
   1212 --- To input sequences like [<C-o>] use `nvim_replace_termcodes()` (typically
   1213 --- with escape_ks=false) to replace `keycodes`, then pass the result to
   1214 --- nvim_feedkeys().
   1215 ---
   1216 --- Example:
   1217 ---
   1218 --- ```vim
   1219 --- :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
   1220 --- :call nvim_feedkeys(key, 'n', v:false)
   1221 --- ```
   1222 ---
   1223 --- @see feedkeys()
   1224 --- @see vim_strsave_escape_ks
   1225 --- @param keys string to be typed
   1226 --- @param mode string behavior flags, see `feedkeys()`
   1227 --- @param escape_ks boolean If true, escape K_SPECIAL bytes in `keys`.
   1228 --- This should be false if you already used
   1229 --- `nvim_replace_termcodes()`, and true otherwise.
   1230 function vim.api.nvim_feedkeys(keys, mode, escape_ks) end
   1231 
   1232 --- Gets the option information for all options.
   1233 ---
   1234 --- The dict has the full option names as keys and option metadata dicts as detailed at
   1235 --- `nvim_get_option_info2()`.
   1236 ---
   1237 ---
   1238 --- @see vim.api.nvim_get_commands
   1239 --- @return table<string,any> # dict of all options
   1240 function vim.api.nvim_get_all_options_info() end
   1241 
   1242 --- Get all autocommands that match the corresponding {opts}.
   1243 ---
   1244 --- These examples will get autocommands matching ALL the given criteria:
   1245 ---
   1246 --- ```lua
   1247 --- -- Matches all criteria
   1248 --- autocommands = vim.api.nvim_get_autocmds({
   1249 ---   group = 'MyGroup',
   1250 ---   event = {'BufEnter', 'BufWinEnter'},
   1251 ---   pattern = {'*.c', '*.h'}
   1252 --- })
   1253 ---
   1254 --- -- All commands from one group
   1255 --- autocommands = vim.api.nvim_get_autocmds({
   1256 ---   group = 'MyGroup',
   1257 --- })
   1258 --- ```
   1259 ---
   1260 --- NOTE: When multiple patterns or events are provided, it will find all the autocommands that
   1261 --- match any combination of them.
   1262 ---
   1263 --- @param opts vim.api.keyset.get_autocmds Dict with at least one of the following:
   1264 --- - buffer: (integer) Buffer number or list of buffer numbers for buffer local autocommands
   1265 --- `autocmd-buflocal`. Cannot be used with {pattern}
   1266 --- - event: (vim.api.keyset.events|vim.api.keyset.events[])
   1267 ---   event or events to match against `autocmd-events`.
   1268 --- - id: (integer) Autocommand ID to match.
   1269 --- - group: (string|table) the autocommand group name or id to match against.
   1270 --- - pattern: (string|table) pattern or patterns to match against `autocmd-pattern`.
   1271 --- Cannot be used with {buffer}
   1272 --- @return vim.api.keyset.get_autocmds.ret[] # Array of autocommands matching the criteria, with each item
   1273 --- containing the following fields:
   1274 --- - buffer: (integer) the buffer number.
   1275 --- - buflocal: (boolean) true if the autocommand is buffer local.
   1276 --- - command: (string) the autocommand command. Note: this will be empty if a callback is set.
   1277 --- - callback: (function|string|nil): Lua function or name of a Vim script function
   1278 ---   which is executed when this autocommand is triggered.
   1279 --- - desc: (string) the autocommand description.
   1280 --- - event: (vim.api.keyset.events) the autocommand event.
   1281 --- - id: (integer) the autocommand id (only when defined with the API).
   1282 --- - group: (integer) the autocommand group id.
   1283 --- - group_name: (string) the autocommand group name.
   1284 --- - once: (boolean) whether the autocommand is only run once.
   1285 --- - pattern: (string) the autocommand pattern.
   1286 ---   If the autocommand is buffer local |autocmd-buffer-local|:
   1287 function vim.api.nvim_get_autocmds(opts) end
   1288 
   1289 --- Gets information about a channel.
   1290 ---
   1291 --- See `nvim_list_uis()` for an example of how to get channel info.
   1292 ---
   1293 --- @param chan integer channel_id, or 0 for current channel
   1294 --- @return table<string,any> # Channel info dict with these keys:
   1295 --- - "id"       Channel id.
   1296 --- - "argv"     (optional) Job arguments list.
   1297 --- - "stream"   Stream underlying the channel.
   1298 ---      - "stdio"      stdin and stdout of this Nvim instance
   1299 ---      - "stderr"     stderr of this Nvim instance
   1300 ---      - "socket"     TCP/IP socket or named pipe
   1301 ---      - "job"        Job with communication over its stdio.
   1302 --- -  "mode"    How data received on the channel is interpreted.
   1303 ---      - "bytes"      Send and receive raw bytes.
   1304 ---      - "terminal"   |terminal| instance interprets ASCII sequences.
   1305 ---      - "rpc"        |RPC| communication on the channel is active.
   1306 --- -  "pty"     (optional) Name of pseudoterminal. On a POSIX system this is a device path like
   1307 ---              "/dev/pts/1". If unknown, the key will still be present if a pty is used (e.g.
   1308 ---              for conpty on Windows).
   1309 --- -  "buffer"  (optional) Buffer connected to |terminal| instance.
   1310 --- -  "client"  (optional) Info about the peer (client on the other end of the channel), as set
   1311 ---              by |nvim_set_client_info()|.
   1312 ---
   1313 function vim.api.nvim_get_chan_info(chan) end
   1314 
   1315 --- Returns the 24-bit RGB value of a `nvim_get_color_map()` color name or
   1316 --- "#rrggbb" hexadecimal string.
   1317 ---
   1318 --- Example:
   1319 ---
   1320 --- ```vim
   1321 --- :echo nvim_get_color_by_name("Pink")
   1322 --- :echo nvim_get_color_by_name("#cbcbcb")
   1323 --- ```
   1324 ---
   1325 --- @param name string Color name or "#rrggbb" string
   1326 --- @return integer # 24-bit RGB value, or -1 for invalid argument.
   1327 function vim.api.nvim_get_color_by_name(name) end
   1328 
   1329 --- Returns a map of color names and RGB values.
   1330 ---
   1331 --- Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
   1332 --- (e.g. 65535).
   1333 ---
   1334 --- @return table<string,integer> # Map of color names and RGB values.
   1335 function vim.api.nvim_get_color_map() end
   1336 
   1337 --- Gets a map of global (non-buffer-local) Ex commands.
   1338 ---
   1339 --- Currently only `user-commands` are supported, not builtin Ex commands.
   1340 ---
   1341 ---
   1342 --- @see vim.api.nvim_get_all_options_info
   1343 --- @param opts vim.api.keyset.get_commands Optional parameters. Currently only supports
   1344 --- {"builtin":false}
   1345 --- @return table<string,vim.api.keyset.command_info> # Map of maps describing commands.
   1346 function vim.api.nvim_get_commands(opts) end
   1347 
   1348 --- Gets a map of the current editor state.
   1349 ---
   1350 --- @param opts vim.api.keyset.context Optional parameters.
   1351 --- - types:  List of `context-types` ("regs", "jumps", "bufs",
   1352 ---   "gvars", …) to gather, or empty for "all".
   1353 --- @return table<string,any> # map of global |context|.
   1354 function vim.api.nvim_get_context(opts) end
   1355 
   1356 --- Gets the current buffer.
   1357 ---
   1358 --- @return integer # Buffer id
   1359 function vim.api.nvim_get_current_buf() end
   1360 
   1361 --- Gets the current line.
   1362 ---
   1363 --- @return string # Current line string
   1364 function vim.api.nvim_get_current_line() end
   1365 
   1366 --- Gets the current tabpage.
   1367 ---
   1368 --- @return integer # |tab-ID|
   1369 function vim.api.nvim_get_current_tabpage() end
   1370 
   1371 --- Gets the current window.
   1372 ---
   1373 --- @return integer # |window-ID|
   1374 function vim.api.nvim_get_current_win() end
   1375 
   1376 --- Gets all or specific highlight groups in a namespace.
   1377 ---
   1378 --- Note:
   1379 --- When the `link` attribute is defined in the highlight definition
   1380 --- map, other attributes will not be taking effect (see |:hi-link|).
   1381 ---
   1382 ---
   1383 --- @param ns_id integer Get highlight groups for namespace ns_id `nvim_get_namespaces()`.
   1384 --- Use 0 to get global highlight groups `:highlight`.
   1385 --- @param opts vim.api.keyset.get_highlight Options dict:
   1386 --- - name: (string) Get a highlight definition by name.
   1387 --- - id: (integer) Get a highlight definition by id.
   1388 --- - link: (boolean, default true) Show linked group name instead of effective definition `:hi-link`.
   1389 --- - create: (boolean, default true) When highlight group doesn't exist create it.
   1390 --- @return vim.api.keyset.get_hl_info # Highlight groups as a map from group name to a highlight definition map as in |nvim_set_hl()|,
   1391 --- or only a single highlight definition map if requested by name or id.
   1392 function vim.api.nvim_get_hl(ns_id, opts) end
   1393 
   1394 --- @deprecated
   1395 --- @see vim.api.nvim_get_hl_by_name
   1396 --- @param hl_id integer
   1397 --- @param rgb boolean
   1398 --- @return table<string,any>
   1399 function vim.api.nvim_get_hl_by_id(hl_id, rgb) end
   1400 
   1401 --- @deprecated
   1402 --- @see vim.api.nvim_get_hl_by_id
   1403 --- @param name string
   1404 --- @param rgb boolean
   1405 --- @return table<string,any>
   1406 function vim.api.nvim_get_hl_by_name(name, rgb) end
   1407 
   1408 --- Gets a highlight group by name
   1409 ---
   1410 --- similar to `hlID()`, but allocates a new ID if not present.
   1411 --- @param name string
   1412 --- @return integer
   1413 function vim.api.nvim_get_hl_id_by_name(name) end
   1414 
   1415 --- Gets the active highlight namespace.
   1416 ---
   1417 --- @param opts vim.api.keyset.get_ns Optional parameters
   1418 --- - winid: (number) `window-ID` for retrieving a window's highlight
   1419 ---   namespace. A value of -1 is returned when `nvim_win_set_hl_ns()`
   1420 ---   has not been called for the window (or was called with a namespace
   1421 ---   of -1).
   1422 --- @return integer # Namespace id, or -1
   1423 function vim.api.nvim_get_hl_ns(opts) end
   1424 
   1425 --- Gets a list of global (non-buffer-local) `mapping` definitions.
   1426 ---
   1427 --- @param mode string Mode short-name ("n", "i", "v", ...)
   1428 --- @return vim.api.keyset.get_keymap[] # Array of |maparg()|-like dictionaries describing mappings.
   1429 --- The "buffer" key is always zero.
   1430 function vim.api.nvim_get_keymap(mode) end
   1431 
   1432 --- Returns a `(row, col, buffer, buffername)` tuple representing the position
   1433 --- of the uppercase/file named mark. "End of line" column position is returned
   1434 --- as `v:maxcol` (big number). See `mark-motions`.
   1435 ---
   1436 --- Marks are (1,0)-indexed. `api-indexing`
   1437 ---
   1438 --- Note:
   1439 --- Lowercase name (or other buffer-local mark) is an error.
   1440 ---
   1441 --- @see vim.api.nvim_buf_set_mark
   1442 --- @see vim.api.nvim_del_mark
   1443 --- @param name string Mark name
   1444 --- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
   1445 --- @return [integer, integer, integer, string] # 4-tuple (row, col, buffer, buffername), (0, 0, 0, '') if the mark is
   1446 --- not set.
   1447 function vim.api.nvim_get_mark(name, opts) end
   1448 
   1449 --- Gets the current mode. `mode()`
   1450 --- "blocking" is true if Nvim is waiting for input.
   1451 ---
   1452 --- @return vim.api.keyset.get_mode # Dict { "mode": String, "blocking": Boolean }
   1453 function vim.api.nvim_get_mode() end
   1454 
   1455 --- Gets existing, non-anonymous `namespace`s.
   1456 ---
   1457 --- @return table<string,integer> # dict that maps from names to namespace ids.
   1458 function vim.api.nvim_get_namespaces() end
   1459 
   1460 --- @deprecated
   1461 --- @param name string
   1462 --- @return any
   1463 function vim.api.nvim_get_option(name) end
   1464 
   1465 --- @deprecated
   1466 --- @param name string
   1467 --- @return vim.api.keyset.get_option_info
   1468 function vim.api.nvim_get_option_info(name) end
   1469 
   1470 --- Gets the option information for one option from arbitrary buffer or window
   1471 ---
   1472 --- Resulting dict has keys:
   1473 --- - name: Name of the option (like 'filetype')
   1474 --- - shortname: Shortened name of the option (like 'ft')
   1475 --- - type: type of option ("string", "number" or "boolean")
   1476 --- - default: The default value for the option
   1477 --- - was_set: Whether the option was set.
   1478 ---
   1479 --- - last_set_sid: Last set script id (if any)
   1480 --- - last_set_linenr: line number where option was set
   1481 --- - last_set_chan: Channel where option was set (0 for local)
   1482 ---
   1483 --- - scope: one of "global", "win", or "buf"
   1484 --- - global_local: whether win or buf option has a global value
   1485 ---
   1486 --- - commalist: List of comma separated values
   1487 --- - flaglist: List of single char flags
   1488 ---
   1489 --- When {scope} is not provided, the last set information applies to the local
   1490 --- value in the current buffer or window if it is available, otherwise the
   1491 --- global value information is returned. This behavior can be disabled by
   1492 --- explicitly specifying {scope} in the {opts} table.
   1493 ---
   1494 --- @param name string Option name
   1495 --- @param opts vim.api.keyset.option Optional parameters
   1496 --- - scope: One of "global" or "local". Analogous to
   1497 --- `:setglobal` and `:setlocal`, respectively.
   1498 --- - win: `window-ID`. Used for getting window local options.
   1499 --- - buf: Buffer number. Used for getting buffer local options.
   1500 ---        Implies {scope} is "local".
   1501 --- @return vim.api.keyset.get_option_info # Option Information
   1502 function vim.api.nvim_get_option_info2(name, opts) end
   1503 
   1504 --- Gets the value of an option. The behavior of this function matches that of
   1505 --- `:set`: the local value of an option is returned if it exists; otherwise,
   1506 --- the global value is returned. Local values always correspond to the current
   1507 --- buffer or window, unless "buf" or "win" is set in {opts}.
   1508 ---
   1509 --- @param name string Option name
   1510 --- @param opts vim.api.keyset.option Optional parameters
   1511 --- - scope: One of "global" or "local". Analogous to
   1512 --- `:setglobal` and `:setlocal`, respectively.
   1513 --- - win: `window-ID`. Used for getting window local options.
   1514 --- - buf: Buffer number. Used for getting buffer local options.
   1515 ---        Implies {scope} is "local".
   1516 --- - filetype: `filetype`. Used to get the default option for a
   1517 ---   specific filetype. Cannot be used with any other option.
   1518 ---   Note: this will trigger `ftplugin` and all `FileType`
   1519 ---   autocommands for the corresponding filetype.
   1520 --- @return any # Option value
   1521 function vim.api.nvim_get_option_value(name, opts) end
   1522 
   1523 --- Gets info describing process `pid`.
   1524 ---
   1525 --- @param pid integer
   1526 --- @return any # Map of process properties, or NIL if process not found.
   1527 function vim.api.nvim_get_proc(pid) end
   1528 
   1529 --- Gets the immediate children of process `pid`.
   1530 ---
   1531 --- @param pid integer
   1532 --- @return any[] # Array of child process ids, empty if process not found.
   1533 function vim.api.nvim_get_proc_children(pid) end
   1534 
   1535 --- Finds files in runtime directories, in 'runtimepath' order.
   1536 ---
   1537 --- "name" can contain wildcards. For example
   1538 --- `nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color
   1539 --- scheme files. Always use forward slashes (/) in the search pattern for
   1540 --- subdirectories regardless of platform.
   1541 ---
   1542 --- It is not an error to not find any files. An empty array is returned then.
   1543 ---
   1544 --- @param name string pattern of files to search for
   1545 --- @param all boolean whether to return all matches or only the first
   1546 --- @return string[] # list of absolute paths to the found files
   1547 function vim.api.nvim_get_runtime_file(name, all) end
   1548 
   1549 --- Gets a global (g:) variable.
   1550 ---
   1551 --- @param name string Variable name
   1552 --- @return any # Variable value
   1553 function vim.api.nvim_get_var(name) end
   1554 
   1555 --- Gets a v: variable.
   1556 ---
   1557 --- @param name string Variable name
   1558 --- @return any # Variable value
   1559 function vim.api.nvim_get_vvar(name) end
   1560 
   1561 --- Queues raw user-input. Unlike `nvim_feedkeys()`, this uses a low-level input buffer and the call
   1562 --- is non-blocking (input is processed asynchronously by the eventloop).
   1563 ---
   1564 --- To input blocks of text, `nvim_paste()` is much faster and should be preferred.
   1565 ---
   1566 --- On execution error: does not fail, but updates v:errmsg.
   1567 ---
   1568 --- Note:
   1569 --- |keycodes| like [<CR>] are translated, so "<" is special.
   1570 --- To input a literal "<", send [<LT>].
   1571 ---
   1572 --- For mouse events use |nvim_input_mouse()|. The pseudokey form
   1573 --- `<LeftMouse><col,row>` is deprecated since |api-level| 6.
   1574 ---
   1575 ---
   1576 --- @param keys string to be typed
   1577 --- @return integer # Number of bytes actually written (can be fewer than
   1578 --- requested if the buffer becomes full).
   1579 function vim.api.nvim_input(keys) end
   1580 
   1581 --- Send mouse event from GUI.
   1582 ---
   1583 --- Non-blocking: does not wait on any result, but queues the event to be
   1584 --- processed soon by the event loop.
   1585 ---
   1586 --- Note:
   1587 --- Currently this doesn't support "scripting" multiple mouse events
   1588 --- by calling it multiple times in a loop: the intermediate mouse
   1589 --- positions will be ignored. It should be used to implement real-time
   1590 --- mouse input in a GUI. The deprecated pseudokey form
   1591 --- (`<LeftMouse><col,row>`) of |nvim_input()| has the same limitation.
   1592 ---
   1593 ---
   1594 --- @param button string Mouse button: one of "left", "right", "middle", "wheel", "move",
   1595 --- "x1", "x2".
   1596 --- @param action string For ordinary buttons, one of "press", "drag", "release".
   1597 --- For the wheel, one of "up", "down", "left", "right". Ignored for "move".
   1598 --- @param modifier string String of modifiers each represented by a single char.
   1599 --- The same specifiers are used as for a key press, except
   1600 --- that the "-" separator is optional, so "C-A-", "c-a"
   1601 --- and "CA" can all be used to specify Ctrl+Alt+click.
   1602 --- @param grid integer Grid number (used by `ui-multigrid` client), or 0 to let Nvim decide positioning of
   1603 --- windows. For more information, see [dev-ui-multigrid]
   1604 --- @param row integer Mouse row-position (zero-based, like redraw events)
   1605 --- @param col integer Mouse column-position (zero-based, like redraw events)
   1606 function vim.api.nvim_input_mouse(button, action, modifier, grid, row, col) end
   1607 
   1608 --- Gets the current list of buffers.
   1609 ---
   1610 --- Includes unlisted (unloaded/deleted) buffers, like `:ls!`.
   1611 --- Use `nvim_buf_is_loaded()` to check if a buffer is loaded.
   1612 ---
   1613 --- @return integer[] # List of buffer ids
   1614 function vim.api.nvim_list_bufs() end
   1615 
   1616 --- Get information about all open channels.
   1617 ---
   1618 --- @return table<string,any>[] # Array of Dictionaries, each describing a channel with
   1619 --- the format specified at |nvim_get_chan_info()|.
   1620 function vim.api.nvim_list_chans() end
   1621 
   1622 --- Gets the paths contained in `runtime-search-path`.
   1623 ---
   1624 --- @return string[] # List of paths
   1625 function vim.api.nvim_list_runtime_paths() end
   1626 
   1627 --- Gets the current list of `tab-ID`s.
   1628 ---
   1629 --- @return integer[] # List of |tab-ID|s
   1630 function vim.api.nvim_list_tabpages() end
   1631 
   1632 --- Gets a list of dictionaries representing attached UIs.
   1633 ---
   1634 --- Example: The Nvim builtin `TUI` sets its channel info as described in `startup-tui`. In
   1635 --- particular, it sets `client.name` to "nvim-tui". So you can check if the TUI is running by
   1636 --- inspecting the client name of each UI:
   1637 ---
   1638 --- ```lua
   1639 --- vim.print(vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan).client.name)
   1640 --- ```
   1641 ---
   1642 --- @return table<string,any>[] # Array of UI dictionaries, each with these keys:
   1643 --- - "height"  Requested height of the UI
   1644 --- - "width"   Requested width of the UI
   1645 --- - "rgb"     true if the UI uses RGB colors (false implies |cterm-colors|)
   1646 --- - "ext_..." Requested UI extensions, see |ui-option|
   1647 --- - "chan"    |channel-id| of remote UI
   1648 function vim.api.nvim_list_uis() end
   1649 
   1650 --- Gets the current list of all `window-ID`s in all tabpages.
   1651 ---
   1652 --- @return integer[] # List of |window-ID|s
   1653 function vim.api.nvim_list_wins() end
   1654 
   1655 --- Sets the current editor state from the given `context` map.
   1656 ---
   1657 --- @param dict table<string,any> `Context` map.
   1658 --- @return any
   1659 function vim.api.nvim_load_context(dict) end
   1660 
   1661 --- @deprecated
   1662 --- @param msg string
   1663 --- @param log_level integer
   1664 --- @param opts table<string,any>
   1665 --- @return any
   1666 function vim.api.nvim_notify(msg, log_level, opts) end
   1667 
   1668 --- Open a terminal instance in a buffer
   1669 ---
   1670 --- By default (and currently the only option) the terminal will not be
   1671 --- connected to an external process. Instead, input sent on the channel
   1672 --- will be echoed directly by the terminal. This is useful to display
   1673 --- ANSI terminal sequences returned as part of an RPC message, or similar.
   1674 ---
   1675 --- Note: to directly initiate the terminal using the right size, display the
   1676 --- buffer in a configured window before calling this. For instance, for a
   1677 --- floating display, first create an empty buffer using `nvim_create_buf()`,
   1678 --- then display it using `nvim_open_win()`, and then  call this function.
   1679 --- Then `nvim_chan_send()` can be called immediately to process sequences
   1680 --- in a virtual terminal having the intended size.
   1681 ---
   1682 --- Example: this `TermHl` command can be used to display and highlight raw ANSI termcodes, so you
   1683 --- can use Nvim as a "scrollback pager" (for terminals like kitty): [ansi-colorize]()
   1684 --- [terminal-scrollback-pager]()
   1685 ---
   1686 --- ```lua
   1687 --- vim.api.nvim_create_user_command('TermHl', function()
   1688 ---   vim.api.nvim_open_term(0, {})
   1689 --- end, { desc = 'Highlights ANSI termcodes in curbuf' })
   1690 --- ```
   1691 ---
   1692 --- @param buffer integer Buffer to use. Buffer contents (if any) will be written
   1693 --- to the PTY.
   1694 --- @param opts vim.api.keyset.open_term Optional parameters.
   1695 --- - on_input: Lua callback for input sent, i e keypresses in terminal
   1696 ---   mode. Note: keypresses are sent raw as they would be to the pty
   1697 ---   master end. For instance, a carriage return is sent
   1698 ---   as a "\r", not as a "\n". `textlock` applies. It is possible
   1699 ---   to call `nvim_chan_send()` directly in the callback however.
   1700 ---        `["input", term, bufnr, data]`
   1701 --- - force_crlf: (boolean, default true) Convert "\n" to "\r\n".
   1702 --- @return integer # Channel id, or 0 on error
   1703 function vim.api.nvim_open_term(buffer, opts) end
   1704 
   1705 --- Opens a new split window, or a floating window if `relative` is specified,
   1706 --- or an external window (managed by the UI) if `external` is specified.
   1707 ---
   1708 --- Floats are windows that are drawn above the split layout, at some anchor
   1709 --- position in some other window. Floats can be drawn internally or by external
   1710 --- GUI with the `ui-multigrid` extension. External windows are only supported
   1711 --- with multigrid GUIs, and are displayed as separate top-level windows.
   1712 ---
   1713 --- For a general overview of floats, see `api-floatwin`.
   1714 ---
   1715 --- The `width` and `height` of the new window must be specified when opening
   1716 --- a floating window, but are optional for normal windows.
   1717 ---
   1718 --- If `relative` and `external` are omitted, a normal "split" window is created.
   1719 --- The `win` property determines which window will be split. If no `win` is
   1720 --- provided or `win == 0`, a window will be created adjacent to the current window.
   1721 --- If -1 is provided, a top-level split will be created. `vertical` and `split` are
   1722 --- only valid for normal windows, and are used to control split direction. For `vertical`,
   1723 --- the exact direction is determined by 'splitright' and 'splitbelow'.
   1724 --- Split windows cannot have `bufpos`, `row`, `col`, `border`, `title`, `footer` properties.
   1725 ---
   1726 --- With relative=editor (row=0,col=0) refers to the top-left corner of the
   1727 --- screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right
   1728 --- corner. Fractional values are allowed, but the builtin implementation
   1729 --- (used by non-multigrid UIs) will always round down to nearest integer.
   1730 ---
   1731 --- Out-of-bounds values, and configurations that make the float not fit inside
   1732 --- the main editor, are allowed. The builtin implementation truncates values
   1733 --- so floats are fully within the main screen grid. External GUIs
   1734 --- could let floats hover outside of the main window like a tooltip, but
   1735 --- this should not be used to specify arbitrary WM screen positions.
   1736 ---
   1737 --- Examples:
   1738 ---
   1739 --- ```lua
   1740 --- -- Window-relative float with 'statusline' enabled:
   1741 --- local w1 = vim.api.nvim_open_win(0, false,
   1742 ---   {relative='win', row=3, col=3, width=40, height=4})
   1743 --- vim.wo[w1].statusline = vim.o.statusline
   1744 ---
   1745 --- -- Buffer-relative float (travels as buffer is scrolled):
   1746 --- vim.api.nvim_open_win(0, false,
   1747 ---   {relative='win', width=40, height=4, bufpos={100,10}})
   1748 ---
   1749 --- -- Vertical split left of the current window:
   1750 --- vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
   1751 --- ```
   1752 ---
   1753 --- @param buffer integer Buffer to display, or 0 for current buffer
   1754 --- @param enter boolean Enter the window (make it the current window)
   1755 --- @param config vim.api.keyset.win_config Map defining the window configuration. Keys:
   1756 --- - anchor: Decides which corner of the float to place at (row,col):
   1757 ---    - "NW" northwest (default)
   1758 ---    - "NE" northeast
   1759 ---    - "SW" southwest
   1760 ---    - "SE" southeast
   1761 --- - border: (`string|string[]`) (defaults to 'winborder' option) Window border. The string form
   1762 ---   accepts the same values as the 'winborder' option. The array form must have a length of
   1763 ---   eight or any divisor of eight, specifying the chars that form the border in a clockwise
   1764 ---   fashion starting from the top-left corner. For example, the double-box style can be
   1765 ---   specified as:
   1766 ---   ```
   1767 ---   [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
   1768 ---   ```
   1769 ---   If fewer than eight chars are given, they will be repeated. An ASCII border could be
   1770 ---   specified as:
   1771 ---   ```
   1772 ---   [ "/", "-", \"\\\\\", "|" ],
   1773 ---   ```
   1774 ---   Or one char for all sides:
   1775 ---   ```
   1776 ---   [ "x" ].
   1777 ---   ```
   1778 ---   Empty string can be used to hide a specific border. This example will show only vertical
   1779 ---   borders, not horizontal:
   1780 ---   ```
   1781 ---   [ "", "", "", ">", "", "", "", "<" ]
   1782 ---   ```
   1783 ---   By default, `hl-FloatBorder` highlight is used, which links to `hl-WinSeparator` when not
   1784 ---   defined. Each border side can specify an optional highlight:
   1785 ---   ```
   1786 ---   [ ["+", "MyCorner"], ["x", "MyBorder"] ].
   1787 ---   ```
   1788 --- - bufpos: Places float relative to buffer text (only when
   1789 ---     relative="win"). Takes a tuple of zero-indexed `[line, column]`.
   1790 ---     `row` and `col` if given are applied relative to this
   1791 ---     position, else they default to:
   1792 ---     - `row=1` and `col=0` if `anchor` is "NW" or "NE"
   1793 ---     - `row=0` and `col=0` if `anchor` is "SW" or "SE"
   1794 ---       (thus like a tooltip near the buffer text).
   1795 --- - col: Column position in units of screen cell width, may be fractional.
   1796 --- - external: GUI should display the window as an external
   1797 ---     top-level window. Currently accepts no other positioning
   1798 ---     configuration together with this.
   1799 --- - fixed: If true when anchor is NW or SW, the float window
   1800 ---          would be kept fixed even if the window would be truncated.
   1801 --- - focusable: Enable focus by user actions (wincmds, mouse events).
   1802 ---     Defaults to true. Non-focusable windows can be entered by
   1803 ---     `nvim_set_current_win()`, or, when the `mouse` field is set to true,
   1804 ---     by mouse events. See `focusable`.
   1805 --- - footer: (optional) Footer in window border, string or list.
   1806 ---     List should consist of `[text, highlight]` tuples.
   1807 ---     If string, or a tuple lacks a highlight, the default highlight group is `FloatFooter`.
   1808 --- - footer_pos: Footer position. Must be set with `footer` option.
   1809 ---     Value can be one of "left", "center", or "right".
   1810 ---     Default is `"left"`.
   1811 --- - height: Window height (in character cells). Minimum of 1.
   1812 --- - hide: If true the floating window will be hidden and the cursor will be invisible when
   1813 ---         focused on it.
   1814 --- - mouse: Specify how this window interacts with mouse events.
   1815 ---     Defaults to `focusable` value.
   1816 ---     - If false, mouse events pass through this window.
   1817 ---     - If true, mouse events interact with this window normally.
   1818 --- - noautocmd: Block all autocommands for the duration of the call. Cannot be changed by
   1819 ---   `nvim_win_set_config()`.
   1820 --- - relative: Sets the window layout to "floating", placed at (row,col)
   1821 ---               coordinates relative to:
   1822 ---    - "cursor"     Cursor position in current window.
   1823 ---    - "editor"     The global editor grid.
   1824 ---    - "laststatus" 'laststatus' if present, or last row.
   1825 ---    - "mouse"      Mouse position.
   1826 ---    - "tabline"    Tabline if present, or first row.
   1827 ---    - "win"        Window given by the `win` field, or current window.
   1828 --- - row: Row position in units of "screen cell height", may be fractional.
   1829 --- - split: Split direction: "left", "right", "above", "below".
   1830 --- - style: (optional) Configure the appearance of the window. Currently
   1831 ---     only supports one value:
   1832 ---     - "minimal"  Nvim will display the window with many UI options
   1833 ---                  disabled. This is useful when displaying a temporary
   1834 ---                  float where the text should not be edited. Disables
   1835 ---                  'number', 'relativenumber', 'cursorline', 'cursorcolumn',
   1836 ---                  'foldcolumn', 'spell' and 'list' options. 'signcolumn'
   1837 ---                  is changed to `auto` and 'colorcolumn' is cleared.
   1838 ---                  'statuscolumn' is changed to empty. The end-of-buffer
   1839 ---                   region is hidden by setting `eob` flag of
   1840 ---                  'fillchars' to a space char, and clearing the
   1841 ---                  `hl-EndOfBuffer` region in 'winhighlight'.
   1842 --- - title: (optional) Title in window border, string or list.
   1843 ---     List should consist of `[text, highlight]` tuples.
   1844 ---     If string, or a tuple lacks a highlight, the default highlight group is `FloatTitle`.
   1845 --- - title_pos: Title position. Must be set with `title` option.
   1846 ---     Value can be one of "left", "center", or "right".
   1847 ---     Default is `"left"`.
   1848 --- - vertical: Split vertically `:vertical`.
   1849 --- - width: Window width (in character cells). Minimum of 1.
   1850 --- - win: `window-ID` window to split, or relative window when creating a float (relative="win").
   1851 ---     When splitting, negative value works like `:topleft`, `:botright`.
   1852 --- - zindex: Stacking order. floats with higher `zindex` go on top on
   1853 ---             floats with lower indices. Must be larger than zero. The
   1854 ---             following screen elements have hard-coded z-indices:
   1855 ---     - 100: insert completion popupmenu
   1856 ---     - 200: message scrollback
   1857 ---     - 250: cmdline completion popupmenu (when wildoptions+=pum)
   1858 ---   The default value for floats are 50.  In general, values below 100 are
   1859 ---   recommended, unless there is a good reason to overshadow builtin
   1860 ---   elements.
   1861 --- - _cmdline_offset: (EXPERIMENTAL) When provided, anchor the `cmdline-completion`
   1862 ---   popupmenu to this window, with an offset in screen cell width.
   1863 --- @return integer # |window-ID|, or 0 on error
   1864 function vim.api.nvim_open_win(buffer, enter, config) end
   1865 
   1866 --- @deprecated
   1867 --- @param str string
   1868 function vim.api.nvim_out_write(str) end
   1869 
   1870 --- Parse command line.
   1871 ---
   1872 --- Doesn't check the validity of command arguments.
   1873 ---
   1874 --- @param str string Command line string to parse. Cannot contain "\n".
   1875 --- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
   1876 --- @return vim.api.keyset.cmd # Dict containing command information, with these keys:
   1877 --- - cmd: (string) Command name.
   1878 --- - range: (array) (optional) Command range ([<line1>] [<line2>]).
   1879 ---                  Omitted if command doesn't accept a range.
   1880 ---                  Otherwise, has no elements if no range was specified, one element if
   1881 ---                  only a single range item was specified, or two elements if both range
   1882 ---                  items were specified.
   1883 --- - count: (number) (optional) Command [<count>].
   1884 ---                   Omitted if command cannot take a count.
   1885 --- - reg: (string) (optional) Command [<register>].
   1886 ---                 Omitted if command cannot take a register.
   1887 --- - bang: (boolean) Whether command contains a [<bang>] (!) modifier.
   1888 --- - args: (array) Command arguments.
   1889 --- - addr: (string) Value of |:command-addr|. Uses short name or "line" for -addr=lines.
   1890 --- - nargs: (string) Value of |:command-nargs|.
   1891 --- - nextcmd: (string) Next command if there are multiple commands separated by a |:bar|.
   1892 ---                     Empty if there isn't a next command.
   1893 --- - magic: (dict) Which characters have special meaning in the command arguments.
   1894 ---     - file: (boolean) The command expands filenames. Which means characters such as "%",
   1895 ---                       "#" and wildcards are expanded.
   1896 ---     - bar: (boolean) The "|" character is treated as a command separator and the double
   1897 ---                      quote character (") is treated as the start of a comment.
   1898 --- - mods: (dict) |:command-modifiers|.
   1899 ---     - filter: (dict) |:filter|.
   1900 ---         - pattern: (string) Filter pattern. Empty string if there is no filter.
   1901 ---         - force: (boolean) Whether filter is inverted or not.
   1902 ---     - silent: (boolean) |:silent|.
   1903 ---     - emsg_silent: (boolean) |:silent!|.
   1904 ---     - unsilent: (boolean) |:unsilent|.
   1905 ---     - sandbox: (boolean) |:sandbox|.
   1906 ---     - noautocmd: (boolean) |:noautocmd|.
   1907 ---     - browse: (boolean) |:browse|.
   1908 ---     - confirm: (boolean) |:confirm|.
   1909 ---     - hide: (boolean) |:hide|.
   1910 ---     - horizontal: (boolean) |:horizontal|.
   1911 ---     - keepalt: (boolean) |:keepalt|.
   1912 ---     - keepjumps: (boolean) |:keepjumps|.
   1913 ---     - keepmarks: (boolean) |:keepmarks|.
   1914 ---     - keeppatterns: (boolean) |:keeppatterns|.
   1915 ---     - lockmarks: (boolean) |:lockmarks|.
   1916 ---     - noswapfile: (boolean) |:noswapfile|.
   1917 ---     - tab: (integer) |:tab|. -1 when omitted.
   1918 ---     - verbose: (integer) |:verbose|. -1 when omitted.
   1919 ---     - vertical: (boolean) |:vertical|.
   1920 ---     - split: (string) Split modifier string, is an empty string when there's no split
   1921 ---                       modifier. If there is a split modifier it can be one of:
   1922 ---       - "aboveleft": |:aboveleft|.
   1923 ---       - "belowright": |:belowright|.
   1924 ---       - "topleft": |:topleft|.
   1925 ---       - "botright": |:botright|.
   1926 function vim.api.nvim_parse_cmd(str, opts) end
   1927 
   1928 --- Parse a Vimscript expression.
   1929 ---
   1930 --- @param expr string Expression to parse. Always treated as a single line.
   1931 --- @param flags string Flags:
   1932 --- - "m" if multiple expressions in a row are allowed (only
   1933 ---   the first one will be parsed),
   1934 --- - "E" if EOC tokens are not allowed (determines whether
   1935 ---   they will stop parsing process or be recognized as an
   1936 ---   operator/space, though also yielding an error).
   1937 --- - "l" when needing to start parsing with lvalues for
   1938 ---   ":let" or ":for".
   1939 --- Common flag sets:
   1940 --- - "m" to parse like for `":echo"`.
   1941 --- - "E" to parse like for `"<C-r>="`.
   1942 --- - empty string for ":call".
   1943 --- - "lm" to parse for ":let".
   1944 --- @param highlight boolean If true, return value will also include "highlight"
   1945 --- key containing array of 4-tuples (arrays) (Integer,
   1946 --- Integer, Integer, String), where first three numbers
   1947 --- define the highlighted region and represent line,
   1948 --- starting column and ending column (latter exclusive:
   1949 --- one should highlight region [start_col, end_col)).
   1950 --- @return table<string,any> #
   1951 --- - AST: top-level dict with these keys:
   1952 ---   - "error": Dict with error, present only if parser saw some
   1953 ---            error. Contains the following keys:
   1954 ---     - "message": String, error message in printf format, translated.
   1955 ---                  Must contain exactly one `%.*s`.
   1956 ---     - "arg": String, error message argument.
   1957 ---   - "len": Amount of bytes successfully parsed. With flags equal to ""
   1958 ---            that should be equal to the length of expr string.
   1959 ---            ("Successfully parsed" here means "participated in AST
   1960 ---             creation", not "till the first error".)
   1961 ---   - "ast": AST, either nil or a dict with these keys:
   1962 ---     - "type": node type, one of the value names from ExprASTNodeType
   1963 ---               stringified without "kExprNode" prefix.
   1964 ---     - "start": a pair `[line, column]` describing where node is "started"
   1965 ---                where "line" is always 0 (will not be 0 if you will be
   1966 ---                using this API on e.g. ":let", but that is not
   1967 ---                present yet). Both elements are Integers.
   1968 ---     - "len": “length” of the node. This and "start" are there for
   1969 ---              debugging purposes primary (debugging parser and providing
   1970 ---              debug information).
   1971 ---     - "children": a list of nodes described in top/"ast". There always
   1972 ---                   is zero, one or two children, key will not be present
   1973 ---                   if node has no children. Maximum number of children
   1974 ---                   may be found in node_maxchildren array.
   1975 --- - Local values (present only for certain nodes):
   1976 ---   - "scope": a single Integer, specifies scope for "Option" and
   1977 ---              "PlainIdentifier" nodes. For "Option" it is one of
   1978 ---              ExprOptScope values, for "PlainIdentifier" it is one of
   1979 ---              ExprVarScope values.
   1980 ---   - "ident": identifier (without scope, if any), present for "Option",
   1981 ---              "PlainIdentifier", "PlainKey" and "Environment" nodes.
   1982 ---   - "name": Integer, register name (one character) or -1. Only present
   1983 ---           for "Register" nodes.
   1984 ---   - "cmp_type": String, comparison type, one of the value names from
   1985 ---                 ExprComparisonType, stringified without "kExprCmp"
   1986 ---                 prefix. Only present for "Comparison" nodes.
   1987 ---   - "ccs_strategy": String, case comparison strategy, one of the
   1988 ---                     value names from ExprCaseCompareStrategy,
   1989 ---                     stringified without "kCCStrategy" prefix. Only
   1990 ---                     present for "Comparison" nodes.
   1991 ---   - "augmentation": String, augmentation type for "Assignment" nodes.
   1992 ---                     Is either an empty string, "Add", "Subtract" or
   1993 ---                     "Concat" for "=", "+=", "-=" or ".=" respectively.
   1994 ---   - "invert": Boolean, true if result of comparison needs to be
   1995 ---               inverted. Only present for "Comparison" nodes.
   1996 ---   - "ivalue": Integer, integer value for "Integer" nodes.
   1997 ---   - "fvalue": Float, floating-point value for "Float" nodes.
   1998 ---   - "svalue": String, value for "SingleQuotedString" and
   1999 ---               "DoubleQuotedString" nodes.
   2000 function vim.api.nvim_parse_expression(expr, flags, highlight) end
   2001 
   2002 --- Pastes at cursor (in any mode), and sets "redo" so dot (`.`) will repeat the input. UIs call
   2003 --- this to implement "paste", but it's also intended for use by scripts to input large,
   2004 --- dot-repeatable blocks of text (as opposed to `nvim_input()` which is subject to mappings/events
   2005 --- and is thus much slower).
   2006 ---
   2007 --- Invokes the `vim.paste()` handler, which handles each mode appropriately.
   2008 ---
   2009 --- Errors ('nomodifiable', `vim.paste()` failure, …) are reflected in `err` but do not affect the
   2010 --- return value (which is strictly decided by `vim.paste()`).  On error or cancel, subsequent calls
   2011 --- are ignored ("drained") until the next paste is initiated (phase 1 or -1).
   2012 ---
   2013 --- Useful in mappings and scripts to insert multiline text. Example:
   2014 ---
   2015 --- ```lua
   2016 --- vim.keymap.set('n', 'x', function()
   2017 ---   vim.api.nvim_paste([[
   2018 ---     line1
   2019 ---     line2
   2020 ---     line3
   2021 ---   ]], false, -1)
   2022 --- end, { buffer = true })
   2023 --- ```
   2024 ---
   2025 --- @param data string Multiline input. Lines break at LF ("\n"). May be binary (containing NUL bytes).
   2026 --- @param crlf boolean Also break lines at CR and CRLF.
   2027 --- @param phase integer -1: paste in a single call (i.e. without streaming).
   2028 --- To "stream" a paste, call `nvim_paste` sequentially with
   2029 --- these `phase` values:
   2030 ---   - 1: starts the paste (exactly once)
   2031 ---   - 2: continues the paste (zero or more times)
   2032 ---   - 3: ends the paste (exactly once)
   2033 --- @return boolean #
   2034 --- - true: Client may continue pasting.
   2035 --- - false: Client should cancel the paste.
   2036 function vim.api.nvim_paste(data, crlf, phase) end
   2037 
   2038 --- Puts text at cursor, in any mode. For dot-repeatable input, use `nvim_paste()`.
   2039 ---
   2040 --- Compare `:put` and `p` which are always linewise.
   2041 ---
   2042 --- @param lines string[] `readfile()`-style list of lines. `channel-lines`
   2043 --- @param type string Edit behavior: any `getregtype()` result, or:
   2044 --- - "b" `blockwise-visual` mode (may include width, e.g. "b3")
   2045 --- - "c" `charwise` mode
   2046 --- - "l" `linewise` mode
   2047 --- - ""  guess by contents, see `setreg()`
   2048 --- @param after boolean If true insert after cursor (like `p`), or before (like `P`).
   2049 --- @param follow boolean If true place cursor at end of inserted text.
   2050 function vim.api.nvim_put(lines, type, after, follow) end
   2051 
   2052 --- Replaces terminal codes and `keycodes` ([<CR>], [<Esc>], ...) in a string with
   2053 --- the internal representation.
   2054 ---
   2055 ---
   2056 --- Note:
   2057 --- Lua can use |vim.keycode()| instead.
   2058 ---
   2059 --- @see replace_termcodes
   2060 --- @see cpoptions
   2061 --- @param str string String to be converted.
   2062 --- @param from_part boolean Legacy Vim parameter. Usually true.
   2063 --- @param do_lt boolean Also translate [<lt>]. Ignored if `special` is false.
   2064 --- @param special boolean Replace `keycodes`, e.g. [<CR>] becomes a "\r" char.
   2065 --- @return string
   2066 function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end
   2067 
   2068 --- Selects an item in the completion popup menu.
   2069 ---
   2070 --- If neither `ins-completion` nor `cmdline-completion` popup menu is active
   2071 --- this API call is silently ignored.
   2072 --- Useful for an external UI using `ui-popupmenu` to control the popup menu with the mouse.
   2073 --- Can also be used in a mapping; use [<Cmd>] `:map-cmd` or a Lua mapping to ensure the mapping
   2074 --- doesn't end completion mode.
   2075 ---
   2076 --- @param item integer Index (zero-based) of the item to select. Value of -1 selects nothing
   2077 --- and restores the original text.
   2078 --- @param insert boolean For `ins-completion`, whether the selection should be inserted in the buffer.
   2079 --- Ignored for `cmdline-completion`.
   2080 --- @param finish boolean Finish the completion and dismiss the popup menu. Implies {insert}.
   2081 --- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
   2082 function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end
   2083 
   2084 --- Sets the current window's buffer to `buffer`.
   2085 ---
   2086 --- @param buffer integer Buffer id
   2087 function vim.api.nvim_set_current_buf(buffer) end
   2088 
   2089 --- Changes the global working directory.
   2090 ---
   2091 --- @param dir string Directory path
   2092 function vim.api.nvim_set_current_dir(dir) end
   2093 
   2094 --- Sets the text on the current line.
   2095 ---
   2096 --- @param line string Line contents
   2097 function vim.api.nvim_set_current_line(line) end
   2098 
   2099 --- Sets the current tabpage.
   2100 ---
   2101 --- @param tabpage integer `tab-ID` to focus
   2102 function vim.api.nvim_set_current_tabpage(tabpage) end
   2103 
   2104 --- Navigates to the given window (and tabpage, implicitly).
   2105 ---
   2106 --- @param window integer `window-ID` to focus
   2107 function vim.api.nvim_set_current_win(window) end
   2108 
   2109 --- Set or change decoration provider for a `namespace`
   2110 ---
   2111 --- This is a very general purpose interface for having Lua callbacks
   2112 --- being triggered during the redraw code.
   2113 ---
   2114 --- The expected usage is to set `extmarks` for the currently
   2115 --- redrawn buffer. `nvim_buf_set_extmark()` can be called to add marks
   2116 --- on a per-window or per-lines basis. Use the `ephemeral` key to only
   2117 --- use the mark for the current screen redraw (the callback will be called
   2118 --- again for the next redraw).
   2119 ---
   2120 --- Note: this function should not be called often. Rather, the callbacks
   2121 --- themselves can be used to throttle unneeded callbacks. the `on_start`
   2122 --- callback can return `false` to disable the provider until the next redraw.
   2123 --- Similarly, return `false` in `on_win` will skip the `on_line` and `on_range` calls
   2124 --- for that window (but any extmarks set in `on_win` will still be used).
   2125 --- A plugin managing multiple sources of decoration should ideally only set
   2126 --- one provider, and merge the sources internally. You can use multiple `ns_id`
   2127 --- for the extmarks set/modified inside the callback anyway.
   2128 ---
   2129 --- Note: doing anything other than setting extmarks is considered experimental.
   2130 --- Doing things like changing options are not explicitly forbidden, but is
   2131 --- likely to have unexpected consequences (such as 100% CPU consumption).
   2132 --- Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious
   2133 --- for the moment.
   2134 ---
   2135 --- Note: It is not allowed to remove or update extmarks in `on_line` or `on_range` callbacks.
   2136 ---
   2137 --- @param ns_id integer Namespace id from `nvim_create_namespace()`
   2138 --- @param opts vim.api.keyset.set_decoration_provider Table of callbacks:
   2139 --- - on_start: called first on each screen redraw
   2140 ---   ```
   2141 ---     ["start", tick]
   2142 ---   ```
   2143 --- - on_buf: called for each buffer being redrawn (once per edit,
   2144 ---   before window callbacks)
   2145 ---   ```
   2146 ---     ["buf", bufnr, tick]
   2147 ---   ```
   2148 --- - on_win: called when starting to redraw a specific window.
   2149 ---   ```
   2150 ---     ["win", winid, bufnr, toprow, botrow]
   2151 ---   ```
   2152 --- - on_line: (deprecated, use on_range instead)
   2153 ---   ```
   2154 ---     ["line", winid, bufnr, row]
   2155 ---   ```
   2156 --- - on_range: called for each buffer range being redrawn.
   2157 ---   Range is end-exclusive and may span multiple lines. Range
   2158 ---   bounds point to the first byte of a character. An end position
   2159 ---   of the form (lnum, 0), including (number of lines, 0), is valid
   2160 ---   and indicates that EOL of the preceding line is included.
   2161 ---   ```
   2162 ---     ["range", winid, bufnr, begin_row, begin_col, end_row, end_col]
   2163 ---   ```
   2164 ---
   2165 ---   In addition to returning a boolean, it is also allowed to
   2166 ---   return a `skip_row, skip_col` pair of integers. This implies
   2167 ---   that this function does not need to be called until a range
   2168 ---   which continues beyond the skipped position. A single integer
   2169 ---   return value `skip_row` is short for `skip_row, 0`
   2170 ---
   2171 --- - on_end: called at the end of a redraw cycle
   2172 ---   ```
   2173 ---     ["end", tick]
   2174 ---   ```
   2175 function vim.api.nvim_set_decoration_provider(ns_id, opts) end
   2176 
   2177 --- Sets a highlight group.
   2178 ---
   2179 --- Note:
   2180 --- Unlike the `:highlight` command which can update a highlight group,
   2181 --- this function completely replaces the definition. For example:
   2182 --- `nvim_set_hl(0, 'Visual', {})` will clear the highlight group
   2183 --- 'Visual'.
   2184 ---
   2185 --- The fg and bg keys also accept the string values `"fg"` or `"bg"`
   2186 --- which act as aliases to the corresponding foreground and background
   2187 --- values of the Normal group. If the Normal group has not been defined,
   2188 --- using these values results in an error.
   2189 ---
   2190 --- If `link` is used in combination with other attributes; only the
   2191 --- `link` will take effect (see |:hi-link|).
   2192 ---
   2193 ---
   2194 --- @param ns_id integer Namespace id for this highlight `nvim_create_namespace()`.
   2195 --- Use 0 to set a highlight group globally `:highlight`.
   2196 --- Highlights from non-global namespaces are not active by default, use
   2197 --- `nvim_set_hl_ns()` or `nvim_win_set_hl_ns()` to activate them.
   2198 --- @param name string Highlight group name, e.g. "ErrorMsg"
   2199 --- @param val vim.api.keyset.highlight Highlight definition map, accepts the following keys:
   2200 --- - bg: color name or "#RRGGBB", see note.
   2201 --- - bg_indexed: boolean (default false) If true, bg is a terminal palette index (0-255).
   2202 --- - blend: integer between 0 and 100
   2203 --- - cterm: cterm attribute map, like `highlight-args`. If not set, cterm attributes
   2204 ---   will match those from the attribute map documented above.
   2205 --- - ctermbg: Sets background of cterm color `ctermbg`
   2206 --- - ctermfg: Sets foreground of cterm color `ctermfg`
   2207 --- - default: boolean Don't override existing definition `:hi-default`
   2208 --- - fg: color name or "#RRGGBB", see note.
   2209 --- - fg_indexed: boolean (default false) If true, fg is a terminal palette index (0-255).
   2210 --- - force: if true force update the highlight group when it exists.
   2211 --- - link: Name of highlight group to link to. `:hi-link`
   2212 --- - sp: color name or "#RRGGBB"
   2213 --- - altfont: boolean
   2214 --- - blink: boolean
   2215 --- - bold: boolean
   2216 --- - conceal: boolean Concealment at the UI level (terminal SGR), unrelated to `:syn-conceal`.
   2217 --- - dim: boolean
   2218 --- - italic: boolean
   2219 --- - nocombine: boolean
   2220 --- - overline: boolean
   2221 --- - reverse: boolean
   2222 --- - standout: boolean
   2223 --- - strikethrough: boolean
   2224 --- - undercurl: boolean
   2225 --- - underdashed: boolean
   2226 --- - underdotted: boolean
   2227 --- - underdouble: boolean
   2228 --- - underline: boolean
   2229 function vim.api.nvim_set_hl(ns_id, name, val) end
   2230 
   2231 --- Set active namespace for highlights defined with `nvim_set_hl()`. This can be set for
   2232 --- a single window, see `nvim_win_set_hl_ns()`.
   2233 ---
   2234 --- @param ns_id integer the namespace to use
   2235 function vim.api.nvim_set_hl_ns(ns_id) end
   2236 
   2237 --- Set active namespace for highlights defined with `nvim_set_hl()` while redrawing.
   2238 ---
   2239 --- This function is meant to be called while redrawing, primarily from
   2240 --- `nvim_set_decoration_provider()` on_win and on_line callbacks, which
   2241 --- are allowed to change the namespace during a redraw cycle.
   2242 ---
   2243 --- @param ns_id integer the namespace to activate
   2244 function vim.api.nvim_set_hl_ns_fast(ns_id) end
   2245 
   2246 --- Sets a global `mapping` for the given mode.
   2247 ---
   2248 --- To set a buffer-local mapping, use `nvim_buf_set_keymap()`.
   2249 ---
   2250 --- Unlike `:map`, leading/trailing whitespace is accepted as part of the {lhs} or {rhs}.
   2251 --- Empty {rhs} is [<Nop>]. `keycodes` are replaced as usual.
   2252 ---
   2253 --- Example:
   2254 ---
   2255 --- ```vim
   2256 --- call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
   2257 --- ```
   2258 ---
   2259 --- is equivalent to:
   2260 ---
   2261 --- ```vim
   2262 --- nmap <nowait> <Space><NL> <Nop>
   2263 --- ```
   2264 ---
   2265 --- @param mode string Mode short-name (map command prefix: "n", "i", "v", "x", …)
   2266 --- or "!" for `:map!`, or empty string for `:map`.
   2267 --- "ia", "ca" or "!a" for abbreviation in Insert mode, Cmdline mode, or both, respectively
   2268 --- @param lhs string Left-hand-side `{lhs}` of the mapping.
   2269 --- @param rhs string Right-hand-side `{rhs}` of the mapping.
   2270 --- @param opts vim.api.keyset.keymap Optional parameters map: Accepts all `:map-arguments` as keys except [<buffer>],
   2271 --- values are booleans (default false). Also:
   2272 --- - "noremap" disables `recursive_mapping`, like `:noremap`
   2273 --- - "desc" human-readable description.
   2274 --- - "callback" Lua function called in place of {rhs}.
   2275 --- - "replace_keycodes" (boolean) When "expr" is true, replace keycodes in the
   2276 ---   resulting string (see `nvim_replace_termcodes()`). Returning nil from the Lua
   2277 ---   "callback" is equivalent to returning an empty string.
   2278 function vim.api.nvim_set_keymap(mode, lhs, rhs, opts) end
   2279 
   2280 --- @deprecated
   2281 --- @param name string
   2282 --- @param value any
   2283 function vim.api.nvim_set_option(name, value) end
   2284 
   2285 --- Sets the value of an option. The behavior of this function matches that of
   2286 --- `:set`: for global-local options, both the global and local value are set
   2287 --- unless otherwise specified with {scope}.
   2288 ---
   2289 --- Note the options {win} and {buf} cannot be used together.
   2290 ---
   2291 --- @param name string Option name
   2292 --- @param value any New option value
   2293 --- @param opts vim.api.keyset.option Optional parameters
   2294 --- - scope: One of "global" or "local". Analogous to
   2295 --- `:setglobal` and `:setlocal`, respectively.
   2296 --- - win: `window-ID`. Used for setting window local option.
   2297 --- - buf: Buffer number. Used for setting buffer local option.
   2298 function vim.api.nvim_set_option_value(name, value, opts) end
   2299 
   2300 --- Sets a global (g:) variable.
   2301 ---
   2302 --- @param name string Variable name
   2303 --- @param value any Variable value
   2304 function vim.api.nvim_set_var(name, value) end
   2305 
   2306 --- Sets a v: variable, if it is not readonly.
   2307 ---
   2308 --- @param name string Variable name
   2309 --- @param value any Variable value
   2310 function vim.api.nvim_set_vvar(name, value) end
   2311 
   2312 --- Calculates the number of display cells occupied by `text`.
   2313 --- Control characters including [<Tab>] count as one cell.
   2314 ---
   2315 --- @param text string Some text
   2316 --- @return integer # Number of cells
   2317 function vim.api.nvim_strwidth(text) end
   2318 
   2319 --- Removes a tab-scoped (t:) variable
   2320 ---
   2321 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2322 --- @param name string Variable name
   2323 function vim.api.nvim_tabpage_del_var(tabpage, name) end
   2324 
   2325 --- Gets the tabpage number
   2326 ---
   2327 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2328 --- @return integer # Tabpage number
   2329 function vim.api.nvim_tabpage_get_number(tabpage) end
   2330 
   2331 --- Gets a tab-scoped (t:) variable
   2332 ---
   2333 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2334 --- @param name string Variable name
   2335 --- @return any # Variable value
   2336 function vim.api.nvim_tabpage_get_var(tabpage, name) end
   2337 
   2338 --- Gets the current window in a tabpage
   2339 ---
   2340 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2341 --- @return integer # |window-ID|
   2342 function vim.api.nvim_tabpage_get_win(tabpage) end
   2343 
   2344 --- Checks if a tabpage is valid
   2345 ---
   2346 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2347 --- @return boolean # true if the tabpage is valid, false otherwise
   2348 function vim.api.nvim_tabpage_is_valid(tabpage) end
   2349 
   2350 --- Gets the windows in a tabpage
   2351 ---
   2352 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2353 --- @return integer[] # List of windows in `tabpage`
   2354 function vim.api.nvim_tabpage_list_wins(tabpage) end
   2355 
   2356 --- Sets a tab-scoped (t:) variable
   2357 ---
   2358 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2359 --- @param name string Variable name
   2360 --- @param value any Variable value
   2361 function vim.api.nvim_tabpage_set_var(tabpage, name, value) end
   2362 
   2363 --- Sets the current window in a tabpage
   2364 ---
   2365 --- @param tabpage integer `tab-ID`, or 0 for current tabpage
   2366 --- @param win integer `window-ID`, must already belong to {tabpage}
   2367 function vim.api.nvim_tabpage_set_win(tabpage, win) end
   2368 
   2369 --- Sends arbitrary data to a UI. Use this instead of `nvim_chan_send()` or `io.stdout:write()`, if
   2370 --- you really want to write to the `TUI` host terminal.
   2371 ---
   2372 --- Emits a "ui_send" event to all UIs with the "stdout_tty" `ui-option` set. UIs are expected to
   2373 --- write the received data to a connected TTY if one exists.
   2374 ---
   2375 --- @param content string Content to write to the TTY
   2376 function vim.api.nvim_ui_send(content) end
   2377 
   2378 --- Calls a function with window as temporary current window.
   2379 ---
   2380 ---
   2381 --- @see `:help win_execute()`
   2382 --- @see vim.api.nvim_buf_call
   2383 --- @param window integer `window-ID`, or 0 for current window
   2384 --- @param fun function Function to call inside the window (currently Lua callable
   2385 --- only)
   2386 --- @return any # Return value of function.
   2387 function vim.api.nvim_win_call(window, fun) end
   2388 
   2389 --- Closes the window (like `:close` with a `window-ID`).
   2390 ---
   2391 --- @param window integer `window-ID`, or 0 for current window
   2392 --- @param force boolean Behave like `:close!` The last window of a buffer with
   2393 --- unwritten changes can be closed. The buffer will become
   2394 --- hidden, even if 'hidden' is not set.
   2395 function vim.api.nvim_win_close(window, force) end
   2396 
   2397 --- Removes a window-scoped (w:) variable
   2398 ---
   2399 --- @param window integer `window-ID`, or 0 for current window
   2400 --- @param name string Variable name
   2401 function vim.api.nvim_win_del_var(window, name) end
   2402 
   2403 --- Gets the current buffer in a window
   2404 ---
   2405 --- @param window integer `window-ID`, or 0 for current window
   2406 --- @return integer # Buffer id
   2407 function vim.api.nvim_win_get_buf(window) end
   2408 
   2409 --- Gets window configuration in the form of a dict which can be passed as the `config` parameter of
   2410 --- `nvim_open_win()`.
   2411 ---
   2412 --- For non-floating windows, `relative` is empty.
   2413 ---
   2414 --- @param window integer `window-ID`, or 0 for current window
   2415 --- @return vim.api.keyset.win_config_ret # Map defining the window configuration, see |nvim_open_win()|
   2416 function vim.api.nvim_win_get_config(window) end
   2417 
   2418 --- Gets the (1,0)-indexed, buffer-relative cursor position for a given window
   2419 --- (different windows showing the same buffer have independent cursor
   2420 --- positions). `api-indexing`
   2421 ---
   2422 ---
   2423 --- @see `:help getcurpos()`
   2424 --- @param window integer `window-ID`, or 0 for current window
   2425 --- @return [integer, integer] # (row, col) tuple
   2426 function vim.api.nvim_win_get_cursor(window) end
   2427 
   2428 --- Gets the window height
   2429 ---
   2430 --- @param window integer `window-ID`, or 0 for current window
   2431 --- @return integer # Height as a count of rows
   2432 function vim.api.nvim_win_get_height(window) end
   2433 
   2434 --- Gets the window number
   2435 ---
   2436 --- @param window integer `window-ID`, or 0 for current window
   2437 --- @return integer # Window number
   2438 function vim.api.nvim_win_get_number(window) end
   2439 
   2440 --- @deprecated
   2441 --- @param window integer
   2442 --- @param name string
   2443 --- @return any
   2444 function vim.api.nvim_win_get_option(window, name) end
   2445 
   2446 --- Gets the window position in display cells. First position is zero.
   2447 ---
   2448 --- @param window integer `window-ID`, or 0 for current window
   2449 --- @return [integer, integer] # (row, col) tuple with the window position
   2450 function vim.api.nvim_win_get_position(window) end
   2451 
   2452 --- Gets the window tabpage
   2453 ---
   2454 --- @param window integer `window-ID`, or 0 for current window
   2455 --- @return integer # Tabpage that contains the window
   2456 function vim.api.nvim_win_get_tabpage(window) end
   2457 
   2458 --- Gets a window-scoped (w:) variable
   2459 ---
   2460 --- @param window integer `window-ID`, or 0 for current window
   2461 --- @param name string Variable name
   2462 --- @return any # Variable value
   2463 function vim.api.nvim_win_get_var(window, name) end
   2464 
   2465 --- Gets the window width
   2466 ---
   2467 --- @param window integer `window-ID`, or 0 for current window
   2468 --- @return integer # Width as a count of columns
   2469 function vim.api.nvim_win_get_width(window) end
   2470 
   2471 --- Closes the window and hide the buffer it contains (like `:hide` with a
   2472 --- `window-ID`).
   2473 ---
   2474 --- Like `:hide` the buffer becomes hidden unless another window is editing it,
   2475 --- or 'bufhidden' is `unload`, `delete` or `wipe` as opposed to `:close` or
   2476 --- `nvim_win_close()`, which will close the buffer.
   2477 ---
   2478 --- @param window integer `window-ID`, or 0 for current window
   2479 function vim.api.nvim_win_hide(window) end
   2480 
   2481 --- Checks if a window is valid
   2482 ---
   2483 --- @param window integer `window-ID`, or 0 for current window
   2484 --- @return boolean # true if the window is valid, false otherwise
   2485 function vim.api.nvim_win_is_valid(window) end
   2486 
   2487 --- Sets the current buffer in a window, without side effects
   2488 ---
   2489 --- @param window integer `window-ID`, or 0 for current window
   2490 --- @param buffer integer Buffer id
   2491 function vim.api.nvim_win_set_buf(window, buffer) end
   2492 
   2493 --- Reconfigures the layout of a window.
   2494 ---
   2495 --- - Absent (`nil`) keys will not be changed.
   2496 --- - `row` / `col` / `relative` must be reconfigured together.
   2497 --- - Cannot be used to move the last window in a tabpage to a different one.
   2498 ---
   2499 --- Example: to convert a floating window to a "normal" split window, specify the `win` field:
   2500 ---
   2501 --- ```lua
   2502 --- vim.api.nvim_win_set_config(0, { split = 'above', win = vim.fn.win_getid(1), })
   2503 --- ```
   2504 ---
   2505 ---
   2506 --- @see vim.api.nvim_open_win
   2507 --- @param window integer `window-ID`, or 0 for current window
   2508 --- @param config vim.api.keyset.win_config Map defining the window configuration, see [nvim_open_win()]
   2509 function vim.api.nvim_win_set_config(window, config) end
   2510 
   2511 --- Sets the (1,0)-indexed cursor position in the window. `api-indexing`
   2512 --- This scrolls the window even if it is not the current one.
   2513 ---
   2514 --- @param window integer `window-ID`, or 0 for current window
   2515 --- @param pos [integer, integer] (row, col) tuple representing the new position
   2516 function vim.api.nvim_win_set_cursor(window, pos) end
   2517 
   2518 --- Sets the window height.
   2519 ---
   2520 --- @param window integer `window-ID`, or 0 for current window
   2521 --- @param height integer Height as a count of rows
   2522 function vim.api.nvim_win_set_height(window, height) end
   2523 
   2524 --- Set highlight namespace for a window. This will use highlights defined with
   2525 --- `nvim_set_hl()` for this namespace, but fall back to global highlights (ns=0) when
   2526 --- missing.
   2527 ---
   2528 --- This takes precedence over the 'winhighlight' option.
   2529 ---
   2530 --- @param window integer
   2531 --- @param ns_id integer the namespace to use
   2532 function vim.api.nvim_win_set_hl_ns(window, ns_id) end
   2533 
   2534 --- @deprecated
   2535 --- @param window integer
   2536 --- @param name string
   2537 --- @param value any
   2538 function vim.api.nvim_win_set_option(window, name, value) end
   2539 
   2540 --- Sets a window-scoped (w:) variable
   2541 ---
   2542 --- @param window integer `window-ID`, or 0 for current window
   2543 --- @param name string Variable name
   2544 --- @param value any Variable value
   2545 function vim.api.nvim_win_set_var(window, name, value) end
   2546 
   2547 --- Sets the window width. This will only succeed if the screen is split
   2548 --- vertically.
   2549 ---
   2550 --- @param window integer `window-ID`, or 0 for current window
   2551 --- @param width integer Width as a count of columns
   2552 function vim.api.nvim_win_set_width(window, width) end
   2553 
   2554 --- Computes the number of screen lines occupied by a range of text in a given window.
   2555 --- Works for off-screen text and takes folds into account.
   2556 ---
   2557 --- Diff filler or virtual lines above a line are counted as a part of that line,
   2558 --- unless the line is on "start_row" and "start_vcol" is specified.
   2559 ---
   2560 --- Diff filler or virtual lines below the last buffer line are counted in the result
   2561 --- when "end_row" is omitted.
   2562 ---
   2563 --- Line indexing is similar to `nvim_buf_get_text()`.
   2564 ---
   2565 --- @see `:help virtcol()` for text width.
   2566 --- @param window integer `window-ID`, or 0 for current window.
   2567 --- @param opts vim.api.keyset.win_text_height Optional parameters:
   2568 --- - start_row: Starting line index, 0-based inclusive.
   2569 ---              When omitted start at the very top.
   2570 --- - end_row: Ending line index, 0-based inclusive.
   2571 ---            When omitted end at the very bottom.
   2572 --- - start_vcol: Starting virtual column index on "start_row",
   2573 ---               0-based inclusive, rounded down to full screen lines.
   2574 ---               When omitted include the whole line.
   2575 --- - end_vcol: Ending virtual column index on "end_row",
   2576 ---             0-based exclusive, rounded up to full screen lines.
   2577 ---             When 0 only include diff filler and virtual lines above
   2578 ---             "end_row". When omitted include the whole line.
   2579 --- - max_height: Don't add the height of lines below the row
   2580 ---               for which this height is reached. Useful to e.g. limit the
   2581 ---               height to the window height, avoiding unnecessary work. Or
   2582 ---               to find out how many buffer lines beyond "start_row" take
   2583 ---               up a certain number of logical lines (returned in
   2584 ---               "end_row" and "end_vcol").
   2585 --- @return vim.api.keyset.win_text_height_ret # Dict containing text height information, with these keys:
   2586 --- - all: The total number of screen lines occupied by the range.
   2587 --- - fill: The number of diff filler or virtual lines among them.
   2588 --- - end_row: The row on which the returned height is reached (first row of
   2589 ---   a closed fold).
   2590 --- - end_vcol: Ending virtual column in "end_row" where "max_height" or the returned
   2591 ---   height is reached. 0 if "end_row" is a closed fold.
   2592 ---
   2593 function vim.api.nvim_win_text_height(window, opts) end