neovim

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

api.txt (173845B)


      1 *api.txt*               Nvim
      2 
      3 
      4                 NVIM REFERENCE MANUAL    by Thiago de Arruda
      5 
      6 
      7 Nvim API                                                           *API* *api*
      8 
      9 Nvim exposes a powerful API that can be used by plugins and external processes
     10 via |RPC|, |Lua| and Vimscript (|eval-api|).
     11 
     12 Applications can also embed libnvim to work with the C API directly.
     13 
     14                                      Type |gO| to see the table of contents.
     15 
     16 ==============================================================================
     17 API Usage                                               *api-rpc* *RPC* *rpc*
     18 
     19                                                        *msgpack-rpc*
     20 RPC is the main way to control Nvim programmatically.  Nvim implements the
     21 MessagePack-RPC protocol with these extra (out-of-spec) constraints:
     22 
     23 1. Responses must be given in reverse order of requests (like "unwinding
     24   a stack").
     25 2. Nvim processes all messages (requests and notifications) in the order they
     26   are received.
     27 
     28 MessagePack-RPC specification:
     29  https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
     30  https://github.com/msgpack/msgpack/blob/0b8f5ac/spec.md
     31 
     32 Many clients use the API: user interfaces (GUIs), remote plugins, scripts like
     33 "nvr" (https://github.com/mhinz/neovim-remote).  Even Nvim itself can control
     34 other Nvim instances.  API clients can:
     35 
     36  - Call any API function
     37  - Listen for events
     38  - Receive remote calls from Nvim
     39 
     40 The RPC API is like a more powerful version of Vim's "clientserver" feature.
     41 
     42 CONNECTING                                              *rpc-connecting*
     43 
     44 See |channel-intro| for various ways to open a channel. Channel-opening
     45 functions take an `rpc` key in the options dict. RPC channels can also be
     46 opened by other processes connecting to TCP/IP sockets or named pipes listened
     47 to by Nvim.
     48 
     49 Nvim creates a default RPC socket at |startup|, given by |v:servername|. To
     50 start with a TCP/IP socket instead, use |--listen| with a TCP-style address: >
     51    nvim --listen 127.0.0.1:6666
     52 More endpoints can be started with |serverstart()|.
     53 
     54 Note that localhost TCP sockets are generally less secure than named pipes,
     55 and can lead to vulnerabilities like remote code execution.
     56 
     57 Connecting to the socket is the easiest way a programmer can test the API,
     58 which can be done through any msgpack-rpc client library or full-featured
     59 |api-client|. Here's a Ruby script that prints "hello world!" in the current
     60 Nvim instance:
     61 >ruby
     62    #!/usr/bin/env ruby
     63    # Requires msgpack-rpc: gem install msgpack-rpc
     64    #
     65    # To run this script, use Nvim's built-in terminal emulator:
     66    #
     67    #   :term ./hello.rb
     68    #
     69    # Or from another shell by setting NVIM:
     70    # $ NVIM=[address] ./hello.rb
     71 
     72    require 'msgpack/rpc'
     73    require 'msgpack/rpc/transport/unix'
     74 
     75    nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM'])
     76    result = nvim.call(:nvim_command, 'echo "hello world!"')
     77 <
     78 A better way is to use the Python REPL with the "pynvim" package, where API
     79 functions can be called interactively:
     80 >
     81    >>> from pynvim import attach
     82    >>> nvim = attach('socket', path='[address]')
     83    >>> nvim.command('echo "hello world!"')
     84 <
     85 You can also embed Nvim via |jobstart()|, and communicate using |rpcrequest()|
     86 and |rpcnotify()|:
     87 >vim
     88    let nvim = jobstart(['nvim', '--embed'], {'rpc': v:true})
     89    echo rpcrequest(nvim, 'nvim_eval', '"Hello " . "world!"')
     90    call jobstop(nvim)
     91 <
     92 
     93 ==============================================================================
     94 API Definitions                                         *api-definitions*
     95 
     96                                                        *api-types*
     97 The Nvim C API defines custom types for all function parameters. Some are just
     98 typedefs around C99 standard types, others are Nvim-defined data structures.
     99 
    100 Basic types ~
    101 >
    102  API Type                              C type
    103  ------------------------------------------------------------------------
    104  Nil
    105  Boolean                               bool
    106  Integer (signed 64-bit integer)       int64_t
    107  Float (IEEE 754 double precision)     double
    108  String                                {char* data, size_t size} struct
    109  Array                                 kvec
    110  Dict (msgpack: map)                   kvec
    111  Object                                any of the above
    112 <
    113  Note:
    114    - Empty Array is accepted as a valid Dictionary parameter.
    115    - Functions cannot cross RPC boundaries. But API functions (e.g.
    116      |nvim_create_autocmd()|) may support Lua function parameters for non-RPC
    117      invocations.
    118 
    119 Special types (msgpack EXT) ~
    120 
    121  These are integer typedefs discriminated as separate Object subtypes. They
    122  can be treated as opaque integers, but are mutually incompatible: Buffer may
    123  be passed as an integer but not as Window or Tabpage.
    124 
    125  The EXT object data is the (integer) object handle. The EXT type codes given
    126  in the |api-metadata| `types` key are stable: they will not change and are
    127  thus forward-compatible.
    128 >
    129  EXT Type      C type                                  Data
    130  ------------------------------------------------------------------------
    131  Buffer        enum value kObjectTypeBuffer            |bufnr()|
    132  Window        enum value kObjectTypeWindow            |window-ID|
    133  Tabpage       enum value kObjectTypeTabpage           internal handle
    134 <
    135 
    136                                                        *api-indexing*
    137 Most of the API uses 0-based indices, and ranges are end-exclusive. For the
    138 end of a range, -1 denotes the last line/column.
    139 
    140 Exception: the following API functions use "mark-like" indexing (1-based
    141 lines, 0-based columns):
    142 
    143 - |nvim_get_mark()|
    144 - |nvim_buf_get_mark()|
    145 - |nvim_buf_set_mark()|
    146 - |nvim_win_get_cursor()|
    147 - |nvim_win_set_cursor()|
    148 
    149 Exception: the following API functions use |extmarks| indexing (0-based
    150 indices, end-inclusive):
    151 
    152 - |nvim_buf_del_extmark()|
    153 - |nvim_buf_get_extmark_by_id()|
    154 - |nvim_buf_get_extmarks()|
    155 - |nvim_buf_set_extmark()|
    156 
    157                                                        *api-fast*
    158 Most API functions are "deferred": they are queued on the main loop and
    159 processed sequentially with normal input.  So if the editor is waiting for
    160 user input in a "modal" fashion (e.g. the |hit-enter-prompt|), the request
    161 will block.  Non-deferred (fast) functions such as |nvim_get_mode()| and
    162 |nvim_input()| are served immediately (i.e. without waiting in the input
    163 queue).  Lua code can use |vim.in_fast_event()| to detect a fast context.
    164 
    165 ==============================================================================
    166 API metadata                                            *api-metadata*
    167 
    168 The Nvim C API is automatically exposed to RPC by the build system, which
    169 parses headers in src/nvim/api/* and generates dispatch-functions mapping RPC
    170 API method names to public C API functions, converting/validating arguments
    171 and return values.
    172 
    173 Nvim exposes its API metadata as a Dictionary with these items:
    174 
    175 - version                 Nvim version, API level/compatibility
    176 - version.api_level       API version integer *api-level*
    177 - version.api_compatible  API is backwards-compatible with this level
    178 - version.api_prerelease  Declares the API as unstable/unreleased
    179                          `(version.api_prerelease && fn.since == version.api_level)`
    180 - functions               API function signatures, containing |api-types| info
    181                          describing the return value and parameters.
    182 - ui_events               |UI| event signatures
    183 - ui_options              Supported |ui-option|s
    184 - {fn}.since              API level where function {fn} was introduced
    185 - {fn}.deprecated_since   API level where function {fn} was deprecated
    186 - types                   Custom handle types defined by Nvim
    187 - error_types             Possible error types returned by API functions
    188 
    189 About the `functions` map:
    190 
    191  - Container types may be decorated with type/size constraints, e.g.
    192    ArrayOf(Buffer) or ArrayOf(Integer, 2).
    193  - Functions considered to be methods that operate on instances of Nvim
    194    special types (msgpack EXT) have the "method=true" flag. The receiver type
    195    is that of the first argument. Method names are prefixed with `nvim_` plus
    196    a type name, e.g. `nvim_buf_get_lines` is the `get_lines` method of
    197    a Buffer instance. |dev-api|
    198  - Global functions have the "method=false" flag and are prefixed with just
    199    `nvim_`, e.g. `nvim_list_bufs`.
    200 
    201                                                        *api-mapping*
    202 External programs (clients) can use the metadata to discover the API, using
    203 any of these approaches:
    204 
    205 1. Connect to a running Nvim instance and call |nvim_get_api_info()| via
    206   msgpack-RPC. This is best for clients written in dynamic languages which
    207   can define functions at runtime.
    208 2. Use the |--api-info| startup arg. Useful for statically-compiled clients.
    209   Example (requires Python "pyyaml" and "msgpack-python" modules): >
    210     nvim --api-info | python -c 'import msgpack, sys, yaml; yaml.dump(msgpack.unpackb(sys.stdin.buffer.read()), sys.stdout)'
    211 3. Use the |api_info()| function. >vim
    212     :lua vim.print(vim.fn.api_info())
    213     " Example using filter() to exclude non-deprecated API functions:
    214     :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val.name')
    215 <
    216 
    217 ==============================================================================
    218 API contract                                                     *api-contract*
    219 
    220 The Nvim API is composed of functions and events.
    221 
    222 - Clients call functions like those described at |api-global|.
    223 - Clients can subscribe to |ui-events|, |api-buffer-updates|, etc.
    224 - API function names are prefixed with "nvim_".
    225 - API event names are prefixed with "nvim_" and suffixed with "_event".
    226 
    227 As Nvim evolves the API may change in compliance with this CONTRACT:
    228 
    229 - New functions and events may be added.
    230  - Any such extensions are OPTIONAL: old clients may ignore them.
    231 - New functions MAY CHANGE before release. Clients can dynamically check
    232  `api_prerelease`, |api-metadata|.
    233 - Function signatures will NOT CHANGE after release, except as follows:
    234  - Map/list parameters/results may be EXTENDED (new fields may be added).
    235    - Such new fields are OPTIONAL: old clients MAY ignore them.
    236    - Existing fields will not be removed.
    237  - Return type MAY CHANGE from void to non-void. Old clients MAY ignore the
    238    new return value.
    239  - An optional `opts` parameter may be ADDED.
    240  - Optional parameters may be ADDED following an `opts` parameter.
    241 - Event parameters will not be removed or reordered (after release).
    242 - Events may be EXTENDED: new parameters may be added.
    243 - Deprecated functions will not be removed until Nvim 2.0.
    244 
    245 "Private" interfaces are NOT covered by this contract:
    246 
    247 - Undocumented (not in :help) functions or events of any kind
    248 - nvim__x ("double underscore") functions
    249 
    250 The idea is "versionless evolution", in the words of Rich Hickey:
    251 - Relaxing a requirement should be a compatible change.
    252 - Strengthening a promise should be a compatible change.
    253 
    254 ==============================================================================
    255 Buffer update events                                    *api-buffer-updates*
    256 
    257 API clients can "attach" to Nvim buffers to subscribe to buffer update events.
    258 This is similar to |TextChanged| but more powerful and granular.
    259 
    260 Call |nvim_buf_attach()| to receive these events on the channel:
    261 
    262                                                        *nvim_buf_lines_event*
    263 nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata}, {more}]
    264 
    265    When the buffer text between {firstline} and {lastline} (end-exclusive,
    266    zero-indexed) were changed to the new text in the {linedata} list. The
    267    granularity is a line, i.e. if a single character is changed in the
    268    editor, the entire line is sent.
    269 
    270    When {changedtick} is |v:null| this means the screen lines (display)
    271    changed but not the buffer contents. {linedata} contains the changed
    272    screen lines. This happens when 'inccommand' shows a buffer preview.
    273 
    274    Properties: ~
    275        {buf} API buffer handle (buffer number)
    276 
    277        {changedtick} value of |b:changedtick| for the buffer. If you send an
    278        API command back to nvim you can check the value of |b:changedtick| as
    279        part of your request to ensure that no other changes have been made.
    280 
    281        {firstline} integer line number of the first line that was replaced.
    282        Zero-indexed: if line 1 was replaced then {firstline} will be zero,
    283        not one. {firstline} is always less than or equal to the number of
    284        lines that were in the buffer before the lines were replaced.
    285 
    286        {lastline} integer line number of the first line that was not replaced
    287        (i.e. the range {firstline}, {lastline} is end-exclusive).
    288        Zero-indexed: if line numbers 2 to 5 were replaced, this will be 5
    289        instead of 6. {lastline} is always be less than or equal to the number
    290        of lines that were in the buffer before the lines were replaced.
    291        {lastline} will be -1 if the event is part of the initial update after
    292        attaching.
    293 
    294        {linedata} list of strings containing the contents of the new buffer
    295        lines. Newline characters are omitted; empty lines are sent as empty
    296        strings.
    297 
    298        {more} boolean, true for a "multipart" change notification: the
    299        current change was chunked into multiple |nvim_buf_lines_event|
    300        notifications (e.g. because it was too big).
    301 
    302 nvim_buf_changedtick_event[{buf}, {changedtick}]  *nvim_buf_changedtick_event*
    303 
    304    When |b:changedtick| was incremented but no text was changed. Relevant for
    305    undo/redo.
    306 
    307    Properties: ~
    308        {buf} API buffer handle (buffer number)
    309        {changedtick} new value of |b:changedtick| for the buffer
    310 
    311 nvim_buf_detach_event[{buf}]                           *nvim_buf_detach_event*
    312 
    313    When buffer is detached (i.e. updates are disabled). Triggered explicitly by
    314    |nvim_buf_detach()| or implicitly in these cases:
    315    - Buffer was |abandon|ed and 'hidden' is not set.
    316    - Buffer was reloaded, e.g. with |:edit| or an external change triggered
    317      |:checktime| or 'autoread'.
    318    - Generally: whenever the buffer contents are unloaded from memory.
    319 
    320    Properties: ~
    321        {buf} API buffer handle (buffer number)
    322 
    323 
    324 EXAMPLE ~
    325 
    326 Calling |nvim_buf_attach()| with send_buffer=true on an empty buffer, emits: >
    327    nvim_buf_lines_event[{buf}, {changedtick}, 0, -1, [""], v:false]
    328 
    329 User adds two lines to the buffer, emits: >
    330    nvim_buf_lines_event[{buf}, {changedtick}, 0, 0, ["line1", "line2"], v:false]
    331 
    332 User moves to a line containing the text "Hello world" and inserts "!", emits: >
    333    nvim_buf_lines_event[{buf}, {changedtick}, {linenr}, {linenr} + 1,
    334                         ["Hello world!"], v:false]
    335 
    336 User moves to line 3 and deletes 20 lines using "20dd", emits: >
    337    nvim_buf_lines_event[{buf}, {changedtick}, 2, 22, [], v:false]
    338 
    339 User selects lines 3-5 using |linewise-visual| mode and then types "p" to
    340 paste a block of 6 lines, emits: >
    341    nvim_buf_lines_event[{buf}, {changedtick}, 2, 5,
    342      ['pasted line 1', 'pasted line 2', 'pasted line 3', 'pasted line 4',
    343       'pasted line 5', 'pasted line 6'],
    344      v:false
    345    ]
    346 
    347 User reloads the buffer with ":edit", emits: >
    348    nvim_buf_detach_event[{buf}]
    349 <
    350 
    351 LUA ~
    352                                                        *api-buffer-updates-lua*
    353 In-process Lua plugins can receive buffer updates in the form of Lua
    354 callbacks. These callbacks are called frequently in various contexts;
    355 |textlock| prevents changing buffer contents and window layout (use
    356 |vim.schedule()| to defer such operations to the main loop instead).
    357 Moving the cursor is allowed, but it is restored afterwards.
    358 
    359 |nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will
    360 receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline},
    361 {new_lastline}, {old_byte_size} [, {old_utf32_size}, {old_utf16_size}]).
    362 Unlike remote channel events the text contents are not passed. The new text can
    363 be accessed inside the callback as >lua
    364 
    365    vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, true)
    366 <
    367 {old_byte_size} is the total size of the replaced region {firstline} to
    368 {lastline} in bytes, including the final newline after {lastline}. if
    369 `utf_sizes` is set to true in |nvim_buf_attach()| keyword args, then the
    370 UTF-32 and UTF-16 sizes of the deleted region is also passed as additional
    371 arguments {old_utf32_size} and {old_utf16_size}.
    372 
    373 "on_changedtick" is invoked when |b:changedtick| was incremented but no text
    374 was changed. The parameters received are ("changedtick", {buf}, {changedtick}).
    375 
    376                                                        *api-lua-detach*
    377 In-process Lua callbacks can detach by returning `true`. This will detach all
    378 callbacks attached with the same |nvim_buf_attach()| call.
    379 
    380 
    381 ==============================================================================
    382 Buffer highlighting                                            *api-highlights*
    383 
    384 Nvim allows plugins to add position-based highlights to buffers. This is
    385 similar to |matchaddpos()| but with some key differences. The added highlights
    386 are associated with a buffer and adapts to line insertions and deletions,
    387 similar to signs. It is also possible to manage a set of highlights as a group
    388 and delete or replace all at once.
    389 
    390 The intended use case are linter or semantic highlighter plugins that monitor
    391 a buffer for changes, and in the background compute highlights to the buffer.
    392 Another use case are plugins that show output in an append-only buffer, and
    393 want to add highlights to the outputs. Highlight data cannot be preserved
    394 on writing and loading a buffer to file, nor in undo/redo cycles.
    395 
    396 Highlights are registered using the |nvim_buf_set_extmark()| function, which
    397 adds highlights as |extmarks|. If highlights need to be tracked or manipulated
    398 after adding them, the returned |extmark| id can be used. >lua
    399  -- create the highlight through an extmark
    400  extid = vim.api.nvim_buf_set_extmark(buf, ns_id, line, col_start, {end_col = col_end, hl_group = hl_group})
    401 
    402  -- example: modify the extmark's highlight group
    403  vim.api.nvim_buf_set_extmark(buf, ns_id, line, col_start, {end_col = col_end, hl_group = NEW_HL_GROUP, id = extid})
    404 
    405  -- example: change the highlight's position
    406  vim.api.nvim_buf_set_extmark(buf, ns_id, NEW_LINE, col_start, {end_col = col_end, hl_group = NEW_HL_GROUP, id = extid})
    407 <
    408 
    409 See also |vim.hl.range()|.
    410 
    411 ==============================================================================
    412 Floating windows				*api-floatwin* *floating-windows*
    413 
    414 Floating windows ("floats") are displayed on top of normal windows.  This is
    415 useful to implement simple widgets, such as tooltips displayed next to the
    416 cursor. Floats are fully functional windows supporting user editing, common
    417 |api-window| calls, and most window options (except 'statusline').
    418 
    419 Two ways to create a floating window:
    420 - |nvim_open_win()| creates a new window (needs a buffer, see |nvim_create_buf()|)
    421 - |nvim_win_set_config()| reconfigures a normal window into a float
    422 
    423 To close it use |nvim_win_close()| or a command such as |:close|.
    424 
    425 To check whether a window is floating, check whether the `relative` option in
    426 its config is non-empty: >lua
    427 
    428    if vim.api.nvim_win_get_config(window_id).relative ~= '' then
    429      -- window with this window_id is floating
    430    end
    431 <
    432 
    433 Buffer text can be highlighted by typical mechanisms (syntax highlighting,
    434 |api-highlights|). The |hl-NormalFloat| group highlights normal text;
    435 'winhighlight' can be used as usual to override groups locally. Floats inherit
    436 options from the current window; specify `style=minimal` in |nvim_open_win()|
    437 to disable various visual features such as the 'number' column.
    438 
    439 Other highlight groups specific to floating windows:
    440 - |hl-FloatBorder| for window's border
    441 - |hl-FloatTitle| for window's title
    442 - |hl-FloatFooter| for window's footer
    443 
    444 Currently, floating windows don't support some widgets like scrollbar.
    445 
    446 The output of |:mksession| does not include commands for restoring floating
    447 windows.
    448 
    449 Example: create a float with scratch buffer: >vim
    450 
    451    let buf = nvim_create_buf(v:false, v:true)
    452    call nvim_buf_set_lines(buf, 0, -1, v:true, ["test", "text"])
    453    let opts = {'relative': 'cursor', 'width': 10, 'height': 2, 'col': 0,
    454        \ 'row': 1, 'anchor': 'NW', 'style': 'minimal'}
    455    let win = nvim_open_win(buf, 0, opts)
    456    " optional: change highlight, otherwise Pmenu is used
    457    call nvim_set_option_value('winhl', 'Normal:MyHighlight', {'win': win})
    458 <
    459 
    460 ==============================================================================
    461 Extended marks                       *api-extended-marks* *extmarks* *extmark*
    462 
    463 Extended marks (extmarks) represent buffer annotations that track text changes
    464 in the buffer. They can represent cursors, folds, misspelled words, anything
    465 that needs to track a logical location in the buffer over time. |api-indexing|
    466 
    467 Extmark position works like a "vertical bar" cursor: it exists between
    468 characters. Thus, the maximum extmark index on a line is 1 more than the
    469 character index: >
    470 
    471     f o o b a r      line contents
    472     0 1 2 3 4 5      character positions (0-based)
    473    0 1 2 3 4 5 6     extmark positions (0-based)
    474 
    475 Extmarks have "forward gravity": if you place the cursor directly on an
    476 extmark position and enter some text, the extmark migrates forward. >
    477 
    478     f o o|b a r      line (| = cursor)
    479          3           extmark
    480 
    481     f o o z|b a r    line (| = cursor)
    482            4         extmark (after typing "z")
    483 
    484 If an extmark is on the last index of a line and you input a newline at that
    485 point, the extmark will accordingly migrate to the next line: >
    486 
    487     f o o z b a r|   line (| = cursor)
    488                  7   extmark
    489 
    490     f o o z b a r    first line
    491                      extmarks (none present)
    492     |                second line (| = cursor)
    493     0                extmark (after typing <CR>)
    494 
    495 
    496 Example:
    497 
    498 Let's set an extmark at the first row (row=0) and third column (column=2).
    499 |api-indexing| Passing id=0 creates a new mark and returns the id: >
    500 
    501      01 2345678
    502    0 ex|ample..
    503        ^ extmark position
    504 <
    505 >vim
    506    let g:mark_ns = nvim_create_namespace('myplugin')
    507    let g:mark_id = nvim_buf_set_extmark(0, g:mark_ns, 0, 2, {})
    508 <
    509 We can get the mark by its id: >vim
    510 
    511    echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {})
    512    " => [0, 2]
    513 
    514 We can get all marks in a buffer by |namespace| (or by a range): >vim
    515 
    516    echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1, {})
    517    " => [[1, 0, 2]]
    518 
    519 Deleting all surrounding text does NOT remove an extmark! To remove extmarks
    520 use |nvim_buf_del_extmark()|. Deleting "x" in our example: >
    521 
    522      0 12345678
    523    0 e|ample..
    524       ^ extmark position
    525 <
    526 >vim
    527    echo nvim_buf_get_extmark_by_id(0, g:mark_ns, g:mark_id, {})
    528    " => [0, 1]
    529 <
    530    Note: Extmark "gravity" decides how it will shift after a text edit.
    531          See |nvim_buf_set_extmark()|
    532 
    533 Namespaces allow any plugin to manage only its own extmarks, ignoring those
    534 created by another plugin.
    535 
    536 Extmark positions changed by an edit will be restored on undo/redo. Creating
    537 and deleting extmarks is not a buffer change, thus new undo states are not
    538 created for extmark changes.
    539 
    540 ==============================================================================
    541 Global Events                                                     *api-events*
    542 
    543 nvim_error_event({type}, {msg})                             *nvim_error_event*
    544    Emitted on the client channel if an async API request responds with an
    545    error.
    546 
    547    Attributes: ~
    548        |RPC| only
    549 
    550    Parameters: ~
    551      • {type}  (`integer`) Error type id as defined by
    552                `api_info().error_types`.
    553      • {msg}   (`string`) Error message.
    554 
    555 nvim_ui_term_event({event}, {value})                      *nvim_ui_term_event*
    556    Emitted by the TUI client to signal when a host-terminal event occurred.
    557 
    558    Supports these events:
    559    • "termresponse": The host-terminal sent a DA1, OSC, DCS, or APC response
    560      sequence to Nvim. The payload is the received response. Sets
    561      |v:termresponse| and fires |TermResponse|.
    562 
    563    Attributes: ~
    564        |RPC| only
    565        Since: 0.10.0
    566 
    567    Parameters: ~
    568      • {event}  (`string`) Event name
    569      • {value}  (`any`) Event payload
    570 
    571 
    572 ==============================================================================
    573 Global Functions                                                  *api-global*
    574 
    575 nvim_chan_send({chan}, {data})                              *nvim_chan_send()*
    576    Sends raw data to channel `chan`. |channel-bytes|
    577    • For a job, it writes it to the stdin of the process.
    578    • For the stdio channel |channel-stdio|, it writes to Nvim's stdout.
    579    • For an internal terminal instance (|nvim_open_term()|) it writes
    580      directly to terminal output.
    581 
    582    This function writes raw data, not RPC messages. Use |vim.rpcrequest()|
    583    and |vim.rpcnotify()| if the channel expects RPC messages (i.e. it was
    584    created with `rpc=true`).
    585 
    586    To write data to the |TUI| host terminal, see |nvim_ui_send()|.
    587 
    588    Attributes: ~
    589        |RPC| only
    590        Lua |vim.api| only
    591        Since: 0.5.0
    592 
    593    Parameters: ~
    594      • {chan}  (`integer`) Channel id
    595      • {data}  (`string`) Data to write. 8-bit clean: may contain NUL bytes.
    596 
    597 nvim_create_buf({listed}, {scratch})                       *nvim_create_buf()*
    598    Creates a new, empty, unnamed buffer.
    599 
    600    Attributes: ~
    601        Since: 0.4.0
    602 
    603    Parameters: ~
    604      • {listed}   (`boolean`) Sets 'buflisted'
    605      • {scratch}  (`boolean`) Creates a "throwaway" |scratch-buffer| for
    606                   temporary work (always 'nomodified'). Also sets
    607                   'nomodeline' on the buffer.
    608 
    609    Return: ~
    610        (`integer`) Buffer id, or 0 on error
    611 
    612    See also: ~
    613      • buf_open_scratch
    614 
    615 nvim_del_current_line()                              *nvim_del_current_line()*
    616    Deletes the current line.
    617 
    618    Attributes: ~
    619        not allowed when |textlock| is active
    620        Since: 0.1.0
    621 
    622 nvim_del_keymap({mode}, {lhs})                             *nvim_del_keymap()*
    623    Unmaps a global |mapping| for the given mode.
    624 
    625    To unmap a buffer-local mapping, use |nvim_buf_del_keymap()|.
    626 
    627    Attributes: ~
    628        Since: 0.4.0
    629 
    630    Parameters: ~
    631      • {mode}  (`string`)
    632      • {lhs}   (`string`)
    633 
    634    See also: ~
    635      • |nvim_set_keymap()|
    636 
    637 nvim_del_mark({name})                                        *nvim_del_mark()*
    638    Deletes an uppercase/file named mark. See |mark-motions|.
    639 
    640    Note: ~
    641      • Lowercase name (or other buffer-local mark) is an error.
    642 
    643    Attributes: ~
    644        Since: 0.6.0
    645 
    646    Parameters: ~
    647      • {name}  (`string`) Mark name
    648 
    649    Return: ~
    650        (`boolean`) true if the mark was deleted, else false.
    651 
    652    See also: ~
    653      • |nvim_buf_del_mark()|
    654      • |nvim_get_mark()|
    655 
    656 nvim_del_var({name})                                          *nvim_del_var()*
    657    Removes a global (g:) variable.
    658 
    659    Attributes: ~
    660        Since: 0.1.0
    661 
    662    Parameters: ~
    663      • {name}  (`string`) Variable name
    664 
    665 nvim_echo({chunks}, {history}, {opts})                           *nvim_echo()*
    666    Prints a message given by a list of `[text, hl_group]` "chunks".
    667 
    668    Example: >lua
    669        vim.api.nvim_echo({ { 'chunk1-line1\nchunk1-line2\n' }, { 'chunk2-line1' } }, true, {})
    670 <
    671 
    672    Attributes: ~
    673        Since: 0.5.0
    674 
    675    Parameters: ~
    676      • {chunks}   (`[string, integer|string?][]`) List of `[text, hl_group]`
    677                   pairs, where each is a `text` string highlighted by the
    678                   (optional) name or ID `hl_group`.
    679      • {history}  (`boolean`) if true, add to |message-history|.
    680      • {opts}     (`vim.api.keyset.echo_opts`) Optional parameters.
    681                   • id: message id for updating existing message.
    682                   • err: Treat the message like `:echoerr`. Sets `hl_group`
    683                     to |hl-ErrorMsg| by default.
    684                   • kind: Set the |ui-messages| kind with which this message
    685                     will be emitted.
    686                   • verbose: Message is controlled by the 'verbose' option.
    687                     Nvim invoked with `-V3log` will write the message to the
    688                     "log" file instead of standard output.
    689                   • title: The title for |progress-message|.
    690                   • status: Current status of the |progress-message|. Can be
    691                     one of the following values
    692                     • success: The progress item completed successfully
    693                     • running: The progress is ongoing
    694                     • failed: The progress item failed
    695                     • cancel: The progressing process should be canceled.
    696                       NOTE: Cancel must be handled by progress initiator by
    697                       listening for the `Progress` event
    698                   • percent: How much progress is done on the progress
    699                     message
    700                   • data: dictionary containing additional information
    701 
    702    Return: ~
    703        (`integer|string`) Message id.
    704        • -1 means nvim_echo didn't show a message
    705 
    706 nvim_eval_statusline({str}, {opts})                   *nvim_eval_statusline()*
    707    Evaluates statusline string.
    708 
    709    Attributes: ~
    710        |api-fast|
    711        Since: 0.6.0
    712 
    713    Parameters: ~
    714      • {str}   (`string`) Statusline string (see 'statusline').
    715      • {opts}  (`vim.api.keyset.eval_statusline`) Optional parameters.
    716                • winid: (number) |window-ID| of the window to use as context
    717                  for statusline.
    718                • maxwidth: (number) Maximum width of statusline.
    719                • fillchar: (string) Character to fill blank spaces in the
    720                  statusline (see 'fillchars'). Treated as single-width even
    721                  if it isn't.
    722                • highlights: (boolean) Return highlight information.
    723                • use_winbar: (boolean) Evaluate winbar instead of statusline.
    724                • use_tabline: (boolean) Evaluate tabline instead of
    725                  statusline. When true, {winid} is ignored. Mutually
    726                  exclusive with {use_winbar}.
    727                • use_statuscol_lnum: (number) Evaluate statuscolumn for this
    728                  line number instead of statusline.
    729 
    730    Return: ~
    731        (`vim.api.keyset.eval_statusline_ret`) Dict containing statusline
    732        information, with these keys:
    733        • str: (string) Characters that will be displayed on the statusline.
    734        • width: (number) Display width of the statusline.
    735        • highlights: Array containing highlight information of the
    736          statusline. Only included when the "highlights" key in {opts} is
    737          true. Each element of the array is a |Dict| with these keys:
    738          • start: (number) Byte index (0-based) of first character that uses
    739            the highlight.
    740          • group: (string) Deprecated. Use `groups` instead.
    741          • groups: (array) Names of stacked highlight groups (highest
    742            priority last).
    743 
    744 nvim_exec_lua({code}, {args})                                *nvim_exec_lua()*
    745    Executes Lua code. Arguments are available as `...` inside the chunk. The
    746    chunk can return a value.
    747 
    748    Only statements are executed. To evaluate an expression, prefix it with
    749    "return": `return my_function(...)`
    750 
    751    Example: >lua
    752        local peer = vim.fn.jobstart({ vim.v.progpath, '--clean', '--embed' }, { rpc=true })
    753        vim.print(vim.rpcrequest(peer, 'nvim_exec_lua', [[
    754              local a, b = ...
    755              return ('result: %s'):format(a + b)
    756            ]],
    757            { 1, 3 }
    758          )
    759        )
    760 <
    761 
    762    Attributes: ~
    763        |RPC| only
    764        Since: 0.5.0
    765 
    766    Parameters: ~
    767      • {code}  (`string`) Lua code to execute.
    768      • {args}  (`any[]`) Arguments to the Lua code.
    769 
    770    Return: ~
    771        (`any`) Value returned by the Lua code (if any), or NIL.
    772 
    773 nvim_feedkeys({keys}, {mode}, {escape_ks})                   *nvim_feedkeys()*
    774    Sends input-keys to Nvim, subject to various quirks controlled by `mode`
    775    flags. This is a blocking call, unlike |nvim_input()|.
    776 
    777    On execution error: does not fail, but updates v:errmsg.
    778 
    779    To input sequences like <C-o> use |nvim_replace_termcodes()| (typically
    780    with escape_ks=false) to replace |keycodes|, then pass the result to
    781    nvim_feedkeys().
    782 
    783    Example: >vim
    784        :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
    785        :call nvim_feedkeys(key, 'n', v:false)
    786 <
    787 
    788    Attributes: ~
    789        Since: 0.1.0
    790 
    791    Parameters: ~
    792      • {keys}       (`string`) to be typed
    793      • {mode}       (`string`) behavior flags, see |feedkeys()|
    794      • {escape_ks}  (`boolean`) If true, escape K_SPECIAL bytes in `keys`.
    795                     This should be false if you already used
    796                     |nvim_replace_termcodes()|, and true otherwise.
    797 
    798    See also: ~
    799      • feedkeys()
    800      • vim_strsave_escape_ks
    801 
    802 nvim_get_api_info()                                      *nvim_get_api_info()*
    803    Returns a 2-tuple (Array), where item 0 is the current channel id and item
    804    1 is the |api-metadata| map (Dict).
    805 
    806    Attributes: ~
    807        |api-fast|
    808        |RPC| only
    809        Since: 0.1.0
    810 
    811    Return: ~
    812        (`[any, any]`) 2-tuple `[{channel-id}, {api-metadata}]`
    813 
    814 nvim_get_chan_info({chan})                              *nvim_get_chan_info()*
    815    Gets information about a channel.
    816 
    817    See |nvim_list_uis()| for an example of how to get channel info.
    818 
    819    Attributes: ~
    820        Since: 0.3.0
    821 
    822    Parameters: ~
    823      • {chan}  (`integer`) channel_id, or 0 for current channel
    824 
    825    Return: ~
    826        (`table<string,any>`) Channel info dict with these keys:
    827        • "id" Channel id.
    828        • "argv" (optional) Job arguments list.
    829        • "stream" Stream underlying the channel.
    830          • "stdio" stdin and stdout of this Nvim instance
    831          • "stderr" stderr of this Nvim instance
    832          • "socket" TCP/IP socket or named pipe
    833          • "job" Job with communication over its stdio.
    834        • "mode" How data received on the channel is interpreted.
    835          • "bytes" Send and receive raw bytes.
    836          • "terminal" |terminal| instance interprets ASCII sequences.
    837          • "rpc" |RPC| communication on the channel is active.
    838        • "pty" (optional) Name of pseudoterminal. On a POSIX system this is a
    839          device path like "/dev/pts/1". If unknown, the key will still be
    840          present if a pty is used (e.g. for conpty on Windows).
    841        • "buffer" (optional) Buffer connected to |terminal| instance.
    842        • "client" (optional) Info about the peer (client on the other end of
    843          the channel), as set by |nvim_set_client_info()|.
    844 
    845 nvim_get_color_by_name({name})                      *nvim_get_color_by_name()*
    846    Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or
    847    "#rrggbb" hexadecimal string.
    848 
    849    Example: >vim
    850        :echo nvim_get_color_by_name("Pink")
    851        :echo nvim_get_color_by_name("#cbcbcb")
    852 <
    853 
    854    Attributes: ~
    855        Since: 0.1.0
    856 
    857    Parameters: ~
    858      • {name}  (`string`) Color name or "#rrggbb" string
    859 
    860    Return: ~
    861        (`integer`) 24-bit RGB value, or -1 for invalid argument.
    862 
    863 nvim_get_color_map()                                    *nvim_get_color_map()*
    864    Returns a map of color names and RGB values.
    865 
    866    Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
    867    (e.g. 65535).
    868 
    869    Attributes: ~
    870        Since: 0.1.0
    871 
    872    Return: ~
    873        (`table<string,integer>`) Map of color names and RGB values.
    874 
    875 nvim_get_context({opts})                                  *nvim_get_context()*
    876    Gets a map of the current editor state.
    877 
    878    Attributes: ~
    879        Since: 0.4.0
    880 
    881    Parameters: ~
    882      • {opts}  (`vim.api.keyset.context`) Optional parameters.
    883                • types: List of |context-types| ("regs", "jumps", "bufs",
    884                  "gvars", …) to gather, or empty for "all".
    885 
    886    Return: ~
    887        (`table<string,any>`) map of global |context|.
    888 
    889 nvim_get_current_buf()                                *nvim_get_current_buf()*
    890    Gets the current buffer.
    891 
    892    Attributes: ~
    893        Since: 0.1.0
    894 
    895    Return: ~
    896        (`integer`) Buffer id
    897 
    898 nvim_get_current_line()                              *nvim_get_current_line()*
    899    Gets the current line.
    900 
    901    Attributes: ~
    902        Since: 0.1.0
    903 
    904    Return: ~
    905        (`string`) Current line string
    906 
    907 nvim_get_current_tabpage()                        *nvim_get_current_tabpage()*
    908    Gets the current tabpage.
    909 
    910    Attributes: ~
    911        Since: 0.1.0
    912 
    913    Return: ~
    914        (`integer`) |tab-ID|
    915 
    916 nvim_get_current_win()                                *nvim_get_current_win()*
    917    Gets the current window.
    918 
    919    Attributes: ~
    920        Since: 0.1.0
    921 
    922    Return: ~
    923        (`integer`) |window-ID|
    924 
    925 nvim_get_hl({ns_id}, {opts})                                   *nvim_get_hl()*
    926    Gets all or specific highlight groups in a namespace.
    927 
    928    Note: ~
    929      • When the `link` attribute is defined in the highlight definition map,
    930        other attributes will not be taking effect (see |:hi-link|).
    931 
    932    Attributes: ~
    933        Since: 0.9.0
    934 
    935    Parameters: ~
    936      • {ns_id}  (`integer`) Get highlight groups for namespace ns_id
    937                 |nvim_get_namespaces()|. Use 0 to get global highlight groups
    938                 |:highlight|.
    939      • {opts}   (`vim.api.keyset.get_highlight`) Options dict:
    940                 • name: (string) Get a highlight definition by name.
    941                 • id: (integer) Get a highlight definition by id.
    942                 • link: (boolean, default true) Show linked group name
    943                   instead of effective definition |:hi-link|.
    944                 • create: (boolean, default true) When highlight group
    945                   doesn't exist create it.
    946 
    947    Return: ~
    948        (`vim.api.keyset.get_hl_info`) Highlight groups as a map from group
    949        name to a highlight definition map as in |nvim_set_hl()|, or only a
    950        single highlight definition map if requested by name or id.
    951 
    952 nvim_get_hl_id_by_name({name})                      *nvim_get_hl_id_by_name()*
    953    Gets a highlight group by name
    954 
    955    similar to |hlID()|, but allocates a new ID if not present.
    956 
    957    Attributes: ~
    958        Since: 0.5.0
    959 
    960    Parameters: ~
    961      • {name}  (`string`)
    962 
    963    Return: ~
    964        (`integer`)
    965 
    966 nvim_get_hl_ns({opts})                                      *nvim_get_hl_ns()*
    967    Gets the active highlight namespace.
    968 
    969    Attributes: ~
    970        Since: 0.10.0
    971 
    972    Parameters: ~
    973      • {opts}  (`vim.api.keyset.get_ns`) Optional parameters
    974                • winid: (number) |window-ID| for retrieving a window's
    975                  highlight namespace. A value of -1 is returned when
    976                  |nvim_win_set_hl_ns()| has not been called for the window
    977                  (or was called with a namespace of -1).
    978 
    979    Return: ~
    980        (`integer`) Namespace id, or -1
    981 
    982 nvim_get_keymap({mode})                                    *nvim_get_keymap()*
    983    Gets a list of global (non-buffer-local) |mapping| definitions.
    984 
    985    Attributes: ~
    986        Since: 0.2.1
    987 
    988    Parameters: ~
    989      • {mode}  (`string`) Mode short-name ("n", "i", "v", ...)
    990 
    991    Return: ~
    992        (`vim.api.keyset.get_keymap[]`) Array of |maparg()|-like dictionaries
    993        describing mappings. The "buffer" key is always zero.
    994 
    995 nvim_get_mark({name}, {opts})                                *nvim_get_mark()*
    996    Returns a `(row, col, buffer, buffername)` tuple representing the position
    997    of the uppercase/file named mark. "End of line" column position is
    998    returned as |v:maxcol| (big number). See |mark-motions|.
    999 
   1000    Marks are (1,0)-indexed. |api-indexing|
   1001 
   1002    Note: ~
   1003      • Lowercase name (or other buffer-local mark) is an error.
   1004 
   1005    Attributes: ~
   1006        Since: 0.6.0
   1007 
   1008    Parameters: ~
   1009      • {name}  (`string`) Mark name
   1010      • {opts}  (`vim.api.keyset.empty`) Optional parameters. Reserved for
   1011                future use.
   1012 
   1013    Return: ~
   1014        (`[integer, integer, integer, string]`) 4-tuple (row, col, buffer,
   1015        buffername), (0, 0, 0, '') if the mark is not set.
   1016 
   1017    See also: ~
   1018      • |nvim_buf_set_mark()|
   1019      • |nvim_del_mark()|
   1020 
   1021 nvim_get_mode()                                              *nvim_get_mode()*
   1022    Gets the current mode. |mode()| "blocking" is true if Nvim is waiting for
   1023    input.
   1024 
   1025    Attributes: ~
   1026        |api-fast|
   1027        Since: 0.2.0
   1028 
   1029    Return: ~
   1030        (`vim.api.keyset.get_mode`) Dict { "mode": String, "blocking": Boolean
   1031        }
   1032 
   1033 nvim_get_proc({pid})                                         *nvim_get_proc()*
   1034    Gets info describing process `pid`.
   1035 
   1036    Attributes: ~
   1037        Since: 0.3.0
   1038 
   1039    Parameters: ~
   1040      • {pid}  (`integer`)
   1041 
   1042    Return: ~
   1043        (`any`) Map of process properties, or NIL if process not found.
   1044 
   1045 nvim_get_proc_children({pid})                       *nvim_get_proc_children()*
   1046    Gets the immediate children of process `pid`.
   1047 
   1048    Attributes: ~
   1049        Since: 0.3.0
   1050 
   1051    Parameters: ~
   1052      • {pid}  (`integer`)
   1053 
   1054    Return: ~
   1055        (`any[]`) Array of child process ids, empty if process not found.
   1056 
   1057 nvim_get_runtime_file({name}, {all})                 *nvim_get_runtime_file()*
   1058    Finds files in runtime directories, in 'runtimepath' order.
   1059 
   1060    "name" can contain wildcards. For example
   1061    `nvim_get_runtime_file("colors/*.{vim,lua}", true)` will return all color
   1062    scheme files. Always use forward slashes (/) in the search pattern for
   1063    subdirectories regardless of platform.
   1064 
   1065    It is not an error to not find any files. An empty array is returned then.
   1066 
   1067    Attributes: ~
   1068        |api-fast|
   1069        Since: 0.5.0
   1070 
   1071    Parameters: ~
   1072      • {name}  (`string`) pattern of files to search for
   1073      • {all}   (`boolean`) whether to return all matches or only the first
   1074 
   1075    Return: ~
   1076        (`string[]`) list of absolute paths to the found files
   1077 
   1078 nvim_get_var({name})                                          *nvim_get_var()*
   1079    Gets a global (g:) variable.
   1080 
   1081    Attributes: ~
   1082        Since: 0.1.0
   1083 
   1084    Parameters: ~
   1085      • {name}  (`string`) Variable name
   1086 
   1087    Return: ~
   1088        (`any`) Variable value
   1089 
   1090 nvim_get_vvar({name})                                        *nvim_get_vvar()*
   1091    Gets a v: variable.
   1092 
   1093    Attributes: ~
   1094        Since: 0.1.0
   1095 
   1096    Parameters: ~
   1097      • {name}  (`string`) Variable name
   1098 
   1099    Return: ~
   1100        (`any`) Variable value
   1101 
   1102 nvim_input({keys})                                              *nvim_input()*
   1103    Queues raw user-input. Unlike |nvim_feedkeys()|, this uses a low-level
   1104    input buffer and the call is non-blocking (input is processed
   1105    asynchronously by the eventloop).
   1106 
   1107    To input blocks of text, |nvim_paste()| is much faster and should be
   1108    preferred.
   1109 
   1110    On execution error: does not fail, but updates v:errmsg.
   1111 
   1112    Note: ~
   1113      • |keycodes| like <CR> are translated, so "<" is special. To input a
   1114        literal "<", send <LT>.
   1115      • For mouse events use |nvim_input_mouse()|. The pseudokey form
   1116        `<LeftMouse><col,row>` is deprecated since |api-level| 6.
   1117 
   1118    Attributes: ~
   1119        |api-fast|
   1120        Since: 0.1.0
   1121 
   1122    Parameters: ~
   1123      • {keys}  (`string`) to be typed
   1124 
   1125    Return: ~
   1126        (`integer`) Number of bytes actually written (can be fewer than
   1127        requested if the buffer becomes full).
   1128 
   1129                                                          *nvim_input_mouse()*
   1130 nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
   1131    Send mouse event from GUI.
   1132 
   1133    Non-blocking: does not wait on any result, but queues the event to be
   1134    processed soon by the event loop.
   1135 
   1136    Note: ~
   1137      • Currently this doesn't support "scripting" multiple mouse events by
   1138        calling it multiple times in a loop: the intermediate mouse positions
   1139        will be ignored. It should be used to implement real-time mouse input
   1140        in a GUI. The deprecated pseudokey form (`<LeftMouse><col,row>`) of
   1141        |nvim_input()| has the same limitation.
   1142 
   1143    Attributes: ~
   1144        |api-fast|
   1145        Since: 0.4.0
   1146 
   1147    Parameters: ~
   1148      • {button}    (`string`) Mouse button: one of "left", "right", "middle",
   1149                    "wheel", "move", "x1", "x2".
   1150      • {action}    (`string`) For ordinary buttons, one of "press", "drag",
   1151                    "release". For the wheel, one of "up", "down", "left",
   1152                    "right". Ignored for "move".
   1153      • {modifier}  (`string`) String of modifiers each represented by a
   1154                    single char. The same specifiers are used as for a key
   1155                    press, except that the "-" separator is optional, so
   1156                    "C-A-", "c-a" and "CA" can all be used to specify
   1157                    Ctrl+Alt+click.
   1158      • {grid}      (`integer`) Grid number (used by |ui-multigrid| client),
   1159                    or 0 to let Nvim decide positioning of windows. For more
   1160                    information, see |dev-ui-multigrid|
   1161      • {row}       (`integer`) Mouse row-position (zero-based, like redraw
   1162                    events)
   1163      • {col}       (`integer`) Mouse column-position (zero-based, like redraw
   1164                    events)
   1165 
   1166 nvim_list_bufs()                                            *nvim_list_bufs()*
   1167    Gets the current list of buffers.
   1168 
   1169    Includes unlisted (unloaded/deleted) buffers, like `:ls!`. Use
   1170    |nvim_buf_is_loaded()| to check if a buffer is loaded.
   1171 
   1172    Attributes: ~
   1173        Since: 0.1.0
   1174 
   1175    Return: ~
   1176        (`integer[]`) List of buffer ids
   1177 
   1178 nvim_list_chans()                                          *nvim_list_chans()*
   1179    Get information about all open channels.
   1180 
   1181    Attributes: ~
   1182        Since: 0.3.0
   1183 
   1184    Return: ~
   1185        (`table<string,any>[]`) Array of Dictionaries, each describing a
   1186        channel with the format specified at |nvim_get_chan_info()|.
   1187 
   1188 nvim_list_runtime_paths()                          *nvim_list_runtime_paths()*
   1189    Gets the paths contained in |runtime-search-path|.
   1190 
   1191    Attributes: ~
   1192        Since: 0.1.0
   1193 
   1194    Return: ~
   1195        (`string[]`) List of paths
   1196 
   1197 nvim_list_tabpages()                                    *nvim_list_tabpages()*
   1198    Gets the current list of |tab-ID|s.
   1199 
   1200    Attributes: ~
   1201        Since: 0.1.0
   1202 
   1203    Return: ~
   1204        (`integer[]`) List of |tab-ID|s
   1205 
   1206 nvim_list_uis()                                              *nvim_list_uis()*
   1207    Gets a list of dictionaries representing attached UIs.
   1208 
   1209    Example: The Nvim builtin |TUI| sets its channel info as described in
   1210    |startup-tui|. In particular, it sets `client.name` to "nvim-tui". So you
   1211    can check if the TUI is running by inspecting the client name of each UI: >lua
   1212        vim.print(vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan).client.name)
   1213 <
   1214 
   1215    Attributes: ~
   1216        Since: 0.3.0
   1217 
   1218    Return: ~
   1219        (`table<string,any>[]`) Array of UI dictionaries, each with these
   1220        keys:
   1221        • "height" Requested height of the UI
   1222        • "width" Requested width of the UI
   1223        • "rgb" true if the UI uses RGB colors (false implies |cterm-colors|)
   1224        • "ext_..." Requested UI extensions, see |ui-option|
   1225        • "chan" |channel-id| of remote UI
   1226 
   1227 nvim_list_wins()                                            *nvim_list_wins()*
   1228    Gets the current list of all |window-ID|s in all tabpages.
   1229 
   1230    Attributes: ~
   1231        Since: 0.1.0
   1232 
   1233    Return: ~
   1234        (`integer[]`) List of |window-ID|s
   1235 
   1236 nvim_load_context({dict})                                *nvim_load_context()*
   1237    Sets the current editor state from the given |context| map.
   1238 
   1239    Attributes: ~
   1240        Since: 0.4.0
   1241 
   1242    Parameters: ~
   1243      • {dict}  (`table<string,any>`) |Context| map.
   1244 
   1245    Return: ~
   1246        (`any`)
   1247 
   1248 nvim_open_term({buffer}, {opts})                            *nvim_open_term()*
   1249    Open a terminal instance in a buffer
   1250 
   1251    By default (and currently the only option) the terminal will not be
   1252    connected to an external process. Instead, input sent on the channel will
   1253    be echoed directly by the terminal. This is useful to display ANSI
   1254    terminal sequences returned as part of an RPC message, or similar.
   1255 
   1256    Note: to directly initiate the terminal using the right size, display the
   1257    buffer in a configured window before calling this. For instance, for a
   1258    floating display, first create an empty buffer using |nvim_create_buf()|,
   1259    then display it using |nvim_open_win()|, and then call this function. Then
   1260    |nvim_chan_send()| can be called immediately to process sequences in a
   1261    virtual terminal having the intended size.
   1262 
   1263    Example: this `TermHl` command can be used to display and highlight raw
   1264    ANSI termcodes, so you can use Nvim as a "scrollback pager" (for terminals
   1265    like kitty):                     *ansi-colorize* *terminal-scrollback-pager* >lua
   1266        vim.api.nvim_create_user_command('TermHl', function()
   1267          vim.api.nvim_open_term(0, {})
   1268        end, { desc = 'Highlights ANSI termcodes in curbuf' })
   1269 <
   1270 
   1271    Attributes: ~
   1272        not allowed when |textlock| is active
   1273        Since: 0.5.0
   1274 
   1275    Parameters: ~
   1276      • {buffer}  (`integer`) Buffer to use. Buffer contents (if any) will be
   1277                  written to the PTY.
   1278      • {opts}    (`vim.api.keyset.open_term`) Optional parameters.
   1279                  • on_input: Lua callback for input sent, i e keypresses in
   1280                    terminal mode. Note: keypresses are sent raw as they would
   1281                    be to the pty master end. For instance, a carriage return
   1282                    is sent as a "\r", not as a "\n". |textlock| applies. It
   1283                    is possible to call |nvim_chan_send()| directly in the
   1284                    callback however. `["input", term, bufnr, data]`
   1285                  • force_crlf: (boolean, default true) Convert "\n" to
   1286                    "\r\n".
   1287 
   1288    Return: ~
   1289        (`integer`) Channel id, or 0 on error
   1290 
   1291 nvim_paste({data}, {crlf}, {phase})                             *nvim_paste()*
   1292    Pastes at cursor (in any mode), and sets "redo" so dot (|.|) will repeat
   1293    the input. UIs call this to implement "paste", but it's also intended for
   1294    use by scripts to input large, dot-repeatable blocks of text (as opposed
   1295    to |nvim_input()| which is subject to mappings/events and is thus much
   1296    slower).
   1297 
   1298    Invokes the |vim.paste()| handler, which handles each mode appropriately.
   1299 
   1300    Errors ('nomodifiable', `vim.paste()` failure, …) are reflected in `err`
   1301    but do not affect the return value (which is strictly decided by
   1302    `vim.paste()`). On error or cancel, subsequent calls are ignored
   1303    ("drained") until the next paste is initiated (phase 1 or -1).
   1304 
   1305    Useful in mappings and scripts to insert multiline text. Example: >lua
   1306        vim.keymap.set('n', 'x', function()
   1307          vim.api.nvim_paste([[
   1308            line1
   1309            line2
   1310            line3
   1311          ]], false, -1)
   1312        end, { buffer = true })
   1313 <
   1314 
   1315    Attributes: ~
   1316        not allowed when |textlock| is active
   1317        Since: 0.4.0
   1318 
   1319    Parameters: ~
   1320      • {data}   (`string`) Multiline input. Lines break at LF ("\n"). May be
   1321                 binary (containing NUL bytes).
   1322      • {crlf}   (`boolean`) Also break lines at CR and CRLF.
   1323      • {phase}  (`integer`) -1: paste in a single call (i.e. without
   1324                 streaming). To "stream" a paste, call `nvim_paste`
   1325                 sequentially with these `phase` values:
   1326                 • 1: starts the paste (exactly once)
   1327                 • 2: continues the paste (zero or more times)
   1328                 • 3: ends the paste (exactly once)
   1329 
   1330    Return: ~
   1331        (`boolean`)
   1332        • true: Client may continue pasting.
   1333        • false: Client should cancel the paste.
   1334 
   1335 nvim_put({lines}, {type}, {after}, {follow})                      *nvim_put()*
   1336    Puts text at cursor, in any mode. For dot-repeatable input, use
   1337    |nvim_paste()|.
   1338 
   1339    Compare |:put| and |p| which are always linewise.
   1340 
   1341    Attributes: ~
   1342        not allowed when |textlock| is active
   1343        Since: 0.4.0
   1344 
   1345    Parameters: ~
   1346      • {lines}   (`string[]`) |readfile()|-style list of lines.
   1347                  |channel-lines|
   1348      • {type}    (`string`) Edit behavior: any |getregtype()| result, or:
   1349                  • "b" |blockwise-visual| mode (may include width, e.g. "b3")
   1350                  • "c" |charwise| mode
   1351                  • "l" |linewise| mode
   1352                  • "" guess by contents, see |setreg()|
   1353      • {after}   (`boolean`) If true insert after cursor (like |p|), or
   1354                  before (like |P|).
   1355      • {follow}  (`boolean`) If true place cursor at end of inserted text.
   1356 
   1357                                                    *nvim_replace_termcodes()*
   1358 nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
   1359    Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a string with
   1360    the internal representation.
   1361 
   1362    Note: ~
   1363      • Lua can use |vim.keycode()| instead.
   1364 
   1365    Attributes: ~
   1366        Since: 0.1.0
   1367 
   1368    Parameters: ~
   1369      • {str}        (`string`) String to be converted.
   1370      • {from_part}  (`boolean`) Legacy Vim parameter. Usually true.
   1371      • {do_lt}      (`boolean`) Also translate <lt>. Ignored if `special` is
   1372                     false.
   1373      • {special}    (`boolean`) Replace |keycodes|, e.g. <CR> becomes a "\r"
   1374                     char.
   1375 
   1376    Return: ~
   1377        (`string`)
   1378 
   1379    See also: ~
   1380      • replace_termcodes
   1381      • cpoptions
   1382 
   1383                                                *nvim_select_popupmenu_item()*
   1384 nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
   1385    Selects an item in the completion popup menu.
   1386 
   1387    If neither |ins-completion| nor |cmdline-completion| popup menu is active
   1388    this API call is silently ignored. Useful for an external UI using
   1389    |ui-popupmenu| to control the popup menu with the mouse. Can also be used
   1390    in a mapping; use <Cmd> |:map-cmd| or a Lua mapping to ensure the mapping
   1391    doesn't end completion mode.
   1392 
   1393    Attributes: ~
   1394        Since: 0.4.0
   1395 
   1396    Parameters: ~
   1397      • {item}    (`integer`) Index (zero-based) of the item to select. Value
   1398                  of -1 selects nothing and restores the original text.
   1399      • {insert}  (`boolean`) For |ins-completion|, whether the selection
   1400                  should be inserted in the buffer. Ignored for
   1401                  |cmdline-completion|.
   1402      • {finish}  (`boolean`) Finish the completion and dismiss the popup
   1403                  menu. Implies {insert}.
   1404      • {opts}    (`vim.api.keyset.empty`) Optional parameters. Reserved for
   1405                  future use.
   1406 
   1407                                                      *nvim_set_client_info()*
   1408 nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
   1409    Self-identifies the client, and sets optional flags on the channel.
   1410    Defines the `client` object returned by |nvim_get_chan_info()|.
   1411 
   1412    Clients should call this just after connecting, to provide hints for
   1413    debugging and orchestration. (Note: Something is better than nothing!
   1414    Fields are optional, but at least set `name`.)
   1415 
   1416    Can be called more than once; caller should merge old info if appropriate.
   1417    Example: a library first identifies the channel, then a plugin using that
   1418    library later identifies itself.
   1419 
   1420    Attributes: ~
   1421        |RPC| only
   1422        Since: 0.3.0
   1423 
   1424    Parameters: ~
   1425      • {name}        (`string`) Client short-name. Sets the `client.name`
   1426                      field of |nvim_get_chan_info()|.
   1427      • {version}     (`table<string,any>`) Dict describing the version, with
   1428                      these (optional) keys:
   1429                      • "major" major version (defaults to 0 if not set, for
   1430                        no release yet)
   1431                      • "minor" minor version
   1432                      • "patch" patch number
   1433                      • "prerelease" string describing a prerelease, like
   1434                        "dev" or "beta1"
   1435                      • "commit" hash or similar identifier of commit
   1436      • {type}        (`string`) Must be one of the following values. Client
   1437                      libraries should default to "remote" unless overridden
   1438                      by the user.
   1439                      • "remote" remote client connected "Nvim flavored"
   1440                        MessagePack-RPC (responses must be in reverse order of
   1441                        requests). |msgpack-rpc|
   1442                      • "msgpack-rpc" remote client connected to Nvim via
   1443                        fully MessagePack-RPC compliant protocol.
   1444                      • "ui" gui frontend
   1445                      • "embedder" application using Nvim as a component (for
   1446                        example, IDE/editor implementing a vim mode).
   1447                      • "host" plugin host, typically started by nvim
   1448                      • "plugin" single plugin, started by nvim
   1449      • {methods}     (`table<string,any>`) Builtin methods in the client. For
   1450                      a host, this does not include plugin methods which will
   1451                      be discovered later. The key should be the method name,
   1452                      the values are dicts with these (optional) keys (more
   1453                      keys may be added in future versions of Nvim, thus
   1454                      unknown keys are ignored. Clients must only use keys
   1455                      defined in this or later versions of Nvim):
   1456                      • "async" if true, send as a notification. If false or
   1457                        unspecified, use a blocking request
   1458                      • "nargs" Number of arguments. Could be a single integer
   1459                        or an array of two integers, minimum and maximum
   1460                        inclusive.
   1461      • {attributes}  (`table<string,any>`) Arbitrary string:string map of
   1462                      informal client properties. Suggested keys:
   1463                      • "pid": Process id.
   1464                      • "website": Client homepage URL (e.g. GitHub
   1465                        repository)
   1466                      • "license": License description ("Apache 2", "GPLv3",
   1467                        "MIT", …)
   1468                      • "logo": URI or path to image, preferably small logo or
   1469                        icon. .png or .svg format is preferred.
   1470 
   1471 nvim_set_current_buf({buffer})                        *nvim_set_current_buf()*
   1472    Sets the current window's buffer to `buffer`.
   1473 
   1474    Attributes: ~
   1475        not allowed when |textlock| is active or in the |cmdwin|
   1476        Since: 0.1.0
   1477 
   1478    Parameters: ~
   1479      • {buffer}  (`integer`) Buffer id
   1480 
   1481 nvim_set_current_dir({dir})                           *nvim_set_current_dir()*
   1482    Changes the global working directory.
   1483 
   1484    Attributes: ~
   1485        Since: 0.1.0
   1486 
   1487    Parameters: ~
   1488      • {dir}  (`string`) Directory path
   1489 
   1490 nvim_set_current_line({line})                        *nvim_set_current_line()*
   1491    Sets the text on the current line.
   1492 
   1493    Attributes: ~
   1494        not allowed when |textlock| is active
   1495        Since: 0.1.0
   1496 
   1497    Parameters: ~
   1498      • {line}  (`string`) Line contents
   1499 
   1500 nvim_set_current_tabpage({tabpage})               *nvim_set_current_tabpage()*
   1501    Sets the current tabpage.
   1502 
   1503    Attributes: ~
   1504        not allowed when |textlock| is active or in the |cmdwin|
   1505        Since: 0.1.0
   1506 
   1507    Parameters: ~
   1508      • {tabpage}  (`integer`) |tab-ID| to focus
   1509 
   1510 nvim_set_current_win({window})                        *nvim_set_current_win()*
   1511    Navigates to the given window (and tabpage, implicitly).
   1512 
   1513    Attributes: ~
   1514        not allowed when |textlock| is active or in the |cmdwin|
   1515        Since: 0.1.0
   1516 
   1517    Parameters: ~
   1518      • {window}  (`integer`) |window-ID| to focus
   1519 
   1520 nvim_set_hl({ns_id}, {name}, {val})                            *nvim_set_hl()*
   1521    Sets a highlight group.
   1522 
   1523    Note: ~
   1524      • Unlike the `:highlight` command which can update a highlight group,
   1525        this function completely replaces the definition. For example:
   1526        `nvim_set_hl(0, 'Visual', {})` will clear the highlight group
   1527        'Visual'.
   1528      • The fg and bg keys also accept the string values `"fg"` or `"bg"`
   1529        which act as aliases to the corresponding foreground and background
   1530        values of the Normal group. If the Normal group has not been defined,
   1531        using these values results in an error.
   1532      • If `link` is used in combination with other attributes; only the
   1533        `link` will take effect (see |:hi-link|).
   1534 
   1535    Attributes: ~
   1536        Since: 0.5.0
   1537 
   1538    Parameters: ~
   1539      • {ns_id}  (`integer`) Namespace id for this highlight
   1540                 |nvim_create_namespace()|. Use 0 to set a highlight group
   1541                 globally |:highlight|. Highlights from non-global namespaces
   1542                 are not active by default, use |nvim_set_hl_ns()| or
   1543                 |nvim_win_set_hl_ns()| to activate them.
   1544      • {name}   (`string`) Highlight group name, e.g. "ErrorMsg"
   1545      • {val}    (`vim.api.keyset.highlight`) Highlight definition map,
   1546                 accepts the following keys:
   1547                 • bg: color name or "#RRGGBB", see note.
   1548                 • bg_indexed: boolean (default false) If true, bg is a
   1549                   terminal palette index (0-255).
   1550                 • blend: integer between 0 and 100
   1551                 • cterm: cterm attribute map, like |highlight-args|. If not
   1552                   set, cterm attributes will match those from the attribute
   1553                   map documented above.
   1554                 • ctermbg: Sets background of cterm color |ctermbg|
   1555                 • ctermfg: Sets foreground of cterm color |ctermfg|
   1556                 • default: boolean Don't override existing definition
   1557                   |:hi-default|
   1558                 • fg: color name or "#RRGGBB", see note.
   1559                 • fg_indexed: boolean (default false) If true, fg is a
   1560                   terminal palette index (0-255).
   1561                 • force: if true force update the highlight group when it
   1562                   exists.
   1563                 • link: Name of highlight group to link to. |:hi-link|
   1564                 • sp: color name or "#RRGGBB"
   1565                 • altfont: boolean
   1566                 • blink: boolean
   1567                 • bold: boolean
   1568                 • conceal: boolean Concealment at the UI level (terminal
   1569                   SGR), unrelated to |:syn-conceal|.
   1570                 • dim: boolean
   1571                 • italic: boolean
   1572                 • nocombine: boolean
   1573                 • overline: boolean
   1574                 • reverse: boolean
   1575                 • standout: boolean
   1576                 • strikethrough: boolean
   1577                 • undercurl: boolean
   1578                 • underdashed: boolean
   1579                 • underdotted: boolean
   1580                 • underdouble: boolean
   1581                 • underline: boolean
   1582 
   1583 nvim_set_hl_ns({ns_id})                                     *nvim_set_hl_ns()*
   1584    Set active namespace for highlights defined with |nvim_set_hl()|. This can
   1585    be set for a single window, see |nvim_win_set_hl_ns()|.
   1586 
   1587    Attributes: ~
   1588        Since: 0.8.0
   1589 
   1590    Parameters: ~
   1591      • {ns_id}  (`integer`) the namespace to use
   1592 
   1593 nvim_set_hl_ns_fast({ns_id})                           *nvim_set_hl_ns_fast()*
   1594    Set active namespace for highlights defined with |nvim_set_hl()| while
   1595    redrawing.
   1596 
   1597    This function is meant to be called while redrawing, primarily from
   1598    |nvim_set_decoration_provider()| on_win and on_line callbacks, which are
   1599    allowed to change the namespace during a redraw cycle.
   1600 
   1601    Attributes: ~
   1602        |api-fast|
   1603        Since: 0.8.0
   1604 
   1605    Parameters: ~
   1606      • {ns_id}  (`integer`) the namespace to activate
   1607 
   1608 nvim_set_keymap({mode}, {lhs}, {rhs}, {opts})              *nvim_set_keymap()*
   1609    Sets a global |mapping| for the given mode.
   1610 
   1611    To set a buffer-local mapping, use |nvim_buf_set_keymap()|.
   1612 
   1613    Unlike |:map|, leading/trailing whitespace is accepted as part of the
   1614    {lhs} or {rhs}. Empty {rhs} is <Nop>. |keycodes| are replaced as usual.
   1615 
   1616    Example: >vim
   1617        call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
   1618 <
   1619 
   1620    is equivalent to: >vim
   1621        nmap <nowait> <Space><NL> <Nop>
   1622 <
   1623 
   1624    Attributes: ~
   1625        Since: 0.4.0
   1626 
   1627    Parameters: ~
   1628      • {mode}  (`string`) Mode short-name (map command prefix: "n", "i", "v",
   1629                "x", …) or "!" for |:map!|, or empty string for |:map|.
   1630                "ia", "ca" or "!a" for abbreviation in Insert mode, Cmdline
   1631                mode, or both, respectively
   1632      • {lhs}   (`string`) Left-hand-side |{lhs}| of the mapping.
   1633      • {rhs}   (`string`) Right-hand-side |{rhs}| of the mapping.
   1634      • {opts}  (`vim.api.keyset.keymap`) Optional parameters map: Accepts all
   1635                |:map-arguments| as keys except <buffer>, values are booleans
   1636                (default false). Also:
   1637                • "noremap" disables |recursive_mapping|, like |:noremap|
   1638                • "desc" human-readable description.
   1639                • "callback" Lua function called in place of {rhs}.
   1640                • "replace_keycodes" (boolean) When "expr" is true, replace
   1641                  keycodes in the resulting string (see
   1642                  |nvim_replace_termcodes()|). Returning nil from the Lua
   1643                  "callback" is equivalent to returning an empty string.
   1644 
   1645 nvim_set_var({name}, {value})                                 *nvim_set_var()*
   1646    Sets a global (g:) variable.
   1647 
   1648    Attributes: ~
   1649        Since: 0.1.0
   1650 
   1651    Parameters: ~
   1652      • {name}   (`string`) Variable name
   1653      • {value}  (`any`) Variable value
   1654 
   1655 nvim_set_vvar({name}, {value})                               *nvim_set_vvar()*
   1656    Sets a v: variable, if it is not readonly.
   1657 
   1658    Attributes: ~
   1659        Since: 0.4.0
   1660 
   1661    Parameters: ~
   1662      • {name}   (`string`) Variable name
   1663      • {value}  (`any`) Variable value
   1664 
   1665 nvim_strwidth({text})                                        *nvim_strwidth()*
   1666    Calculates the number of display cells occupied by `text`. Control
   1667    characters including <Tab> count as one cell.
   1668 
   1669    Attributes: ~
   1670        Since: 0.1.0
   1671 
   1672    Parameters: ~
   1673      • {text}  (`string`) Some text
   1674 
   1675    Return: ~
   1676        (`integer`) Number of cells
   1677 
   1678 nvim__complete_set({index}, {opts})                     *nvim__complete_set()*
   1679    EXPERIMENTAL: this API may change in the future.
   1680 
   1681    Sets info for the completion item at the given index. If the info text was
   1682    shown in a window, returns the window and buffer ids, or empty dict if not
   1683    shown.
   1684 
   1685    Parameters: ~
   1686      • {index}  (`integer`) Completion candidate index
   1687      • {opts}   (`vim.api.keyset.complete_set`) Optional parameters.
   1688                 • info: (string) info text.
   1689 
   1690    Return: ~
   1691        (`table<string,number>`) Dict containing these keys:
   1692        • winid: (number) floating window id
   1693        • bufnr: (number) buffer id in floating window
   1694 
   1695 nvim__exec_lua_fast({code}, {args})                    *nvim__exec_lua_fast()*
   1696    WARNING: This feature is experimental/unstable.
   1697 
   1698    EXPERIMENTAL: this API may change or be removed in the future.
   1699 
   1700    Like |nvim_exec_lua()|, but can be called during |api-fast| contexts.
   1701 
   1702    Execute Lua code. Parameters (if any) are available as `...` inside the
   1703    chunk. The chunk can return a value.
   1704 
   1705    Only statements are executed. To evaluate an expression, prefix it with
   1706    `return`: return my_function(...)
   1707 
   1708    Attributes: ~
   1709        |api-fast|
   1710        |RPC| only
   1711 
   1712    Parameters: ~
   1713      • {code}  (`string`) Lua code to execute
   1714      • {args}  (`any[]`) Arguments to the code
   1715 
   1716    Return: ~
   1717        (`any`) Return value of Lua code if present or NIL.
   1718 
   1719 nvim__get_runtime({pat}, {all}, {opts})                  *nvim__get_runtime()*
   1720    Find files in runtime directories
   1721 
   1722    Attributes: ~
   1723        |api-fast|
   1724        Since: 0.6.0
   1725 
   1726    Parameters: ~
   1727      • {pat}   (`string[]`) pattern of files to search for
   1728      • {all}   (`boolean`) whether to return all matches or only the first
   1729      • {opts}  (`vim.api.keyset.runtime`) is_lua: only search Lua subdirs
   1730 
   1731    Return: ~
   1732        (`string[]`) list of absolute paths to the found files
   1733 
   1734 nvim__id({obj})                                                   *nvim__id()*
   1735    Returns object given as argument.
   1736 
   1737    This API function is used for testing. One should not rely on its presence
   1738    in plugins.
   1739 
   1740    Parameters: ~
   1741      • {obj}  (`any`) Object to return.
   1742 
   1743    Return: ~
   1744        (`any`) its argument.
   1745 
   1746 nvim__id_array({arr})                                       *nvim__id_array()*
   1747    Returns array given as argument.
   1748 
   1749    This API function is used for testing. One should not rely on its presence
   1750    in plugins.
   1751 
   1752    Parameters: ~
   1753      • {arr}  (`any[]`) Array to return.
   1754 
   1755    Return: ~
   1756        (`any[]`) its argument.
   1757 
   1758 nvim__id_dict({dct})                                         *nvim__id_dict()*
   1759    Returns dict given as argument.
   1760 
   1761    This API function is used for testing. One should not rely on its presence
   1762    in plugins.
   1763 
   1764    Parameters: ~
   1765      • {dct}  (`table<string,any>`) Dict to return.
   1766 
   1767    Return: ~
   1768        (`table<string,any>`) its argument.
   1769 
   1770 nvim__id_float({flt})                                       *nvim__id_float()*
   1771    Returns floating-point value given as argument.
   1772 
   1773    This API function is used for testing. One should not rely on its presence
   1774    in plugins.
   1775 
   1776    Parameters: ~
   1777      • {flt}  (`number`) Value to return.
   1778 
   1779    Return: ~
   1780        (`number`) its argument.
   1781 
   1782 nvim__inspect_cell({grid}, {row}, {col})                *nvim__inspect_cell()*
   1783    NB: if your UI doesn't use hlstate, this will not return hlstate first
   1784    time.
   1785 
   1786    Parameters: ~
   1787      • {grid}  (`integer`)
   1788      • {row}   (`integer`)
   1789      • {col}   (`integer`)
   1790 
   1791    Return: ~
   1792        (`any[]`)
   1793 
   1794 nvim__invalidate_glyph_cache()                *nvim__invalidate_glyph_cache()*
   1795    For testing. The condition in schar_cache_clear_if_full is hard to reach,
   1796    so this function can be used to force a cache clear in a test.
   1797 
   1798 nvim__redraw({opts})                                          *nvim__redraw()*
   1799    EXPERIMENTAL: this API may change in the future.
   1800 
   1801    Instruct Nvim to redraw various components.
   1802 
   1803    Attributes: ~
   1804        Since: 0.10.0
   1805 
   1806    Parameters: ~
   1807      • {opts}  (`vim.api.keyset.redraw`) Optional parameters.
   1808                • win: Target a specific |window-ID| as described below.
   1809                • buf: Target a specific buffer number as described below.
   1810                • flush: Update the screen with pending updates.
   1811                • valid: When present mark `win`, `buf`, or all windows for
   1812                  redraw. When `true`, only redraw changed lines (useful for
   1813                  decoration providers). When `false`, forcefully redraw.
   1814                • range: Redraw a range in `buf`, the buffer in `win` or the
   1815                  current buffer (useful for decoration providers). Expects a
   1816                  tuple `[first, last]` with the first and last line number of
   1817                  the range, 0-based end-exclusive |api-indexing|.
   1818                • cursor: Immediately update cursor position on the screen in
   1819                  `win` or the current window.
   1820                • statuscolumn: Redraw the 'statuscolumn' in `buf`, `win` or
   1821                  all windows.
   1822                • statusline: Redraw the 'statusline' in `buf`, `win` or all
   1823                  windows.
   1824                • winbar: Redraw the 'winbar' in `buf`, `win` or all windows.
   1825                • tabline: Redraw the 'tabline'.
   1826 
   1827    See also: ~
   1828      • |:redraw|
   1829 
   1830 nvim__stats()                                                  *nvim__stats()*
   1831    Gets internal stats.
   1832 
   1833    Return: ~
   1834        (`table<string,any>`) Map of various internal stats.
   1835 
   1836 
   1837 ==============================================================================
   1838 Vimscript Functions                                            *api-vimscript*
   1839 
   1840                                                   *nvim_call_dict_function()*
   1841 nvim_call_dict_function({dict}, {fn}, {args})
   1842    Calls a Vimscript |Dictionary-function| with the given arguments.
   1843 
   1844    On execution error: fails with Vimscript error, updates v:errmsg.
   1845 
   1846    Attributes: ~
   1847        Since: 0.3.0
   1848 
   1849    Parameters: ~
   1850      • {dict}  (`any`) Dict, or String evaluating to a Vimscript |self| dict
   1851      • {fn}    (`string`) Name of the function defined on the Vimscript dict
   1852      • {args}  (`any[]`) Function arguments packed in an Array
   1853 
   1854    Return: ~
   1855        (`any`) Result of the function call
   1856 
   1857 nvim_call_function({fn}, {args})                        *nvim_call_function()*
   1858    Calls a Vimscript function with the given arguments.
   1859 
   1860    On execution error: fails with Vimscript error, updates v:errmsg.
   1861 
   1862    Attributes: ~
   1863        Since: 0.1.0
   1864 
   1865    Parameters: ~
   1866      • {fn}    (`string`) Function to call
   1867      • {args}  (`any[]`) Function arguments packed in an Array
   1868 
   1869    Return: ~
   1870        (`any`) Result of the function call
   1871 
   1872 nvim_command({command})                                       *nvim_command()*
   1873    Executes an Ex command.
   1874 
   1875    On execution error: fails with Vimscript error, updates v:errmsg.
   1876 
   1877    Prefer |nvim_cmd()| or |nvim_exec2()| instead. To modify an Ex command in
   1878    a structured way before executing it, modify the result of
   1879    |nvim_parse_cmd()| then pass it to |nvim_cmd()|.
   1880 
   1881    Attributes: ~
   1882        Since: 0.1.0
   1883 
   1884    Parameters: ~
   1885      • {command}  (`string`) Ex command string
   1886 
   1887 nvim_eval({expr})                                                *nvim_eval()*
   1888    Evaluates a Vimscript |expression|. Dicts and Lists are recursively
   1889    expanded.
   1890 
   1891    On execution error: fails with Vimscript error, updates v:errmsg.
   1892 
   1893    Attributes: ~
   1894        Since: 0.1.0
   1895 
   1896    Parameters: ~
   1897      • {expr}  (`string`) Vimscript expression string
   1898 
   1899    Return: ~
   1900        (`any`) Evaluation result or expanded object
   1901 
   1902 nvim_exec2({src}, {opts})                                       *nvim_exec2()*
   1903    Executes Vimscript (multiline block of Ex commands), like anonymous
   1904    |:source|.
   1905 
   1906    Unlike |nvim_command()| this function supports heredocs, script-scope
   1907    (s:), etc.
   1908 
   1909    On execution error: fails with Vimscript error, updates v:errmsg.
   1910 
   1911    Attributes: ~
   1912        Since: 0.9.0
   1913 
   1914    Parameters: ~
   1915      • {src}   (`string`) Vimscript code
   1916      • {opts}  (`vim.api.keyset.exec_opts`) Optional parameters.
   1917                • output: (boolean, default false) Whether to capture and
   1918                  return all (non-error, non-shell |:!|) output.
   1919 
   1920    Return: ~
   1921        (`table<string,any>`) Dict containing information about execution,
   1922        with these keys:
   1923        • output: (string|nil) Output if `opts.output` is true.
   1924 
   1925    See also: ~
   1926      • |execute()|
   1927      • |nvim_command()|
   1928      • |nvim_cmd()|
   1929 
   1930                                                     *nvim_parse_expression()*
   1931 nvim_parse_expression({expr}, {flags}, {highlight})
   1932    Parse a Vimscript expression.
   1933 
   1934    Attributes: ~
   1935        |api-fast|
   1936        Since: 0.3.0
   1937 
   1938    Parameters: ~
   1939      • {expr}       (`string`) Expression to parse. Always treated as a
   1940                     single line.
   1941      • {flags}      (`string`) Flags:
   1942                     • "m" if multiple expressions in a row are allowed (only
   1943                       the first one will be parsed),
   1944                     • "E" if EOC tokens are not allowed (determines whether
   1945                       they will stop parsing process or be recognized as an
   1946                       operator/space, though also yielding an error).
   1947                     • "l" when needing to start parsing with lvalues for
   1948                       ":let" or ":for". Common flag sets:
   1949                     • "m" to parse like for `":echo"`.
   1950                     • "E" to parse like for `"<C-r>="`.
   1951                     • empty string for ":call".
   1952                     • "lm" to parse for ":let".
   1953      • {highlight}  (`boolean`) If true, return value will also include
   1954                     "highlight" key containing array of 4-tuples (arrays)
   1955                     (Integer, Integer, Integer, String), where first three
   1956                     numbers define the highlighted region and represent line,
   1957                     starting column and ending column (latter exclusive: one
   1958                     should highlight region [start_col, end_col)).
   1959 
   1960    Return: ~
   1961        (`table<string,any>`)
   1962        • AST: top-level dict with these keys:
   1963          • "error": Dict with error, present only if parser saw some error.
   1964            Contains the following keys:
   1965            • "message": String, error message in printf format, translated.
   1966              Must contain exactly one `%.*s`.
   1967            • "arg": String, error message argument.
   1968          • "len": Amount of bytes successfully parsed. With flags equal to ""
   1969            that should be equal to the length of expr string. ("Successfully
   1970            parsed" here means "participated in AST creation", not "till the
   1971            first error".)
   1972          • "ast": AST, either nil or a dict with these keys:
   1973            • "type": node type, one of the value names from ExprASTNodeType
   1974              stringified without "kExprNode" prefix.
   1975            • "start": a pair `[line, column]` describing where node is
   1976              "started" where "line" is always 0 (will not be 0 if you will be
   1977              using this API on e.g. ":let", but that is not present yet).
   1978              Both elements are Integers.
   1979            • "len": “length” of the node. This and "start" are there for
   1980              debugging purposes primary (debugging parser and providing debug
   1981              information).
   1982            • "children": a list of nodes described in top/"ast". There always
   1983              is zero, one or two children, key will not be present if node
   1984              has no children. Maximum number of children may be found in
   1985              node_maxchildren array.
   1986        • Local values (present only for certain nodes):
   1987          • "scope": a single Integer, specifies scope for "Option" and
   1988            "PlainIdentifier" nodes. For "Option" it is one of ExprOptScope
   1989            values, for "PlainIdentifier" it is one of ExprVarScope values.
   1990          • "ident": identifier (without scope, if any), present for "Option",
   1991            "PlainIdentifier", "PlainKey" and "Environment" nodes.
   1992          • "name": Integer, register name (one character) or -1. Only present
   1993            for "Register" nodes.
   1994          • "cmp_type": String, comparison type, one of the value names from
   1995            ExprComparisonType, stringified without "kExprCmp" prefix. Only
   1996            present for "Comparison" nodes.
   1997          • "ccs_strategy": String, case comparison strategy, one of the value
   1998            names from ExprCaseCompareStrategy, stringified without
   1999            "kCCStrategy" prefix. Only present for "Comparison" nodes.
   2000          • "augmentation": String, augmentation type for "Assignment" nodes.
   2001            Is either an empty string, "Add", "Subtract" or "Concat" for "=",
   2002            "+=", "-=" or ".=" respectively.
   2003          • "invert": Boolean, true if result of comparison needs to be
   2004            inverted. Only present for "Comparison" nodes.
   2005          • "ivalue": Integer, integer value for "Integer" nodes.
   2006          • "fvalue": Float, floating-point value for "Float" nodes.
   2007          • "svalue": String, value for "SingleQuotedString" and
   2008            "DoubleQuotedString" nodes.
   2009 
   2010 
   2011 ==============================================================================
   2012 Autocmd Functions                                                *api-autocmd*
   2013 
   2014 nvim_clear_autocmds({opts})                            *nvim_clear_autocmds()*
   2015    Clears all autocommands selected by {opts}. To delete autocmds see
   2016    |nvim_del_autocmd()|.
   2017 
   2018    Attributes: ~
   2019        Since: 0.7.0
   2020 
   2021    Parameters: ~
   2022      • {opts}  (`vim.api.keyset.clear_autocmds`) Parameters
   2023                • event: (vim.api.keyset.events|vim.api.keyset.events[])
   2024                  Examples:
   2025                  • event: "pat1"
   2026                  • event: { "pat1" }
   2027                  • event: { "pat1", "pat2", "pat3" }
   2028                • pattern: (string|table)
   2029                  • pattern or patterns to match exactly.
   2030                    • For example, if you have `*.py` as that pattern for the
   2031                      autocmd, you must pass `*.py` exactly to clear it.
   2032                      `test.py` will not match the pattern.
   2033                  • defaults to clearing all patterns.
   2034                  • NOTE: Cannot be used with {buffer}
   2035                • buffer: (bufnr)
   2036                  • clear only |autocmd-buflocal| autocommands.
   2037                  • NOTE: Cannot be used with {pattern}
   2038                • group: (string|int) The augroup name or id.
   2039                  • NOTE: If not passed, will only delete autocmds not in any
   2040                    group.
   2041 
   2042 nvim_create_augroup({name}, {opts})                    *nvim_create_augroup()*
   2043    Create or get an autocommand group |autocmd-groups|.
   2044 
   2045    To get an existing group id, do: >lua
   2046        local id = vim.api.nvim_create_augroup('my.lsp.config', {
   2047            clear = false
   2048        })
   2049 <
   2050 
   2051    Attributes: ~
   2052        Since: 0.7.0
   2053 
   2054    Parameters: ~
   2055      • {name}  (`string`) String: The name of the group
   2056      • {opts}  (`vim.api.keyset.create_augroup`) Dict Parameters
   2057                • clear (bool) optional: defaults to true. Clear existing
   2058                  commands if the group already exists |autocmd-groups|.
   2059 
   2060    Return: ~
   2061        (`integer`) Integer id of the created group.
   2062 
   2063    See also: ~
   2064      • |autocmd-groups|
   2065 
   2066 nvim_create_autocmd({event}, {opts})                   *nvim_create_autocmd()*
   2067    Creates an |autocommand| event handler, defined by `callback` (Lua
   2068    function or Vimscript function name string) or `command` (Ex command
   2069    string).
   2070 
   2071    Example using Lua callback: >lua
   2072        vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
   2073          pattern = {'*.c', '*.h'},
   2074          callback = function(ev)
   2075            print(string.format('event fired: %s', vim.inspect(ev)))
   2076          end
   2077        })
   2078 <
   2079 
   2080    Example using an Ex command as the handler: >lua
   2081        vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
   2082          pattern = {'*.c', '*.h'},
   2083          command = "echo 'Entering a C or C++ file'",
   2084        })
   2085 <
   2086 
   2087    Note: `pattern` is NOT automatically expanded (unlike with |:autocmd|),
   2088    thus names like "$HOME" and "~" must be expanded explicitly: >lua
   2089        pattern = vim.fn.expand('~') .. '/some/path/*.py'
   2090 <
   2091 
   2092    Attributes: ~
   2093        Since: 0.7.0
   2094 
   2095    Parameters: ~
   2096      • {event}  (`vim.api.keyset.events|vim.api.keyset.events[]`) Event(s)
   2097                 that will trigger the handler (`callback` or `command`).
   2098      • {opts}   (`vim.api.keyset.create_autocmd`) Options dict:
   2099                 • group (string|integer) optional: autocommand group name or
   2100                   id to match against.
   2101                 • pattern (string|array) optional: pattern(s) to match
   2102                   literally |autocmd-pattern|.
   2103                 • buffer (integer) optional: buffer number for buffer-local
   2104                   autocommands |autocmd-buflocal|. Cannot be used with
   2105                   {pattern}.
   2106                 • desc (string) optional: description (for documentation and
   2107                   troubleshooting).
   2108                 • callback (function|string) optional: Lua function (or
   2109                   Vimscript function name, if string) called when the
   2110                   event(s) is triggered. Lua callback can return a truthy
   2111                   value (not `false` or `nil`) to delete the autocommand, and
   2112                   receives one argument, a table with these keys:
   2113                                                                  *event-args*
   2114                   • id: (number) autocommand id
   2115                   • event: (vim.api.keyset.events) name of the triggered
   2116                     event |autocmd-events|
   2117                   • group: (number|nil) autocommand group id, if any
   2118                   • file: (string) <afile> (not expanded to a full path)
   2119                   • match: (string) <amatch> (expanded to a full path)
   2120                   • buf: (number) <abuf>
   2121                   • data: (any) arbitrary data passed from
   2122                     |nvim_exec_autocmds()|                       *event-data*
   2123                 • command (string) optional: Vim command to execute on event.
   2124                   Cannot be used with {callback}
   2125                 • once (boolean) optional: defaults to false. Run the
   2126                   autocommand only once |autocmd-once|.
   2127                 • nested (boolean) optional: defaults to false. Run nested
   2128                   autocommands |autocmd-nested|.
   2129 
   2130    Return: ~
   2131        (`integer`) Autocommand id (number)
   2132 
   2133    See also: ~
   2134      • |autocommand|
   2135      • |nvim_del_autocmd()|
   2136 
   2137 nvim_del_augroup_by_id({id})                        *nvim_del_augroup_by_id()*
   2138    Delete an autocommand group by id.
   2139 
   2140    To get a group id one can use |nvim_get_autocmds()|.
   2141 
   2142    NOTE: behavior differs from |:augroup-delete|. When deleting a group,
   2143    autocommands contained in this group will also be deleted and cleared.
   2144    This group will no longer exist.
   2145 
   2146    Attributes: ~
   2147        Since: 0.7.0
   2148 
   2149    Parameters: ~
   2150      • {id}  (`integer`) Integer The id of the group.
   2151 
   2152    See also: ~
   2153      • |nvim_del_augroup_by_name()|
   2154      • |nvim_create_augroup()|
   2155 
   2156 nvim_del_augroup_by_name({name})                  *nvim_del_augroup_by_name()*
   2157    Delete an autocommand group by name.
   2158 
   2159    NOTE: behavior differs from |:augroup-delete|. When deleting a group,
   2160    autocommands contained in this group will also be deleted and cleared.
   2161    This group will no longer exist.
   2162 
   2163    Attributes: ~
   2164        Since: 0.7.0
   2165 
   2166    Parameters: ~
   2167      • {name}  (`string`) String The name of the group.
   2168 
   2169    See also: ~
   2170      • |autocmd-groups|
   2171 
   2172 nvim_del_autocmd({id})                                    *nvim_del_autocmd()*
   2173    Deletes an autocommand by id.
   2174 
   2175    Attributes: ~
   2176        Since: 0.7.0
   2177 
   2178    Parameters: ~
   2179      • {id}  (`integer`) Integer Autocommand id returned by
   2180              |nvim_create_autocmd()|
   2181 
   2182 nvim_exec_autocmds({event}, {opts})                     *nvim_exec_autocmds()*
   2183    Execute all autocommands for {event} that match the corresponding {opts}
   2184    |autocmd-execute|.
   2185 
   2186    Attributes: ~
   2187        Since: 0.7.0
   2188 
   2189    Parameters: ~
   2190      • {event}  (`vim.api.keyset.events|vim.api.keyset.events[]`) The event
   2191                 or events to execute
   2192      • {opts}   (`vim.api.keyset.exec_autocmds`) Dict of autocommand options:
   2193                 • group (string|integer) optional: the autocommand group name
   2194                   or id to match against. |autocmd-groups|.
   2195                 • pattern (string|array) optional: defaults to "*"
   2196                   |autocmd-pattern|. Cannot be used with {buffer}.
   2197                 • buffer (integer) optional: buffer number
   2198                   |autocmd-buflocal|. Cannot be used with {pattern}.
   2199                 • modeline (bool) optional: defaults to true. Process the
   2200                   modeline after the autocommands <nomodeline>.
   2201                 • data (any): arbitrary data to send to the autocommand
   2202                   callback. See |nvim_create_autocmd()| for details.
   2203 
   2204    See also: ~
   2205      • |:doautocmd|
   2206 
   2207 nvim_get_autocmds({opts})                                *nvim_get_autocmds()*
   2208    Get all autocommands that match the corresponding {opts}.
   2209 
   2210    These examples will get autocommands matching ALL the given criteria: >lua
   2211        -- Matches all criteria
   2212        autocommands = vim.api.nvim_get_autocmds({
   2213          group = 'MyGroup',
   2214          event = {'BufEnter', 'BufWinEnter'},
   2215          pattern = {'*.c', '*.h'}
   2216        })
   2217 
   2218        -- All commands from one group
   2219        autocommands = vim.api.nvim_get_autocmds({
   2220          group = 'MyGroup',
   2221        })
   2222 <
   2223 
   2224    NOTE: When multiple patterns or events are provided, it will find all the
   2225    autocommands that match any combination of them.
   2226 
   2227    Attributes: ~
   2228        Since: 0.7.0
   2229 
   2230    Parameters: ~
   2231      • {opts}  (`vim.api.keyset.get_autocmds`) Dict with at least one of the
   2232                following:
   2233                • buffer: (integer) Buffer number or list of buffer numbers
   2234                  for buffer local autocommands |autocmd-buflocal|. Cannot be
   2235                  used with {pattern}
   2236                • event: (vim.api.keyset.events|vim.api.keyset.events[]) event
   2237                  or events to match against |autocmd-events|.
   2238                • id: (integer) Autocommand ID to match.
   2239                • group: (string|table) the autocommand group name or id to
   2240                  match against.
   2241                • pattern: (string|table) pattern or patterns to match against
   2242                  |autocmd-pattern|. Cannot be used with {buffer}
   2243 
   2244    Return: ~
   2245        (`vim.api.keyset.get_autocmds.ret[]`) Array of autocommands matching
   2246        the criteria, with each item containing the following fields:
   2247        • buffer: (integer) the buffer number.
   2248        • buflocal: (boolean) true if the autocommand is buffer local.
   2249        • command: (string) the autocommand command. Note: this will be empty
   2250          if a callback is set.
   2251        • callback: (function|string|nil): Lua function or name of a Vim
   2252          script function which is executed when this autocommand is
   2253          triggered.
   2254        • desc: (string) the autocommand description.
   2255        • event: (vim.api.keyset.events) the autocommand event.
   2256        • id: (integer) the autocommand id (only when defined with the API).
   2257        • group: (integer) the autocommand group id.
   2258        • group_name: (string) the autocommand group name.
   2259        • once: (boolean) whether the autocommand is only run once.
   2260        • pattern: (string) the autocommand pattern. If the autocommand is
   2261          buffer local |autocmd-buffer-local|:
   2262 
   2263 
   2264 ==============================================================================
   2265 Buffer Functions                                                  *api-buffer*
   2266 
   2267 
   2268 For more information on buffers, see |buffers|.
   2269 
   2270 Unloaded Buffers: ~
   2271 
   2272 Buffers may be unloaded by the |:bunload| command or the buffer's
   2273 'bufhidden' option. When a buffer is unloaded its file contents are freed
   2274 from memory and vim cannot operate on the buffer lines until it is reloaded
   2275 (usually by opening the buffer again in a new window). API methods such as
   2276 |nvim_buf_get_lines()| and |nvim_buf_line_count()| will be affected.
   2277 
   2278 You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()| to check
   2279 whether a buffer is loaded.
   2280 
   2281 
   2282 nvim_buf_attach({buffer}, {send_buffer}, {opts})           *nvim_buf_attach()*
   2283    Activates |api-buffer-updates| events on a channel, or as Lua callbacks.
   2284 
   2285    Example (Lua): capture buffer updates in a global `events` variable (use
   2286    "vim.print(events)" to see its contents): >lua
   2287        events = {}
   2288        vim.api.nvim_buf_attach(0, false, {
   2289          on_lines = function(...)
   2290            table.insert(events, {...})
   2291          end,
   2292        })
   2293 <
   2294 
   2295    Attributes: ~
   2296        Since: 0.3.0
   2297 
   2298    Parameters: ~
   2299      • {buffer}       (`integer`) Buffer id, or 0 for current buffer
   2300      • {send_buffer}  (`boolean`) True if the initial notification should
   2301                       contain the whole buffer: first notification will be
   2302                       `nvim_buf_lines_event`. Else the first notification
   2303                       will be `nvim_buf_changedtick_event`. Not for Lua
   2304                       callbacks.
   2305      • {opts}         (`vim.api.keyset.buf_attach`) Optional parameters.
   2306                       • on_lines: Called on linewise changes. Not called on
   2307                         buffer reload (`:checktime`, `:edit`, …), see
   2308                         `on_reload:`. Return a |lua-truthy| value to detach.
   2309                         Args:
   2310                         • the string "lines"
   2311                         • buffer id
   2312                         • b:changedtick
   2313                         • first line that changed (zero-indexed)
   2314                         • last line that was changed
   2315                         • last line in the updated range
   2316                         • byte count of previous contents
   2317                         • deleted_codepoints (if `utf_sizes` is true)
   2318                         • deleted_codeunits (if `utf_sizes` is true)
   2319                       • on_bytes: Called on granular changes (compared to
   2320                         on_lines). Not called on buffer reload (`:checktime`,
   2321                         `:edit`, …), see `on_reload:`. Return a
   2322                         |lua-truthy| value to detach. Args:
   2323                         • the string "bytes"
   2324                         • buffer id
   2325                         • b:changedtick
   2326                         • start row of the changed text (zero-indexed)
   2327                         • start column of the changed text
   2328                         • byte offset of the changed text (from the start of
   2329                           the buffer)
   2330                         • old end row of the changed text (offset from start
   2331                           row)
   2332                         • old end column of the changed text (if old end row
   2333                           = 0, offset from start column)
   2334                         • old end byte length of the changed text
   2335                         • new end row of the changed text (offset from start
   2336                           row)
   2337                         • new end column of the changed text (if new end row
   2338                           = 0, offset from start column)
   2339                         • new end byte length of the changed text
   2340                       • on_changedtick: Called on |changetick| increment
   2341                         without text change. Args:
   2342                         • the string "changedtick"
   2343                         • buffer id
   2344                         • b:changedtick
   2345                       • on_detach: Called on detach. Args:
   2346                         • the string "detach"
   2347                         • buffer id
   2348                       • on_reload: Called on whole-buffer load (`:checktime`,
   2349                         `:edit`, …). Clients should typically re-fetch the
   2350                         entire buffer contents. Args:
   2351                         • the string "reload"
   2352                         • buffer id
   2353                       • utf_sizes: include UTF-32 and UTF-16 size of the
   2354                         replaced region, as args to `on_lines`.
   2355                       • preview: also attach to command preview (i.e.
   2356                         'inccommand') events.
   2357 
   2358    Return: ~
   2359        (`boolean`) False if attach failed (invalid parameter, or buffer isn't
   2360        loaded); otherwise True.
   2361 
   2362    See also: ~
   2363      • |nvim_buf_detach()|
   2364      • |api-buffer-updates-lua|
   2365 
   2366 nvim_buf_call({buffer}, {fun})                               *nvim_buf_call()*
   2367    Call a function with buffer as temporary current buffer.
   2368 
   2369    This temporarily switches current buffer to "buffer". If the current
   2370    window already shows "buffer", the window is not switched. If a window
   2371    inside the current tabpage (including a float) already shows the buffer,
   2372    then one of those windows will be set as current window temporarily.
   2373    Otherwise a temporary scratch window (called the "autocmd window" for
   2374    historical reasons) will be used.
   2375 
   2376    This is useful e.g. to call Vimscript functions that only work with the
   2377    current buffer/window currently, like `jobstart(…, {'term': v:true})`.
   2378 
   2379    Attributes: ~
   2380        Lua |vim.api| only
   2381        Since: 0.5.0
   2382 
   2383    Parameters: ~
   2384      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2385      • {fun}     (`function`) Function to call inside the buffer (currently
   2386                  Lua callable only)
   2387 
   2388    Return: ~
   2389        (`any`) Return value of function.
   2390 
   2391 nvim_buf_del_keymap({buffer}, {mode}, {lhs})           *nvim_buf_del_keymap()*
   2392    Unmaps a buffer-local |mapping| for the given mode.
   2393 
   2394    Attributes: ~
   2395        Since: 0.4.0
   2396 
   2397    Parameters: ~
   2398      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2399      • {mode}    (`string`)
   2400      • {lhs}     (`string`)
   2401 
   2402    See also: ~
   2403      • |nvim_del_keymap()|
   2404 
   2405 nvim_buf_del_mark({buffer}, {name})                      *nvim_buf_del_mark()*
   2406    Deletes a named mark in the buffer. See |mark-motions|.
   2407 
   2408    Note: ~
   2409      • only deletes marks set in the buffer, if the mark is not set in the
   2410        buffer it will return false.
   2411 
   2412    Attributes: ~
   2413        Since: 0.6.0
   2414 
   2415    Parameters: ~
   2416      • {buffer}  (`integer`) Buffer to set the mark on
   2417      • {name}    (`string`) Mark name
   2418 
   2419    Return: ~
   2420        (`boolean`) true if the mark was deleted, else false.
   2421 
   2422    See also: ~
   2423      • |nvim_buf_set_mark()|
   2424      • |nvim_del_mark()|
   2425 
   2426 nvim_buf_del_var({buffer}, {name})                        *nvim_buf_del_var()*
   2427    Removes a buffer-scoped (b:) variable
   2428 
   2429    Attributes: ~
   2430        Since: 0.1.0
   2431 
   2432    Parameters: ~
   2433      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2434      • {name}    (`string`) Variable name
   2435 
   2436 nvim_buf_delete({buffer}, {opts})                          *nvim_buf_delete()*
   2437    Deletes a buffer and its metadata (like |:bwipeout|).
   2438 
   2439    To get |:bdelete| behavior, reset 'buflisted' and pass `unload=true`: >lua
   2440        vim.bo.buflisted = false
   2441        vim.api.nvim_buf_delete(0, { unload = true })
   2442 <
   2443 
   2444    Attributes: ~
   2445        not allowed when |textlock| is active or in the |cmdwin|
   2446        Since: 0.5.0
   2447 
   2448    Parameters: ~
   2449      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2450      • {opts}    (`vim.api.keyset.buf_delete`) Optional parameters. Keys:
   2451                  • force: Force deletion, ignore unsaved changes.
   2452                  • unload: Unloaded only (|:bunload|), do not delete.
   2453 
   2454 nvim_buf_detach({buffer})                                  *nvim_buf_detach()*
   2455    Deactivates buffer-update events on the channel.
   2456 
   2457    Attributes: ~
   2458        |RPC| only
   2459        Since: 0.3.0
   2460 
   2461    Parameters: ~
   2462      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2463 
   2464    Return: ~
   2465        (`boolean`) False if detach failed (because the buffer isn't loaded);
   2466        otherwise True.
   2467 
   2468    See also: ~
   2469      • |nvim_buf_attach()|
   2470      • |api-lua-detach| for detaching Lua callbacks
   2471 
   2472 nvim_buf_get_changedtick({buffer})                *nvim_buf_get_changedtick()*
   2473    Gets a changed tick of a buffer
   2474 
   2475    Attributes: ~
   2476        Since: 0.2.0
   2477 
   2478    Parameters: ~
   2479      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2480 
   2481    Return: ~
   2482        (`integer`) `b:changedtick` value.
   2483 
   2484 nvim_buf_get_keymap({buffer}, {mode})                  *nvim_buf_get_keymap()*
   2485    Gets a list of buffer-local |mapping| definitions.
   2486 
   2487    Attributes: ~
   2488        Since: 0.2.1
   2489 
   2490    Parameters: ~
   2491      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2492      • {mode}    (`string`) Mode short-name ("n", "i", "v", ...)
   2493 
   2494    Return: ~
   2495        (`vim.api.keyset.get_keymap[]`) Array of |maparg()|-like dictionaries
   2496        describing mappings. The "buffer" key holds the associated buffer id.
   2497 
   2498                                                        *nvim_buf_get_lines()*
   2499 nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing})
   2500    Gets a line-range from the buffer.
   2501 
   2502    Indexing is zero-based, end-exclusive. Negative indices are interpreted as
   2503    length+1+index: -1 refers to the index past the end. So to get the last
   2504    element use start=-2 and end=-1.
   2505 
   2506    Out-of-bounds indices are clamped to the nearest valid value, unless
   2507    `strict_indexing` is set.
   2508 
   2509    Attributes: ~
   2510        Since: 0.1.0
   2511 
   2512    Parameters: ~
   2513      • {buffer}           (`integer`) Buffer id, or 0 for current buffer
   2514      • {start}            (`integer`) First line index
   2515      • {end}              (`integer`) Last line index, exclusive
   2516      • {strict_indexing}  (`boolean`) Whether out-of-bounds should be an
   2517                           error.
   2518 
   2519    Return: ~
   2520        (`string[]`) Array of lines, or empty array for unloaded buffer.
   2521 
   2522    See also: ~
   2523      • |nvim_buf_get_text()|
   2524 
   2525 nvim_buf_get_mark({buffer}, {name})                      *nvim_buf_get_mark()*
   2526    Returns a `(row,col)` tuple representing the position of the named mark.
   2527    "End of line" column position is returned as |v:maxcol| (big number). See
   2528    |mark-motions|.
   2529 
   2530    Marks are (1,0)-indexed. |api-indexing|
   2531 
   2532    Attributes: ~
   2533        Since: 0.1.0
   2534 
   2535    Parameters: ~
   2536      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2537      • {name}    (`string`) Mark name
   2538 
   2539    Return: ~
   2540        (`[integer, integer]`) (row, col) tuple, (0, 0) if the mark is not
   2541        set, or is an uppercase/file mark set in another buffer.
   2542 
   2543    See also: ~
   2544      • |nvim_buf_set_mark()|
   2545      • |nvim_buf_del_mark()|
   2546 
   2547 nvim_buf_get_name({buffer})                              *nvim_buf_get_name()*
   2548    Gets the full file name for the buffer
   2549 
   2550    Attributes: ~
   2551        Since: 0.1.0
   2552 
   2553    Parameters: ~
   2554      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2555 
   2556    Return: ~
   2557        (`string`) Buffer name
   2558 
   2559 nvim_buf_get_offset({buffer}, {index})                 *nvim_buf_get_offset()*
   2560    Returns the byte offset of a line (0-indexed). |api-indexing|
   2561 
   2562    Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte.
   2563    'fileformat' and 'fileencoding' are ignored. The line index just after the
   2564    last line gives the total byte-count of the buffer. A final EOL byte is
   2565    counted if it would be written, see 'eol'.
   2566 
   2567    Unlike |line2byte()|, throws error for out-of-bounds indexing. Returns -1
   2568    for unloaded buffer.
   2569 
   2570    Attributes: ~
   2571        Since: 0.3.2
   2572 
   2573    Parameters: ~
   2574      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2575      • {index}   (`integer`) Line index
   2576 
   2577    Return: ~
   2578        (`integer`) Integer byte offset, or -1 for unloaded buffer.
   2579 
   2580                                                         *nvim_buf_get_text()*
   2581 nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
   2582                  {opts})
   2583    Gets a range from the buffer (may be partial lines, unlike
   2584    |nvim_buf_get_lines()|).
   2585 
   2586    Indexing is zero-based. Row indices are end-inclusive, and column indices
   2587    are end-exclusive.
   2588 
   2589    Prefer |nvim_buf_get_lines()| when retrieving entire lines.
   2590 
   2591    Attributes: ~
   2592        Since: 0.7.0
   2593 
   2594    Parameters: ~
   2595      • {buffer}     (`integer`) Buffer id, or 0 for current buffer
   2596      • {start_row}  (`integer`) First line index
   2597      • {start_col}  (`integer`) Starting column (byte offset) on first line
   2598      • {end_row}    (`integer`) Last line index, inclusive
   2599      • {end_col}    (`integer`) Ending column (byte offset) on last line,
   2600                     exclusive
   2601      • {opts}       (`vim.api.keyset.empty`) Optional parameters. Currently
   2602                     unused.
   2603 
   2604    Return: ~
   2605        (`string[]`) Array of lines, or empty array for unloaded buffer.
   2606 
   2607 nvim_buf_get_var({buffer}, {name})                        *nvim_buf_get_var()*
   2608    Gets a buffer-scoped (b:) variable.
   2609 
   2610    Attributes: ~
   2611        Since: 0.1.0
   2612 
   2613    Parameters: ~
   2614      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2615      • {name}    (`string`) Variable name
   2616 
   2617    Return: ~
   2618        (`any`) Variable value
   2619 
   2620 nvim_buf_is_loaded({buffer})                            *nvim_buf_is_loaded()*
   2621    Checks if a buffer is valid and loaded. See |api-buffer| for more info
   2622    about unloaded buffers.
   2623 
   2624    Attributes: ~
   2625        Since: 0.3.2
   2626 
   2627    Parameters: ~
   2628      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2629 
   2630    Return: ~
   2631        (`boolean`) true if the buffer is valid and loaded, false otherwise.
   2632 
   2633 nvim_buf_is_valid({buffer})                              *nvim_buf_is_valid()*
   2634    Checks if a buffer is valid.
   2635 
   2636    Note: ~
   2637      • Even if a buffer is valid it may have been unloaded. See |api-buffer|
   2638        for more info about unloaded buffers.
   2639 
   2640    Attributes: ~
   2641        Since: 0.1.0
   2642 
   2643    Parameters: ~
   2644      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2645 
   2646    Return: ~
   2647        (`boolean`) true if the buffer is valid, false otherwise.
   2648 
   2649 nvim_buf_line_count({buffer})                          *nvim_buf_line_count()*
   2650    Returns the number of lines in the given buffer.
   2651 
   2652    Attributes: ~
   2653        Since: 0.1.0
   2654 
   2655    Parameters: ~
   2656      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2657 
   2658    Return: ~
   2659        (`integer`) Line count, or 0 for unloaded buffer. |api-buffer|
   2660 
   2661                                                       *nvim_buf_set_keymap()*
   2662 nvim_buf_set_keymap({buffer}, {mode}, {lhs}, {rhs}, {opts})
   2663    Sets a buffer-local |mapping| for the given mode.
   2664 
   2665    Attributes: ~
   2666        Since: 0.4.0
   2667 
   2668    Parameters: ~
   2669      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2670      • {mode}    (`string`)
   2671      • {lhs}     (`string`)
   2672      • {rhs}     (`string`)
   2673      • {opts}    (`vim.api.keyset.keymap`)
   2674 
   2675    See also: ~
   2676      • |nvim_set_keymap()|
   2677 
   2678                                                        *nvim_buf_set_lines()*
   2679 nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement})
   2680    Sets (replaces) a line-range in the buffer.
   2681 
   2682    Indexing is zero-based, end-exclusive. Negative indices are interpreted as
   2683    length+1+index: -1 refers to the index past the end. So to change or
   2684    delete the last line use start=-2 and end=-1.
   2685 
   2686    To insert lines at a given index, set `start` and `end` to the same index.
   2687    To delete a range of lines, set `replacement` to an empty array.
   2688 
   2689    Out-of-bounds indices are clamped to the nearest valid value, unless
   2690    `strict_indexing` is set.
   2691 
   2692    Attributes: ~
   2693        not allowed when |textlock| is active
   2694        Since: 0.1.0
   2695 
   2696    Parameters: ~
   2697      • {buffer}           (`integer`) Buffer id, or 0 for current buffer
   2698      • {start}            (`integer`) First line index
   2699      • {end}              (`integer`) Last line index, exclusive
   2700      • {strict_indexing}  (`boolean`) Whether out-of-bounds should be an
   2701                           error.
   2702      • {replacement}      (`string[]`) Array of lines to use as replacement
   2703 
   2704    See also: ~
   2705      • |nvim_buf_set_text()|
   2706 
   2707                                                         *nvim_buf_set_mark()*
   2708 nvim_buf_set_mark({buffer}, {name}, {line}, {col}, {opts})
   2709    Sets a named mark in the given buffer, all marks are allowed
   2710    file/uppercase, visual, last change, etc. See |mark-motions|.
   2711 
   2712    Marks are (1,0)-indexed. |api-indexing|
   2713 
   2714    Note: ~
   2715      • Passing 0 as line deletes the mark
   2716 
   2717    Attributes: ~
   2718        Since: 0.6.0
   2719 
   2720    Parameters: ~
   2721      • {buffer}  (`integer`) Buffer to set the mark on
   2722      • {name}    (`string`) Mark name
   2723      • {line}    (`integer`) Line number
   2724      • {col}     (`integer`) Column/row number
   2725      • {opts}    (`vim.api.keyset.empty`) Optional parameters. Reserved for
   2726                  future use.
   2727 
   2728    Return: ~
   2729        (`boolean`) true if the mark was set, else false.
   2730 
   2731    See also: ~
   2732      • |nvim_buf_del_mark()|
   2733      • |nvim_buf_get_mark()|
   2734 
   2735 nvim_buf_set_name({buffer}, {name})                      *nvim_buf_set_name()*
   2736    Sets the full file name for a buffer, like |:file_f|
   2737 
   2738    Attributes: ~
   2739        Since: 0.1.0
   2740 
   2741    Parameters: ~
   2742      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2743      • {name}    (`string`) Buffer name
   2744 
   2745                                                         *nvim_buf_set_text()*
   2746 nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
   2747                  {replacement})
   2748    Sets (replaces) a range in the buffer
   2749 
   2750    This is recommended over |nvim_buf_set_lines()| when only modifying parts
   2751    of a line, as extmarks will be preserved on non-modified parts of the
   2752    touched lines.
   2753 
   2754    Indexing is zero-based. Row indices are end-inclusive, and column indices
   2755    are end-exclusive.
   2756 
   2757    To insert text at a given `(row, column)` location, use
   2758    `start_row = end_row = row` and `start_col = end_col = col`. To delete the
   2759    text in a range, use `replacement = {}`.
   2760 
   2761    Note: ~
   2762      • Prefer |nvim_buf_set_lines()| (for performance) to add or delete
   2763        entire lines.
   2764      • Prefer |nvim_paste()| or |nvim_put()| to insert (instead of replace)
   2765        text at cursor.
   2766 
   2767    Attributes: ~
   2768        not allowed when |textlock| is active
   2769        Since: 0.5.0
   2770 
   2771    Parameters: ~
   2772      • {buffer}       (`integer`) Buffer id, or 0 for current buffer
   2773      • {start_row}    (`integer`) First line index
   2774      • {start_col}    (`integer`) Starting column (byte offset) on first line
   2775      • {end_row}      (`integer`) Last line index, inclusive
   2776      • {end_col}      (`integer`) Ending column (byte offset) on last line,
   2777                       exclusive
   2778      • {replacement}  (`string[]`) Array of lines to use as replacement
   2779 
   2780 nvim_buf_set_var({buffer}, {name}, {value})               *nvim_buf_set_var()*
   2781    Sets a buffer-scoped (b:) variable
   2782 
   2783    Attributes: ~
   2784        Since: 0.1.0
   2785 
   2786    Parameters: ~
   2787      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2788      • {name}    (`string`) Variable name
   2789      • {value}   (`any`) Variable value
   2790 
   2791 
   2792 ==============================================================================
   2793 Command Functions                                                *api-command*
   2794 
   2795                                              *nvim_buf_create_user_command()*
   2796 nvim_buf_create_user_command({buffer}, {name}, {command}, {opts})
   2797    Creates a buffer-local command |user-commands|.
   2798 
   2799    Attributes: ~
   2800        Since: 0.7.0
   2801 
   2802    Parameters: ~
   2803      • {buffer}   (`integer`) Buffer id, or 0 for current buffer.
   2804      • {name}     (`string`)
   2805      • {command}  (`any`)
   2806      • {opts}     (`vim.api.keyset.user_command`)
   2807 
   2808    See also: ~
   2809      • nvim_create_user_command
   2810 
   2811                                                 *nvim_buf_del_user_command()*
   2812 nvim_buf_del_user_command({buffer}, {name})
   2813    Delete a buffer-local user-defined command.
   2814 
   2815    Only commands created with |:command-buffer| or
   2816    |nvim_buf_create_user_command()| can be deleted with this function.
   2817 
   2818    Attributes: ~
   2819        Since: 0.7.0
   2820 
   2821    Parameters: ~
   2822      • {buffer}  (`integer`) Buffer id, or 0 for current buffer.
   2823      • {name}    (`string`) Name of the command to delete.
   2824 
   2825 nvim_buf_get_commands({buffer}, {opts})              *nvim_buf_get_commands()*
   2826    Gets a map of buffer-local |user-commands|.
   2827 
   2828    Attributes: ~
   2829        Since: 0.3.0
   2830 
   2831    Parameters: ~
   2832      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   2833      • {opts}    (`vim.api.keyset.get_commands`) Optional parameters.
   2834                  Currently not used.
   2835 
   2836    Return: ~
   2837        (`vim.api.keyset.command_info`) Map of maps describing commands.
   2838 
   2839 nvim_cmd({cmd}, {opts})                                           *nvim_cmd()*
   2840    Executes an Ex command.
   2841 
   2842    Unlike |nvim_command()| this command takes a structured Dict instead of a
   2843    String. This allows for easier construction and manipulation of an Ex
   2844    command. This also allows for things such as having spaces inside a
   2845    command argument, expanding filenames in a command that otherwise doesn't
   2846    expand filenames, etc. Command arguments may also be Number, Boolean or
   2847    String.
   2848 
   2849    The first argument may also be used instead of count for commands that
   2850    support it in order to make their usage simpler with |vim.cmd()|. For
   2851    example, instead of `vim.cmd.bdelete{ count = 2 }`, you may do
   2852    `vim.cmd.bdelete(2)`.
   2853 
   2854    On execution error: fails with Vimscript error, updates v:errmsg.
   2855 
   2856    Attributes: ~
   2857        Since: 0.8.0
   2858 
   2859    Parameters: ~
   2860      • {cmd}   (`vim.api.keyset.cmd`) Command to execute. Must be a Dict that
   2861                can contain the same values as the return value of
   2862                |nvim_parse_cmd()| except "addr", "nargs" and "nextcmd" which
   2863                are ignored if provided. All values except for "cmd" are
   2864                optional.
   2865      • {opts}  (`vim.api.keyset.cmd_opts`) Optional parameters.
   2866                • output: (boolean, default false) Whether to return command
   2867                  output.
   2868 
   2869    Return: ~
   2870        (`string`) Command output (non-error, non-shell |:!|) if `output` is
   2871        true, else empty string.
   2872 
   2873    See also: ~
   2874      • |nvim_exec2()|
   2875      • |nvim_command()|
   2876 
   2877                                                  *nvim_create_user_command()*
   2878 nvim_create_user_command({name}, {command}, {opts})
   2879    Creates a global |user-commands| command.
   2880 
   2881    For Lua usage see |lua-guide-commands-create|.
   2882 
   2883    Example: >vim
   2884        :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true})
   2885        :SayHello
   2886        Hello world!
   2887 <
   2888 
   2889    Attributes: ~
   2890        Since: 0.7.0
   2891 
   2892    Parameters: ~
   2893      • {name}     (`string`) Name of the new user command. Must begin with an
   2894                   uppercase letter.
   2895      • {command}  (`string|fun(args: vim.api.keyset.create_user_command.command_args)`)
   2896                   Replacement command to execute when this user command is
   2897                   executed. When called from Lua, the command can also be a
   2898                   Lua function. The function is called with a single table
   2899                   argument that contains the following keys:
   2900                   • name: (string) Command name
   2901                   • args: (string) The args passed to the command, if any
   2902                     <args>
   2903                   • fargs: (table) The args split by unescaped whitespace
   2904                     (when more than one argument is allowed), if any <f-args>
   2905                   • nargs: (string) Number of arguments |:command-nargs|
   2906                   • bang: (boolean) "true" if the command was executed with a
   2907                     ! modifier <bang>
   2908                   • line1: (number) The starting line of the command range
   2909                     <line1>
   2910                   • line2: (number) The final line of the command range
   2911                     <line2>
   2912                   • range: (number) The number of items in the command range:
   2913                     0, 1, or 2 <range>
   2914                   • count: (number) Any count supplied <count>
   2915                   • reg: (string) The optional register, if specified <reg>
   2916                   • mods: (string) Command modifiers, if any <mods>
   2917                   • smods: (table) Command modifiers in a structured format.
   2918                     Has the same structure as the "mods" key of
   2919                     |nvim_parse_cmd()|.
   2920      • {opts}     (`vim.api.keyset.user_command`) Optional flags
   2921                   • `desc` (string) Command description.
   2922                   • `force` (boolean, default true) Override any previous
   2923                     definition.
   2924                   • `complete` |:command-complete| command or function like
   2925                     |:command-completion-customlist|.
   2926                   • `preview` (function) Preview handler for 'inccommand'
   2927                     |:command-preview|
   2928                   • Set boolean |command-attributes| such as |:command-bang|
   2929                     or |:command-bar| to true (but not |:command-buffer|, use
   2930                     |nvim_buf_create_user_command()| instead).
   2931 
   2932 nvim_del_user_command({name})                        *nvim_del_user_command()*
   2933    Delete a user-defined command.
   2934 
   2935    Attributes: ~
   2936        Since: 0.7.0
   2937 
   2938    Parameters: ~
   2939      • {name}  (`string`) Name of the command to delete.
   2940 
   2941 nvim_get_commands({opts})                                *nvim_get_commands()*
   2942    Gets a map of global (non-buffer-local) Ex commands.
   2943 
   2944    Currently only |user-commands| are supported, not builtin Ex commands.
   2945 
   2946    Attributes: ~
   2947        Since: 0.3.0
   2948 
   2949    Parameters: ~
   2950      • {opts}  (`vim.api.keyset.get_commands`) Optional parameters. Currently
   2951                only supports {"builtin":false}
   2952 
   2953    Return: ~
   2954        (`table<string,vim.api.keyset.command_info>`) Map of maps describing
   2955        commands.
   2956 
   2957    See also: ~
   2958      • |nvim_get_all_options_info()|
   2959 
   2960 nvim_parse_cmd({str}, {opts})                               *nvim_parse_cmd()*
   2961    Parse command line.
   2962 
   2963    Doesn't check the validity of command arguments.
   2964 
   2965    Attributes: ~
   2966        |api-fast|
   2967        Since: 0.8.0
   2968 
   2969    Parameters: ~
   2970      • {str}   (`string`) Command line string to parse. Cannot contain "\n".
   2971      • {opts}  (`vim.api.keyset.empty`) Optional parameters. Reserved for
   2972                future use.
   2973 
   2974    Return: ~
   2975        (`vim.api.keyset.cmd`) Dict containing command information, with these
   2976        keys:
   2977        • cmd: (string) Command name.
   2978        • range: (array) (optional) Command range (<line1> <line2>). Omitted
   2979          if command doesn't accept a range. Otherwise, has no elements if no
   2980          range was specified, one element if only a single range item was
   2981          specified, or two elements if both range items were specified.
   2982        • count: (number) (optional) Command <count>. Omitted if command
   2983          cannot take a count.
   2984        • reg: (string) (optional) Command <register>. Omitted if command
   2985          cannot take a register.
   2986        • bang: (boolean) Whether command contains a <bang> (!) modifier.
   2987        • args: (array) Command arguments.
   2988        • addr: (string) Value of |:command-addr|. Uses short name or "line"
   2989          for -addr=lines.
   2990        • nargs: (string) Value of |:command-nargs|.
   2991        • nextcmd: (string) Next command if there are multiple commands
   2992          separated by a |:bar|. Empty if there isn't a next command.
   2993        • magic: (dict) Which characters have special meaning in the command
   2994          arguments.
   2995          • file: (boolean) The command expands filenames. Which means
   2996            characters such as "%", "#" and wildcards are expanded.
   2997          • bar: (boolean) The "|" character is treated as a command separator
   2998            and the double quote character (") is treated as the start of a
   2999            comment.
   3000        • mods: (dict) |:command-modifiers|.
   3001          • filter: (dict) |:filter|.
   3002            • pattern: (string) Filter pattern. Empty string if there is no
   3003              filter.
   3004            • force: (boolean) Whether filter is inverted or not.
   3005          • silent: (boolean) |:silent|.
   3006          • emsg_silent: (boolean) |:silent!|.
   3007          • unsilent: (boolean) |:unsilent|.
   3008          • sandbox: (boolean) |:sandbox|.
   3009          • noautocmd: (boolean) |:noautocmd|.
   3010          • browse: (boolean) |:browse|.
   3011          • confirm: (boolean) |:confirm|.
   3012          • hide: (boolean) |:hide|.
   3013          • horizontal: (boolean) |:horizontal|.
   3014          • keepalt: (boolean) |:keepalt|.
   3015          • keepjumps: (boolean) |:keepjumps|.
   3016          • keepmarks: (boolean) |:keepmarks|.
   3017          • keeppatterns: (boolean) |:keeppatterns|.
   3018          • lockmarks: (boolean) |:lockmarks|.
   3019          • noswapfile: (boolean) |:noswapfile|.
   3020          • tab: (integer) |:tab|. -1 when omitted.
   3021          • verbose: (integer) |:verbose|. -1 when omitted.
   3022          • vertical: (boolean) |:vertical|.
   3023          • split: (string) Split modifier string, is an empty string when
   3024            there's no split modifier. If there is a split modifier it can be
   3025            one of:
   3026            • "aboveleft": |:aboveleft|.
   3027            • "belowright": |:belowright|.
   3028            • "topleft": |:topleft|.
   3029            • "botright": |:botright|.
   3030 
   3031 
   3032 ==============================================================================
   3033 Extmark Functions                                                *api-extmark*
   3034 
   3035                                                  *nvim_buf_clear_namespace()*
   3036 nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
   3037    Clears |namespace|d objects (highlights, |extmarks|, virtual text) from a
   3038    region.
   3039 
   3040    Lines are 0-indexed. |api-indexing| To clear the namespace in the entire
   3041    buffer, specify line_start=0 and line_end=-1.
   3042 
   3043    Attributes: ~
   3044        Since: 0.3.2
   3045 
   3046    Parameters: ~
   3047      • {buffer}      (`integer`) Buffer id, or 0 for current buffer
   3048      • {ns_id}       (`integer`) Namespace to clear, or -1 to clear all
   3049                      namespaces.
   3050      • {line_start}  (`integer`) Start of range of lines to clear
   3051      • {line_end}    (`integer`) End of range of lines to clear (exclusive)
   3052                      or -1 to clear to end of buffer.
   3053 
   3054 nvim_buf_del_extmark({buffer}, {ns_id}, {id})         *nvim_buf_del_extmark()*
   3055    Removes an |extmark|.
   3056 
   3057    Attributes: ~
   3058        Since: 0.5.0
   3059 
   3060    Parameters: ~
   3061      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   3062      • {ns_id}   (`integer`) Namespace id from |nvim_create_namespace()|
   3063      • {id}      (`integer`) Extmark id
   3064 
   3065    Return: ~
   3066        (`boolean`) true if the extmark was found, else false
   3067 
   3068                                                *nvim_buf_get_extmark_by_id()*
   3069 nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
   3070    Gets the position (0-indexed) of an |extmark|.
   3071 
   3072    Attributes: ~
   3073        Since: 0.5.0
   3074 
   3075    Parameters: ~
   3076      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   3077      • {ns_id}   (`integer`) Namespace id from |nvim_create_namespace()|
   3078      • {id}      (`integer`) Extmark id
   3079      • {opts}    (`vim.api.keyset.get_extmark`) Optional parameters. Keys:
   3080                  • details: Whether to include the details dict
   3081                  • hl_name: Whether to include highlight group name instead
   3082                    of id, true if omitted
   3083 
   3084    Return: ~
   3085        (`[integer, integer, vim.api.keyset.extmark_details?]`) 0-indexed
   3086        (row, col, details?) tuple or empty list () if extmark id was absent.
   3087        The optional `details` dictionary contains the same keys as `opts` in
   3088        |nvim_buf_set_extmark()|, except for `id`, `conceal_lines` and
   3089        `ephemeral`. It also contains the following keys:
   3090        • ns_id: |namespace| id
   3091        • invalid: boolean that indicates whether the mark is hidden because
   3092          the entirety of text span range is deleted. See also the key
   3093          `invalidate` in |nvim_buf_set_extmark()|.
   3094 
   3095                                                     *nvim_buf_get_extmarks()*
   3096 nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
   3097    Gets |extmarks| in "traversal order" from a |charwise| region defined by
   3098    buffer positions (inclusive, 0-indexed |api-indexing|).
   3099 
   3100    Region can be given as (row,col) tuples, or valid extmark ids (whose
   3101    positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
   3102    respectively, thus the following are equivalent: >lua
   3103        vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
   3104        vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {})
   3105 <
   3106 
   3107    If `end` is less than `start`, marks are returned in reverse order.
   3108    (Useful with `limit`, to get the first marks prior to a given position.)
   3109 
   3110    Note: For a reverse range, `limit` does not actually affect the traversed
   3111    range, just how many marks are returned
   3112 
   3113    Note: when using extmark ranges (marks with a end_row/end_col position)
   3114    the `overlap` option might be useful. Otherwise only the start position of
   3115    an extmark will be considered.
   3116 
   3117    Note: legacy signs placed through the |:sign| commands are implemented as
   3118    extmarks and will show up here. Their details array will contain a
   3119    `sign_name` field.
   3120 
   3121    Example: >lua
   3122        local api = vim.api
   3123        local pos = api.nvim_win_get_cursor(0)
   3124        local ns  = api.nvim_create_namespace('my-plugin')
   3125        -- Create new extmark at line 1, column 1.
   3126        local m1  = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
   3127        -- Create new extmark at line 3, column 1.
   3128        local m2  = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
   3129        -- Get extmarks only from line 3.
   3130        local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
   3131        -- Get all marks in this buffer + namespace.
   3132        local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
   3133        vim.print(ms)
   3134 <
   3135 
   3136    Attributes: ~
   3137        Since: 0.5.0
   3138 
   3139    Parameters: ~
   3140      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   3141      • {ns_id}   (`integer`) Namespace id from |nvim_create_namespace()| or
   3142                  -1 for all namespaces
   3143      • {start}   (`any`) Start of range: a 0-indexed (row, col) or valid
   3144                  extmark id (whose position defines the bound).
   3145                  |api-indexing|
   3146      • {end}     (`any`) End of range (inclusive): a 0-indexed (row, col) or
   3147                  valid extmark id (whose position defines the bound).
   3148                  |api-indexing|
   3149      • {opts}    (`vim.api.keyset.get_extmarks`) Optional parameters. Keys:
   3150                  • limit: Maximum number of marks to return
   3151                  • details: Whether to include the details dict
   3152                  • hl_name: Whether to include highlight group name instead
   3153                    of id, true if omitted
   3154                  • overlap: Also include marks which overlap the range, even
   3155                    if their start position is less than `start`
   3156                  • type: Filter marks by type: "highlight", "sign",
   3157                    "virt_text" and "virt_lines"
   3158 
   3159    Return: ~
   3160        (`vim.api.keyset.get_extmark_item[]`) List of
   3161        `[extmark_id, row, col, details?]` tuples in "traversal order". For
   3162        the `details` dictionary, see |nvim_buf_get_extmark_by_id()|.
   3163 
   3164                                                      *nvim_buf_set_extmark()*
   3165 nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
   3166    Creates or updates an |extmark|.
   3167 
   3168    By default a new extmark is created when no id is passed in, but it is
   3169    also possible to create a new mark by passing in a previously unused id or
   3170    move an existing mark by passing in its id. The caller must then keep
   3171    track of existing and unused ids itself. (Useful over RPC, to avoid
   3172    waiting for the return value.)
   3173 
   3174    Using the optional arguments, it is possible to use this to highlight a
   3175    range of text, and also to associate virtual text to the mark.
   3176 
   3177    If present, the position defined by `end_col` and `end_row` should be
   3178    after the start position in order for the extmark to cover a range. An
   3179    earlier end position is not an error, but then it behaves like an empty
   3180    range (no highlighting).
   3181 
   3182    Attributes: ~
   3183        Since: 0.5.0
   3184 
   3185    Parameters: ~
   3186      • {buffer}  (`integer`) Buffer id, or 0 for current buffer
   3187      • {ns_id}   (`integer`) Namespace id from |nvim_create_namespace()|
   3188      • {line}    (`integer`) Line where to place the mark, 0-based.
   3189                  |api-indexing|
   3190      • {col}     (`integer`) Column where to place the mark, 0-based.
   3191                  |api-indexing|
   3192      • {opts}    (`vim.api.keyset.set_extmark`) Optional parameters.
   3193                  • id : id of the extmark to edit.
   3194                  • end_row : ending line of the mark, 0-based inclusive.
   3195                  • end_col : ending col of the mark, 0-based exclusive.
   3196                  • hl_group : highlight group used for the text range. This
   3197                    and below highlight groups can be supplied either as a
   3198                    string or as an integer, the latter of which can be
   3199                    obtained using |nvim_get_hl_id_by_name()|.
   3200                    Multiple highlight groups can be stacked by passing an
   3201                    array (highest priority last).
   3202                  • hl_eol : when true, for a multiline highlight covering the
   3203                    EOL of a line, continue the highlight for the rest of the
   3204                    screen line (just like for diff and cursorline highlight).
   3205                  • virt_text : *virtual-text* to link to this mark. A list of
   3206                    `[text, highlight]` tuples, each representing a text chunk
   3207                    with specified highlight. `highlight` element can either
   3208                    be a single highlight group, or an array of multiple
   3209                    highlight groups that will be stacked (highest priority
   3210                    last).
   3211                  • virt_text_pos : position of virtual text. Possible values:
   3212                    • "eol": right after eol character (default).
   3213                    • "eol_right_align": display right aligned in the window
   3214                      unless the virtual text is longer than the space
   3215                      available. If the virtual text is too long, it is
   3216                      truncated to fit in the window after the EOL character.
   3217                      If the line is wrapped, the virtual text is shown after
   3218                      the end of the line rather than the previous screen
   3219                      line.
   3220                    • "overlay": display over the specified column, without
   3221                      shifting the underlying text.
   3222                    • "right_align": display right aligned in the window.
   3223                    • "inline": display at the specified column, and shift the
   3224                      buffer text to the right as needed.
   3225                  • virt_text_win_col : position the virtual text at a fixed
   3226                    window column (starting from the first text column of the
   3227                    screen line) instead of "virt_text_pos".
   3228                  • virt_text_hide : hide the virtual text when the background
   3229                    text is selected or hidden because of scrolling with
   3230                    'nowrap' or 'smoothscroll'. Currently only affects
   3231                    "overlay" virt_text.
   3232                  • virt_text_repeat_linebreak : repeat the virtual text on
   3233                    wrapped lines.
   3234                  • hl_mode : control how highlights are combined with the
   3235                    highlights of the text. Currently only affects virt_text
   3236                    highlights, but might affect `hl_group` in later versions.
   3237                    • "replace": only show the virt_text color. This is the
   3238                      default.
   3239                    • "combine": combine with background text color.
   3240                    • "blend": blend with background text color. Not supported
   3241                      for "inline" virt_text.
   3242                  • virt_lines : virtual lines to add next to this mark This
   3243                    should be an array over lines, where each line in turn is
   3244                    an array over `[text, highlight]` tuples. In general,
   3245                    buffer and window options do not affect the display of the
   3246                    text. In particular 'wrap' and 'linebreak' options do not
   3247                    take effect, so the number of extra screen lines will
   3248                    always match the size of the array. However the 'tabstop'
   3249                    buffer option is still used for hard tabs. By default
   3250                    lines are placed below the buffer line containing the
   3251                    mark.
   3252                  • virt_lines_above: place virtual lines above instead.
   3253                  • virt_lines_leftcol: Place virtual lines in the leftmost
   3254                    column of the window, bypassing sign and number columns.
   3255                  • virt_lines_overflow: controls how to handle virtual lines
   3256                    wider than the window. Currently takes the one of the
   3257                    following values:
   3258                    • "trunc": truncate virtual lines on the right (default).
   3259                    • "scroll": virtual lines can scroll horizontally with
   3260                      'nowrap', otherwise the same as "trunc".
   3261                  • ephemeral : for use with |nvim_set_decoration_provider()|
   3262                    callbacks. The mark will only be used for the current
   3263                    redraw cycle, and not be permanently stored in the buffer.
   3264                  • right_gravity : boolean that indicates the direction the
   3265                    extmark will be shifted in when new text is inserted (true
   3266                    for right, false for left). Defaults to true.
   3267                  • end_right_gravity : boolean that indicates the direction
   3268                    the extmark end position (if it exists) will be shifted in
   3269                    when new text is inserted (true for right, false for
   3270                    left). Defaults to false.
   3271                  • undo_restore : Restore the exact position of the mark if
   3272                    text around the mark was deleted and then restored by
   3273                    undo. Defaults to true.
   3274                  • invalidate : boolean that indicates whether to hide the
   3275                    extmark if the entirety of its range is deleted. For
   3276                    hidden marks, an "invalid" key is added to the "details"
   3277                    array of |nvim_buf_get_extmarks()| and family. If
   3278                    "undo_restore" is false, the extmark is deleted instead.
   3279                  • priority: a priority value for the highlight group, sign
   3280                    attribute or virtual text. For virtual text, item with
   3281                    highest priority is drawn last. For example treesitter
   3282                    highlighting uses a value of 100.
   3283                  • strict: boolean that indicates extmark should not be
   3284                    placed if the line or column value is past the end of the
   3285                    buffer or end of the line respectively. Defaults to true.
   3286                  • sign_text: string of length 1-2 used to display in the
   3287                    sign column.
   3288                  • sign_hl_group: highlight group used for the sign column
   3289                    text.
   3290                  • number_hl_group: highlight group used for the number
   3291                    column.
   3292                  • line_hl_group: highlight group used for the whole line.
   3293                  • cursorline_hl_group: highlight group used for the sign
   3294                    column text when the cursor is on the same line as the
   3295                    mark and 'cursorline' is enabled.
   3296                  • conceal: string which should be either empty or a single
   3297                    character. Enable concealing similar to |:syn-conceal|.
   3298                    When a character is supplied it is used as |:syn-cchar|.
   3299                    "hl_group" is used as highlight for the cchar if provided,
   3300                    otherwise it defaults to |hl-Conceal|.
   3301                  • conceal_lines: string which should be empty. When
   3302                    provided, lines in the range are not drawn at all
   3303                    (according to 'conceallevel'); the next unconcealed line
   3304                    is drawn instead.
   3305                  • spell: boolean indicating that spell checking should be
   3306                    performed within this extmark
   3307                  • ui_watched: boolean that indicates the mark should be
   3308                    drawn by a UI. When set, the UI will receive win_extmark
   3309                    events. Note: the mark is positioned by virt_text
   3310                    attributes. Can be used together with virt_text.
   3311                  • url: A URL to associate with this extmark. In the TUI, the
   3312                    OSC 8 control sequence is used to generate a clickable
   3313                    hyperlink to this URL.
   3314 
   3315    Return: ~
   3316        (`integer`) Id of the created/updated extmark
   3317 
   3318 nvim_create_namespace({name})                        *nvim_create_namespace()*
   3319    Creates a new namespace or gets an existing one.               *namespace*
   3320 
   3321    Namespaces are used for buffer highlights and virtual text, see
   3322    |nvim_buf_set_extmark()|.
   3323 
   3324    Namespaces can be named or anonymous. If `name` matches an existing
   3325    namespace, the associated id is returned. If `name` is an empty string a
   3326    new, anonymous namespace is created.
   3327 
   3328    Attributes: ~
   3329        Since: 0.3.2
   3330 
   3331    Parameters: ~
   3332      • {name}  (`string`) Namespace name or empty string
   3333 
   3334    Return: ~
   3335        (`integer`) Namespace id
   3336 
   3337 nvim_get_namespaces()                                  *nvim_get_namespaces()*
   3338    Gets existing, non-anonymous |namespace|s.
   3339 
   3340    Attributes: ~
   3341        Since: 0.3.2
   3342 
   3343    Return: ~
   3344        (`table<string,integer>`) dict that maps from names to namespace ids.
   3345 
   3346                                              *nvim_set_decoration_provider()*
   3347 nvim_set_decoration_provider({ns_id}, {opts})
   3348    Set or change decoration provider for a |namespace|
   3349 
   3350    This is a very general purpose interface for having Lua callbacks being
   3351    triggered during the redraw code.
   3352 
   3353    The expected usage is to set |extmarks| for the currently redrawn buffer.
   3354    |nvim_buf_set_extmark()| can be called to add marks on a per-window or
   3355    per-lines basis. Use the `ephemeral` key to only use the mark for the
   3356    current screen redraw (the callback will be called again for the next
   3357    redraw).
   3358 
   3359    Note: this function should not be called often. Rather, the callbacks
   3360    themselves can be used to throttle unneeded callbacks. the `on_start`
   3361    callback can return `false` to disable the provider until the next redraw.
   3362    Similarly, return `false` in `on_win` will skip the `on_line` and
   3363    `on_range` calls for that window (but any extmarks set in `on_win` will
   3364    still be used). A plugin managing multiple sources of decoration should
   3365    ideally only set one provider, and merge the sources internally. You can
   3366    use multiple `ns_id` for the extmarks set/modified inside the callback
   3367    anyway.
   3368 
   3369    Note: doing anything other than setting extmarks is considered
   3370    experimental. Doing things like changing options are not explicitly
   3371    forbidden, but is likely to have unexpected consequences (such as 100% CPU
   3372    consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
   3373    quite dubious for the moment.
   3374 
   3375    Note: It is not allowed to remove or update extmarks in `on_line` or
   3376    `on_range` callbacks.
   3377 
   3378    Attributes: ~
   3379        Lua |vim.api| only
   3380        Since: 0.5.0
   3381 
   3382    Parameters: ~
   3383      • {ns_id}  (`integer`) Namespace id from |nvim_create_namespace()|
   3384      • {opts}   (`vim.api.keyset.set_decoration_provider`) Table of
   3385                 callbacks:
   3386                 • on_start: called first on each screen redraw >
   3387                    ["start", tick]
   3388 <
   3389                 • on_buf: called for each buffer being redrawn (once per
   3390                   edit, before window callbacks) >
   3391                    ["buf", bufnr, tick]
   3392 <
   3393                 • on_win: called when starting to redraw a specific window. >
   3394                    ["win", winid, bufnr, toprow, botrow]
   3395 <
   3396                 • on_line: (deprecated, use on_range instead) >
   3397                    ["line", winid, bufnr, row]
   3398 <
   3399                 • on_range: called for each buffer range being redrawn. Range
   3400                   is end-exclusive and may span multiple lines. Range bounds
   3401                   point to the first byte of a character. An end position of
   3402                   the form (lnum, 0), including (number of lines, 0), is
   3403                   valid and indicates that EOL of the preceding line is
   3404                   included. >
   3405                    ["range", winid, bufnr, begin_row, begin_col, end_row, end_col]
   3406 <
   3407                   In addition to returning a boolean, it is also allowed to
   3408                   return a `skip_row, skip_col` pair of integers. This
   3409                   implies that this function does not need to be called until
   3410                   a range which continues beyond the skipped position. A
   3411                   single integer return value `skip_row` is short for
   3412                   `skip_row, 0`
   3413                 • on_end: called at the end of a redraw cycle >
   3414                    ["end", tick]
   3415 <
   3416 
   3417 nvim__ns_get({ns_id})                                         *nvim__ns_get()*
   3418    EXPERIMENTAL: this API will change in the future.
   3419 
   3420    Get the properties for namespace
   3421 
   3422    Parameters: ~
   3423      • {ns_id}  (`integer`) Namespace
   3424 
   3425    Return: ~
   3426        (`vim.api.keyset.ns_opts`) Map defining the namespace properties, see
   3427        |nvim__ns_set()|
   3428 
   3429 nvim__ns_set({ns_id}, {opts})                                 *nvim__ns_set()*
   3430    EXPERIMENTAL: this API will change in the future.
   3431 
   3432    Set some properties for namespace
   3433 
   3434    Parameters: ~
   3435      • {ns_id}  (`integer`) Namespace
   3436      • {opts}   (`vim.api.keyset.ns_opts`) Optional parameters to set:
   3437                 • wins: a list of windows to be scoped in
   3438 
   3439 
   3440 ==============================================================================
   3441 Options Functions                                                *api-options*
   3442 
   3443 nvim_get_all_options_info()                      *nvim_get_all_options_info()*
   3444    Gets the option information for all options.
   3445 
   3446    The dict has the full option names as keys and option metadata dicts as
   3447    detailed at |nvim_get_option_info2()|.
   3448 
   3449    Attributes: ~
   3450        Since: 0.5.0
   3451 
   3452    Return: ~
   3453        (`table<string,any>`) dict of all options
   3454 
   3455    See also: ~
   3456      • |nvim_get_commands()|
   3457 
   3458 nvim_get_option_info2({name}, {opts})                *nvim_get_option_info2()*
   3459    Gets the option information for one option from arbitrary buffer or window
   3460 
   3461    Resulting dict has keys:
   3462    • name: Name of the option (like 'filetype')
   3463    • shortname: Shortened name of the option (like 'ft')
   3464    • type: type of option ("string", "number" or "boolean")
   3465    • default: The default value for the option
   3466    • was_set: Whether the option was set.
   3467    • last_set_sid: Last set script id (if any)
   3468    • last_set_linenr: line number where option was set
   3469    • last_set_chan: Channel where option was set (0 for local)
   3470    • scope: one of "global", "win", or "buf"
   3471    • global_local: whether win or buf option has a global value
   3472    • commalist: List of comma separated values
   3473    • flaglist: List of single char flags
   3474 
   3475    When {scope} is not provided, the last set information applies to the
   3476    local value in the current buffer or window if it is available, otherwise
   3477    the global value information is returned. This behavior can be disabled by
   3478    explicitly specifying {scope} in the {opts} table.
   3479 
   3480    Attributes: ~
   3481        Since: 0.9.0
   3482 
   3483    Parameters: ~
   3484      • {name}  (`string`) Option name
   3485      • {opts}  (`vim.api.keyset.option`) Optional parameters
   3486                • scope: One of "global" or "local". Analogous to |:setglobal|
   3487                  and |:setlocal|, respectively.
   3488                • win: |window-ID|. Used for getting window local options.
   3489                • buf: Buffer number. Used for getting buffer local options.
   3490                  Implies {scope} is "local".
   3491 
   3492    Return: ~
   3493        (`vim.api.keyset.get_option_info`) Option Information
   3494 
   3495 nvim_get_option_value({name}, {opts})                *nvim_get_option_value()*
   3496    Gets the value of an option. The behavior of this function matches that of
   3497    |:set|: the local value of an option is returned if it exists; otherwise,
   3498    the global value is returned. Local values always correspond to the
   3499    current buffer or window, unless "buf" or "win" is set in {opts}.
   3500 
   3501    Attributes: ~
   3502        Since: 0.7.0
   3503 
   3504    Parameters: ~
   3505      • {name}  (`string`) Option name
   3506      • {opts}  (`vim.api.keyset.option`) Optional parameters
   3507                • scope: One of "global" or "local". Analogous to |:setglobal|
   3508                  and |:setlocal|, respectively.
   3509                • win: |window-ID|. Used for getting window local options.
   3510                • buf: Buffer number. Used for getting buffer local options.
   3511                  Implies {scope} is "local".
   3512                • filetype: |filetype|. Used to get the default option for a
   3513                  specific filetype. Cannot be used with any other option.
   3514                  Note: this will trigger |ftplugin| and all |FileType|
   3515                  autocommands for the corresponding filetype.
   3516 
   3517    Return: ~
   3518        (`any`) Option value
   3519 
   3520                                                     *nvim_set_option_value()*
   3521 nvim_set_option_value({name}, {value}, {opts})
   3522    Sets the value of an option. The behavior of this function matches that of
   3523    |:set|: for global-local options, both the global and local value are set
   3524    unless otherwise specified with {scope}.
   3525 
   3526    Note the options {win} and {buf} cannot be used together.
   3527 
   3528    Attributes: ~
   3529        Since: 0.7.0
   3530 
   3531    Parameters: ~
   3532      • {name}   (`string`) Option name
   3533      • {value}  (`any`) New option value
   3534      • {opts}   (`vim.api.keyset.option`) Optional parameters
   3535                 • scope: One of "global" or "local". Analogous to
   3536                   |:setglobal| and |:setlocal|, respectively.
   3537                 • win: |window-ID|. Used for setting window local option.
   3538                 • buf: Buffer number. Used for setting buffer local option.
   3539 
   3540 
   3541 ==============================================================================
   3542 Tabpage Functions                                                *api-tabpage*
   3543 
   3544 nvim_tabpage_del_var({tabpage}, {name})               *nvim_tabpage_del_var()*
   3545    Removes a tab-scoped (t:) variable
   3546 
   3547    Attributes: ~
   3548        Since: 0.1.0
   3549 
   3550    Parameters: ~
   3551      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3552      • {name}     (`string`) Variable name
   3553 
   3554 nvim_tabpage_get_number({tabpage})                 *nvim_tabpage_get_number()*
   3555    Gets the tabpage number
   3556 
   3557    Attributes: ~
   3558        Since: 0.1.0
   3559 
   3560    Parameters: ~
   3561      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3562 
   3563    Return: ~
   3564        (`integer`) Tabpage number
   3565 
   3566 nvim_tabpage_get_var({tabpage}, {name})               *nvim_tabpage_get_var()*
   3567    Gets a tab-scoped (t:) variable
   3568 
   3569    Attributes: ~
   3570        Since: 0.1.0
   3571 
   3572    Parameters: ~
   3573      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3574      • {name}     (`string`) Variable name
   3575 
   3576    Return: ~
   3577        (`any`) Variable value
   3578 
   3579 nvim_tabpage_get_win({tabpage})                       *nvim_tabpage_get_win()*
   3580    Gets the current window in a tabpage
   3581 
   3582    Attributes: ~
   3583        Since: 0.1.0
   3584 
   3585    Parameters: ~
   3586      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3587 
   3588    Return: ~
   3589        (`integer`) |window-ID|
   3590 
   3591 nvim_tabpage_is_valid({tabpage})                     *nvim_tabpage_is_valid()*
   3592    Checks if a tabpage is valid
   3593 
   3594    Attributes: ~
   3595        Since: 0.1.0
   3596 
   3597    Parameters: ~
   3598      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3599 
   3600    Return: ~
   3601        (`boolean`) true if the tabpage is valid, false otherwise
   3602 
   3603 nvim_tabpage_list_wins({tabpage})                   *nvim_tabpage_list_wins()*
   3604    Gets the windows in a tabpage
   3605 
   3606    Attributes: ~
   3607        Since: 0.1.0
   3608 
   3609    Parameters: ~
   3610      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3611 
   3612    Return: ~
   3613        (`integer[]`) List of windows in `tabpage`
   3614 
   3615                                                      *nvim_tabpage_set_var()*
   3616 nvim_tabpage_set_var({tabpage}, {name}, {value})
   3617    Sets a tab-scoped (t:) variable
   3618 
   3619    Attributes: ~
   3620        Since: 0.1.0
   3621 
   3622    Parameters: ~
   3623      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3624      • {name}     (`string`) Variable name
   3625      • {value}    (`any`) Variable value
   3626 
   3627 nvim_tabpage_set_win({tabpage}, {win})                *nvim_tabpage_set_win()*
   3628    Sets the current window in a tabpage
   3629 
   3630    Attributes: ~
   3631        Since: 0.10.0
   3632 
   3633    Parameters: ~
   3634      • {tabpage}  (`integer`) |tab-ID|, or 0 for current tabpage
   3635      • {win}      (`integer`) |window-ID|, must already belong to {tabpage}
   3636 
   3637 
   3638 ==============================================================================
   3639 UI Functions                                                          *api-ui*
   3640 
   3641 nvim_ui_attach({width}, {height}, {options})                *nvim_ui_attach()*
   3642    Activates UI events on the channel.
   3643 
   3644    Entry point of all UI clients. Allows |--embed| to continue startup.
   3645    Implies that the client is ready to show the UI. Adds the client to the
   3646    list of UIs. |nvim_list_uis()|
   3647 
   3648    Note: ~
   3649      • If multiple UI clients are attached, the global screen dimensions
   3650        degrade to the smallest client. E.g. if client A requests 80x40 but
   3651        client B requests 200x100, the global screen has size 80x40.
   3652 
   3653    Attributes: ~
   3654        |RPC| only
   3655        Since: 0.1.0
   3656 
   3657    Parameters: ~
   3658      • {width}    (`integer`) Requested screen columns
   3659      • {height}   (`integer`) Requested screen rows
   3660      • {options}  (`table<string,any>`) |ui-option| map
   3661 
   3662 nvim_ui_detach()                                            *nvim_ui_detach()*
   3663    Deactivates UI events on the channel.
   3664 
   3665    Removes the client from the list of UIs. |nvim_list_uis()|
   3666 
   3667    Attributes: ~
   3668        |RPC| only
   3669        Since: 0.1.0
   3670 
   3671                                                    *nvim_ui_pum_set_bounds()*
   3672 nvim_ui_pum_set_bounds({width}, {height}, {row}, {col})
   3673    Tells Nvim the geometry of the popupmenu, to align floating windows with
   3674    an external popup menu.
   3675 
   3676    Note that this method is not to be confused with
   3677    |nvim_ui_pum_set_height()|, which sets the number of visible items in the
   3678    popup menu, while this function sets the bounding box of the popup menu,
   3679    including visual elements such as borders and sliders. Floats need not use
   3680    the same font size, nor be anchored to exact grid corners, so one can set
   3681    floating-point numbers to the popup menu geometry.
   3682 
   3683    Attributes: ~
   3684        |RPC| only
   3685        Since: 0.5.0
   3686 
   3687    Parameters: ~
   3688      • {width}   (`number`) Popupmenu width.
   3689      • {height}  (`number`) Popupmenu height.
   3690      • {row}     (`number`) Popupmenu row.
   3691      • {col}     (`number`) Popupmenu height.
   3692 
   3693 nvim_ui_pum_set_height({height})                    *nvim_ui_pum_set_height()*
   3694    Tells Nvim the number of elements displaying in the popupmenu, to decide
   3695    <PageUp> and <PageDown> movement.
   3696 
   3697    Attributes: ~
   3698        |RPC| only
   3699        Since: 0.4.0
   3700 
   3701    Parameters: ~
   3702      • {height}  (`integer`) Popupmenu height, must be greater than zero.
   3703 
   3704 nvim_ui_send({content})                                       *nvim_ui_send()*
   3705    WARNING: This feature is experimental/unstable.
   3706 
   3707    Sends arbitrary data to a UI. Use this instead of |nvim_chan_send()| or
   3708    `io.stdout:write()`, if you really want to write to the |TUI| host
   3709    terminal.
   3710 
   3711    Emits a "ui_send" event to all UIs with the "stdout_tty" |ui-option| set.
   3712    UIs are expected to write the received data to a connected TTY if one
   3713    exists.
   3714 
   3715    Parameters: ~
   3716      • {content}  (`string`) Content to write to the TTY
   3717 
   3718 nvim_ui_set_focus({gained})                              *nvim_ui_set_focus()*
   3719    Tells the nvim server if focus was gained or lost by the GUI
   3720 
   3721    Attributes: ~
   3722        |RPC| only
   3723        Since: 0.9.0
   3724 
   3725    Parameters: ~
   3726      • {gained}  (`boolean`)
   3727 
   3728 nvim_ui_set_option({name}, {value})                     *nvim_ui_set_option()*
   3729 
   3730    Attributes: ~
   3731        |RPC| only
   3732        Since: 0.1.0
   3733 
   3734    Parameters: ~
   3735      • {name}   (`string`)
   3736      • {value}  (`any`)
   3737 
   3738 nvim_ui_try_resize({width}, {height})                   *nvim_ui_try_resize()*
   3739 
   3740    Attributes: ~
   3741        |RPC| only
   3742        Since: 0.1.0
   3743 
   3744    Parameters: ~
   3745      • {width}   (`integer`)
   3746      • {height}  (`integer`)
   3747 
   3748                                                   *nvim_ui_try_resize_grid()*
   3749 nvim_ui_try_resize_grid({grid}, {width}, {height})
   3750    Tell Nvim to resize a grid. Triggers a grid_resize event with the
   3751    requested grid size or the maximum size if it exceeds size limits.
   3752 
   3753    On invalid grid handle, fails with error.
   3754 
   3755    Attributes: ~
   3756        |RPC| only
   3757        Since: 0.4.0
   3758 
   3759    Parameters: ~
   3760      • {grid}    (`integer`) The handle of the grid to be changed.
   3761      • {width}   (`integer`) The new requested width.
   3762      • {height}  (`integer`) The new requested height.
   3763 
   3764 
   3765 ==============================================================================
   3766 Win_config Functions                                          *api-win_config*
   3767 
   3768 nvim_open_win({buffer}, {enter}, {config})                   *nvim_open_win()*
   3769    Opens a new split window, or a floating window if `relative` is specified,
   3770    or an external window (managed by the UI) if `external` is specified.
   3771 
   3772    Floats are windows that are drawn above the split layout, at some anchor
   3773    position in some other window. Floats can be drawn internally or by
   3774    external GUI with the |ui-multigrid| extension. External windows are only
   3775    supported with multigrid GUIs, and are displayed as separate top-level
   3776    windows.
   3777 
   3778    For a general overview of floats, see |api-floatwin|.
   3779 
   3780    The `width` and `height` of the new window must be specified when opening
   3781    a floating window, but are optional for normal windows.
   3782 
   3783    If `relative` and `external` are omitted, a normal "split" window is
   3784    created. The `win` property determines which window will be split. If no
   3785    `win` is provided or `win == 0`, a window will be created adjacent to the
   3786    current window. If -1 is provided, a top-level split will be created.
   3787    `vertical` and `split` are only valid for normal windows, and are used to
   3788    control split direction. For `vertical`, the exact direction is determined
   3789    by 'splitright' and 'splitbelow'. Split windows cannot have `bufpos`,
   3790    `row`, `col`, `border`, `title`, `footer` properties.
   3791 
   3792    With relative=editor (row=0,col=0) refers to the top-left corner of the
   3793    screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right
   3794    corner. Fractional values are allowed, but the builtin implementation
   3795    (used by non-multigrid UIs) will always round down to nearest integer.
   3796 
   3797    Out-of-bounds values, and configurations that make the float not fit
   3798    inside the main editor, are allowed. The builtin implementation truncates
   3799    values so floats are fully within the main screen grid. External GUIs
   3800    could let floats hover outside of the main window like a tooltip, but this
   3801    should not be used to specify arbitrary WM screen positions.
   3802 
   3803    Examples: >lua
   3804        -- Window-relative float with 'statusline' enabled:
   3805        local w1 = vim.api.nvim_open_win(0, false,
   3806          {relative='win', row=3, col=3, width=40, height=4})
   3807        vim.wo[w1].statusline = vim.o.statusline
   3808 
   3809        -- Buffer-relative float (travels as buffer is scrolled):
   3810        vim.api.nvim_open_win(0, false,
   3811          {relative='win', width=40, height=4, bufpos={100,10}})
   3812 
   3813        -- Vertical split left of the current window:
   3814        vim.api.nvim_open_win(0, false, { split = 'left', win = 0, })
   3815 <
   3816 
   3817    Attributes: ~
   3818        not allowed when |textlock| is active
   3819        Since: 0.4.0
   3820 
   3821    Parameters: ~
   3822      • {buffer}  (`integer`) Buffer to display, or 0 for current buffer
   3823      • {enter}   (`boolean`) Enter the window (make it the current window)
   3824      • {config}  (`vim.api.keyset.win_config`) Map defining the window
   3825                  configuration. Keys:
   3826                  • anchor: Decides which corner of the float to place at
   3827                    (row,col):
   3828                    • "NW" northwest (default)
   3829                    • "NE" northeast
   3830                    • "SW" southwest
   3831                    • "SE" southeast
   3832                  • border: (`string|string[]`) (defaults to 'winborder'
   3833                    option) Window border. The string form accepts the same
   3834                    values as the 'winborder' option. The array form must have
   3835                    a length of eight or any divisor of eight, specifying the
   3836                    chars that form the border in a clockwise fashion starting
   3837                    from the top-left corner. For example, the double-box
   3838                    style can be specified as: >
   3839                    [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
   3840 <
   3841                    If fewer than eight chars are given, they will be
   3842                    repeated. An ASCII border could be specified as: >
   3843                    [ "/", "-", \"\\\\\", "|" ],
   3844 <
   3845                    Or one char for all sides: >
   3846                    [ "x" ].
   3847 <
   3848                    Empty string can be used to hide a specific border. This
   3849                    example will show only vertical borders, not horizontal: >
   3850                    [ "", "", "", ">", "", "", "", "<" ]
   3851 <
   3852                    By default, |hl-FloatBorder| highlight is used, which
   3853                    links to |hl-WinSeparator| when not defined. Each border
   3854                    side can specify an optional highlight: >
   3855                    [ ["+", "MyCorner"], ["x", "MyBorder"] ].
   3856 <
   3857                  • bufpos: Places float relative to buffer text (only when
   3858                    relative="win"). Takes a tuple of zero-indexed
   3859                    `[line, column]`. `row` and `col` if given are applied
   3860                    relative to this position, else they default to:
   3861                    • `row=1` and `col=0` if `anchor` is "NW" or "NE"
   3862                    • `row=0` and `col=0` if `anchor` is "SW" or "SE" (thus
   3863                      like a tooltip near the buffer text).
   3864                  • col: Column position in units of screen cell width, may be
   3865                    fractional.
   3866                  • external: GUI should display the window as an external
   3867                    top-level window. Currently accepts no other positioning
   3868                    configuration together with this.
   3869                  • fixed: If true when anchor is NW or SW, the float window
   3870                    would be kept fixed even if the window would be truncated.
   3871                  • focusable: Enable focus by user actions (wincmds, mouse
   3872                    events). Defaults to true. Non-focusable windows can be
   3873                    entered by |nvim_set_current_win()|, or, when the `mouse`
   3874                    field is set to true, by mouse events. See |focusable|.
   3875                  • footer: (optional) Footer in window border, string or
   3876                    list. List should consist of `[text, highlight]` tuples.
   3877                    If string, or a tuple lacks a highlight, the default
   3878                    highlight group is `FloatFooter`.
   3879                  • footer_pos: Footer position. Must be set with `footer`
   3880                    option. Value can be one of "left", "center", or "right".
   3881                    Default is `"left"`.
   3882                  • height: Window height (in character cells). Minimum of 1.
   3883                  • hide: If true the floating window will be hidden and the
   3884                    cursor will be invisible when focused on it.
   3885                  • mouse: Specify how this window interacts with mouse
   3886                    events. Defaults to `focusable` value.
   3887                    • If false, mouse events pass through this window.
   3888                    • If true, mouse events interact with this window
   3889                      normally.
   3890                  • noautocmd: Block all autocommands for the duration of the
   3891                    call. Cannot be changed by |nvim_win_set_config()|.
   3892                  • relative: Sets the window layout to "floating", placed at
   3893                    (row,col) coordinates relative to:
   3894                    • "cursor" Cursor position in current window.
   3895                    • "editor" The global editor grid.
   3896                    • "laststatus" 'laststatus' if present, or last row.
   3897                    • "mouse" Mouse position.
   3898                    • "tabline" Tabline if present, or first row.
   3899                    • "win" Window given by the `win` field, or current
   3900                      window.
   3901                  • row: Row position in units of "screen cell height", may be
   3902                    fractional.
   3903                  • split: Split direction: "left", "right", "above", "below".
   3904                  • style: (optional) Configure the appearance of the window.
   3905                    Currently only supports one value:
   3906                    • "minimal" Nvim will display the window with many UI
   3907                      options disabled. This is useful when displaying a
   3908                      temporary float where the text should not be edited.
   3909                      Disables 'number', 'relativenumber', 'cursorline',
   3910                      'cursorcolumn', 'foldcolumn', 'spell' and 'list'
   3911                      options. 'signcolumn' is changed to `auto` and
   3912                      'colorcolumn' is cleared. 'statuscolumn' is changed to
   3913                      empty. The end-of-buffer region is hidden by setting
   3914                      `eob` flag of 'fillchars' to a space char, and clearing
   3915                      the |hl-EndOfBuffer| region in 'winhighlight'.
   3916                  • title: (optional) Title in window border, string or list.
   3917                    List should consist of `[text, highlight]` tuples. If
   3918                    string, or a tuple lacks a highlight, the default
   3919                    highlight group is `FloatTitle`.
   3920                  • title_pos: Title position. Must be set with `title`
   3921                    option. Value can be one of "left", "center", or "right".
   3922                    Default is `"left"`.
   3923                  • vertical: Split vertically |:vertical|.
   3924                  • width: Window width (in character cells). Minimum of 1.
   3925                  • win: |window-ID| window to split, or relative window when
   3926                    creating a float (relative="win"). When splitting,
   3927                    negative value works like |:topleft|, |:botright|.
   3928                  • zindex: Stacking order. floats with higher `zindex` go on
   3929                    top on floats with lower indices. Must be larger than
   3930                    zero. The following screen elements have hard-coded
   3931                    z-indices:
   3932                    • 100: insert completion popupmenu
   3933                    • 200: message scrollback
   3934                    • 250: cmdline completion popupmenu (when
   3935                      wildoptions+=pum) The default value for floats are 50.
   3936                      In general, values below 100 are recommended, unless
   3937                      there is a good reason to overshadow builtin elements.
   3938                  • _cmdline_offset: (EXPERIMENTAL) When provided, anchor the
   3939                    |cmdline-completion| popupmenu to this window, with an
   3940                    offset in screen cell width.
   3941 
   3942    Return: ~
   3943        (`integer`) |window-ID|, or 0 on error
   3944 
   3945 nvim_win_get_config({window})                          *nvim_win_get_config()*
   3946    Gets window configuration in the form of a dict which can be passed as the
   3947    `config` parameter of |nvim_open_win()|.
   3948 
   3949    For non-floating windows, `relative` is empty.
   3950 
   3951    Attributes: ~
   3952        Since: 0.4.0
   3953 
   3954    Parameters: ~
   3955      • {window}  (`integer`) |window-ID|, or 0 for current window
   3956 
   3957    Return: ~
   3958        (`vim.api.keyset.win_config`) Map defining the window configuration,
   3959        see |nvim_open_win()|
   3960 
   3961 nvim_win_set_config({window}, {config})                *nvim_win_set_config()*
   3962    Reconfigures the layout of a window.
   3963    • Absent (`nil`) keys will not be changed.
   3964    • `row` / `col` / `relative` must be reconfigured together.
   3965    • Cannot be used to move the last window in a tabpage to a different one.
   3966 
   3967    Example: to convert a floating window to a "normal" split window, specify
   3968    the `win` field: >lua
   3969        vim.api.nvim_win_set_config(0, { split = 'above', win = vim.fn.win_getid(1), })
   3970 <
   3971 
   3972    Attributes: ~
   3973        Since: 0.4.0
   3974 
   3975    Parameters: ~
   3976      • {window}  (`integer`) |window-ID|, or 0 for current window
   3977      • {config}  (`vim.api.keyset.win_config`) Map defining the window
   3978                  configuration, see |nvim_open_win()|
   3979 
   3980    See also: ~
   3981      • |nvim_open_win()|
   3982 
   3983 
   3984 ==============================================================================
   3985 Window Functions                                                  *api-window*
   3986 
   3987 nvim_win_call({window}, {fun})                               *nvim_win_call()*
   3988    Calls a function with window as temporary current window.
   3989 
   3990    Attributes: ~
   3991        Lua |vim.api| only
   3992        Since: 0.5.0
   3993 
   3994    Parameters: ~
   3995      • {window}  (`integer`) |window-ID|, or 0 for current window
   3996      • {fun}     (`function`) Function to call inside the window (currently
   3997                  Lua callable only)
   3998 
   3999    Return: ~
   4000        (`any`) Return value of function.
   4001 
   4002    See also: ~
   4003      • |win_execute()|
   4004      • |nvim_buf_call()|
   4005 
   4006 nvim_win_close({window}, {force})                           *nvim_win_close()*
   4007    Closes the window (like |:close| with a |window-ID|).
   4008 
   4009    Attributes: ~
   4010        not allowed when |textlock| is active
   4011        Since: 0.4.0
   4012 
   4013    Parameters: ~
   4014      • {window}  (`integer`) |window-ID|, or 0 for current window
   4015      • {force}   (`boolean`) Behave like `:close!` The last window of a
   4016                  buffer with unwritten changes can be closed. The buffer will
   4017                  become hidden, even if 'hidden' is not set.
   4018 
   4019 nvim_win_del_var({window}, {name})                        *nvim_win_del_var()*
   4020    Removes a window-scoped (w:) variable
   4021 
   4022    Attributes: ~
   4023        Since: 0.1.0
   4024 
   4025    Parameters: ~
   4026      • {window}  (`integer`) |window-ID|, or 0 for current window
   4027      • {name}    (`string`) Variable name
   4028 
   4029 nvim_win_get_buf({window})                                *nvim_win_get_buf()*
   4030    Gets the current buffer in a window
   4031 
   4032    Attributes: ~
   4033        Since: 0.1.0
   4034 
   4035    Parameters: ~
   4036      • {window}  (`integer`) |window-ID|, or 0 for current window
   4037 
   4038    Return: ~
   4039        (`integer`) Buffer id
   4040 
   4041 nvim_win_get_cursor({window})                          *nvim_win_get_cursor()*
   4042    Gets the (1,0)-indexed, buffer-relative cursor position for a given window
   4043    (different windows showing the same buffer have independent cursor
   4044    positions). |api-indexing|
   4045 
   4046    Attributes: ~
   4047        Since: 0.1.0
   4048 
   4049    Parameters: ~
   4050      • {window}  (`integer`) |window-ID|, or 0 for current window
   4051 
   4052    Return: ~
   4053        (`[integer, integer]`) (row, col) tuple
   4054 
   4055    See also: ~
   4056      • |getcurpos()|
   4057 
   4058 nvim_win_get_height({window})                          *nvim_win_get_height()*
   4059    Gets the window height
   4060 
   4061    Attributes: ~
   4062        Since: 0.1.0
   4063 
   4064    Parameters: ~
   4065      • {window}  (`integer`) |window-ID|, or 0 for current window
   4066 
   4067    Return: ~
   4068        (`integer`) Height as a count of rows
   4069 
   4070 nvim_win_get_number({window})                          *nvim_win_get_number()*
   4071    Gets the window number
   4072 
   4073    Attributes: ~
   4074        Since: 0.1.0
   4075 
   4076    Parameters: ~
   4077      • {window}  (`integer`) |window-ID|, or 0 for current window
   4078 
   4079    Return: ~
   4080        (`integer`) Window number
   4081 
   4082 nvim_win_get_position({window})                      *nvim_win_get_position()*
   4083    Gets the window position in display cells. First position is zero.
   4084 
   4085    Attributes: ~
   4086        Since: 0.1.0
   4087 
   4088    Parameters: ~
   4089      • {window}  (`integer`) |window-ID|, or 0 for current window
   4090 
   4091    Return: ~
   4092        (`[integer, integer]`) (row, col) tuple with the window position
   4093 
   4094 nvim_win_get_tabpage({window})                        *nvim_win_get_tabpage()*
   4095    Gets the window tabpage
   4096 
   4097    Attributes: ~
   4098        Since: 0.1.0
   4099 
   4100    Parameters: ~
   4101      • {window}  (`integer`) |window-ID|, or 0 for current window
   4102 
   4103    Return: ~
   4104        (`integer`) Tabpage that contains the window
   4105 
   4106 nvim_win_get_var({window}, {name})                        *nvim_win_get_var()*
   4107    Gets a window-scoped (w:) variable
   4108 
   4109    Attributes: ~
   4110        Since: 0.1.0
   4111 
   4112    Parameters: ~
   4113      • {window}  (`integer`) |window-ID|, or 0 for current window
   4114      • {name}    (`string`) Variable name
   4115 
   4116    Return: ~
   4117        (`any`) Variable value
   4118 
   4119 nvim_win_get_width({window})                            *nvim_win_get_width()*
   4120    Gets the window width
   4121 
   4122    Attributes: ~
   4123        Since: 0.1.0
   4124 
   4125    Parameters: ~
   4126      • {window}  (`integer`) |window-ID|, or 0 for current window
   4127 
   4128    Return: ~
   4129        (`integer`) Width as a count of columns
   4130 
   4131 nvim_win_hide({window})                                      *nvim_win_hide()*
   4132    Closes the window and hide the buffer it contains (like |:hide| with a
   4133    |window-ID|).
   4134 
   4135    Like |:hide| the buffer becomes hidden unless another window is editing
   4136    it, or 'bufhidden' is `unload`, `delete` or `wipe` as opposed to |:close|
   4137    or |nvim_win_close()|, which will close the buffer.
   4138 
   4139    Attributes: ~
   4140        not allowed when |textlock| is active
   4141        Since: 0.5.0
   4142 
   4143    Parameters: ~
   4144      • {window}  (`integer`) |window-ID|, or 0 for current window
   4145 
   4146 nvim_win_is_valid({window})                              *nvim_win_is_valid()*
   4147    Checks if a window is valid
   4148 
   4149    Attributes: ~
   4150        Since: 0.1.0
   4151 
   4152    Parameters: ~
   4153      • {window}  (`integer`) |window-ID|, or 0 for current window
   4154 
   4155    Return: ~
   4156        (`boolean`) true if the window is valid, false otherwise
   4157 
   4158 nvim_win_set_buf({window}, {buffer})                      *nvim_win_set_buf()*
   4159    Sets the current buffer in a window, without side effects
   4160 
   4161    Attributes: ~
   4162        not allowed when |textlock| is active
   4163        Since: 0.3.2
   4164 
   4165    Parameters: ~
   4166      • {window}  (`integer`) |window-ID|, or 0 for current window
   4167      • {buffer}  (`integer`) Buffer id
   4168 
   4169 nvim_win_set_cursor({window}, {pos})                   *nvim_win_set_cursor()*
   4170    Sets the (1,0)-indexed cursor position in the window. |api-indexing| This
   4171    scrolls the window even if it is not the current one.
   4172 
   4173    Attributes: ~
   4174        Since: 0.1.0
   4175 
   4176    Parameters: ~
   4177      • {window}  (`integer`) |window-ID|, or 0 for current window
   4178      • {pos}     (`[integer, integer]`) (row, col) tuple representing the new
   4179                  position
   4180 
   4181 nvim_win_set_height({window}, {height})                *nvim_win_set_height()*
   4182    Sets the window height.
   4183 
   4184    Attributes: ~
   4185        Since: 0.1.0
   4186 
   4187    Parameters: ~
   4188      • {window}  (`integer`) |window-ID|, or 0 for current window
   4189      • {height}  (`integer`) Height as a count of rows
   4190 
   4191 nvim_win_set_hl_ns({window}, {ns_id})                   *nvim_win_set_hl_ns()*
   4192    Set highlight namespace for a window. This will use highlights defined
   4193    with |nvim_set_hl()| for this namespace, but fall back to global
   4194    highlights (ns=0) when missing.
   4195 
   4196    This takes precedence over the 'winhighlight' option.
   4197 
   4198    Attributes: ~
   4199        Since: 0.8.0
   4200 
   4201    Parameters: ~
   4202      • {window}  (`integer`)
   4203      • {ns_id}   (`integer`) the namespace to use
   4204 
   4205 nvim_win_set_var({window}, {name}, {value})               *nvim_win_set_var()*
   4206    Sets a window-scoped (w:) variable
   4207 
   4208    Attributes: ~
   4209        Since: 0.1.0
   4210 
   4211    Parameters: ~
   4212      • {window}  (`integer`) |window-ID|, or 0 for current window
   4213      • {name}    (`string`) Variable name
   4214      • {value}   (`any`) Variable value
   4215 
   4216 nvim_win_set_width({window}, {width})                   *nvim_win_set_width()*
   4217    Sets the window width. This will only succeed if the screen is split
   4218    vertically.
   4219 
   4220    Attributes: ~
   4221        Since: 0.1.0
   4222 
   4223    Parameters: ~
   4224      • {window}  (`integer`) |window-ID|, or 0 for current window
   4225      • {width}   (`integer`) Width as a count of columns
   4226 
   4227 nvim_win_text_height({window}, {opts})                *nvim_win_text_height()*
   4228    Computes the number of screen lines occupied by a range of text in a given
   4229    window. Works for off-screen text and takes folds into account.
   4230 
   4231    Diff filler or virtual lines above a line are counted as a part of that
   4232    line, unless the line is on "start_row" and "start_vcol" is specified.
   4233 
   4234    Diff filler or virtual lines below the last buffer line are counted in the
   4235    result when "end_row" is omitted.
   4236 
   4237    Line indexing is similar to |nvim_buf_get_text()|.
   4238 
   4239    Attributes: ~
   4240        Since: 0.10.0
   4241 
   4242    Parameters: ~
   4243      • {window}  (`integer`) |window-ID|, or 0 for current window.
   4244      • {opts}    (`vim.api.keyset.win_text_height`) Optional parameters:
   4245                  • start_row: Starting line index, 0-based inclusive. When
   4246                    omitted start at the very top.
   4247                  • end_row: Ending line index, 0-based inclusive. When
   4248                    omitted end at the very bottom.
   4249                  • start_vcol: Starting virtual column index on "start_row",
   4250                    0-based inclusive, rounded down to full screen lines. When
   4251                    omitted include the whole line.
   4252                  • end_vcol: Ending virtual column index on "end_row",
   4253                    0-based exclusive, rounded up to full screen lines. When 0
   4254                    only include diff filler and virtual lines above
   4255                    "end_row". When omitted include the whole line.
   4256                  • max_height: Don't add the height of lines below the row
   4257                    for which this height is reached. Useful to e.g. limit the
   4258                    height to the window height, avoiding unnecessary work. Or
   4259                    to find out how many buffer lines beyond "start_row" take
   4260                    up a certain number of logical lines (returned in
   4261                    "end_row" and "end_vcol").
   4262 
   4263    Return: ~
   4264        (`vim.api.keyset.win_text_height_ret`) Dict containing text height
   4265        information, with these keys:
   4266        • all: The total number of screen lines occupied by the range.
   4267        • fill: The number of diff filler or virtual lines among them.
   4268        • end_row: The row on which the returned height is reached (first row
   4269          of a closed fold).
   4270        • end_vcol: Ending virtual column in "end_row" where "max_height" or
   4271          the returned height is reached. 0 if "end_row" is a closed fold.
   4272 
   4273    See also: ~
   4274      • |virtcol()| for text width.
   4275 
   4276 
   4277 vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: