robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
359459dec6
master
1---@meta 2-- This file is NOT generated, edit it directly. 3-- luacheck: no unused args 4 5error ( 'Cannot require a meta file' ) 6 7--- @brief <pre>help 8--- vim.api.{func}({...}) *vim.api* 9--- Invokes Nvim |API| function {func} with arguments {...}. 10--- Example: call the "nvim_get_current_line()" API function: >lua 11--- print(tostring(vim.api.nvim_get_current_line())) 12--- 13--- vim.NIL *vim.NIL* 14--- Special value representing NIL in |RPC| and |v:null| in Vimscript 15--- conversion, and similar cases. Lua `nil` cannot be used as part of a Lua 16--- table representing a Dictionary or Array, because it is treated as 17--- missing: `{"foo", nil}` is the same as `{"foo"}`. 18--- 19--- vim.type_idx *vim.type_idx* 20--- Type index for use in |lua-special-tbl|. Specifying one of the values from 21--- |vim.types| allows typing the empty table (it is unclear whether empty Lua 22--- table represents empty list or empty array) and forcing integral numbers 23--- to be |Float|. See |lua-special-tbl| for more details. 24--- 25--- vim.val_idx *vim.val_idx* 26--- Value index for tables representing |Float|s. A table representing 27--- floating-point value 1.0 looks like this: >lua 28--- { 29--- [vim.type_idx] = vim.types.float, 30--- [vim.val_idx] = 1.0, 31--- } 32--- < See also |vim.type_idx| and |lua-special-tbl|. 33--- 34--- vim.types *vim.types* 35--- Table with possible values for |vim.type_idx|. Contains two sets of 36--- key-value pairs: first maps possible values for |vim.type_idx| to 37--- human-readable strings, second maps human-readable type names to values 38--- for |vim.type_idx|. Currently contains pairs for `float`, `array` and 39--- `dictionary` types. 40--- 41--- Note: One must expect that values corresponding to `vim.types.float`, 42--- `vim.types.array` and `vim.types.dictionary` fall under only two following 43--- assumptions: 44--- 1. Value may serve both as a key and as a value in a table. Given the 45--- properties of Lua tables this basically means “value is not `nil`”. 46--- 2. For each value in `vim.types` table `vim.types[vim.types[value]]` is the 47--- same as `value`. 48--- No other restrictions are put on types, and it is not guaranteed that 49--- values corresponding to `vim.types.float`, `vim.types.array` and 50--- `vim.types.dictionary` will not change or that `vim.types` table will only 51--- contain values for these three types. 52--- 53--- *log_levels* *vim.log.levels* 54--- Log levels are one of the values defined in `vim.log.levels`: 55--- 56--- vim.log.levels.DEBUG 57--- vim.log.levels.ERROR 58--- vim.log.levels.INFO 59--- vim.log.levels.TRACE 60--- vim.log.levels.WARN 61--- vim.log.levels.OFF 62--- 63--- </pre> 64 65---@nodoc 66---@class vim.NIL 67 68---@type vim.NIL 69---@nodoc 70vim . NIL =... 71 72--- Returns true if the code is executing as part of a "fast" event handler, 73--- where most of the API is disabled. These are low-level events (e.g. 74--- |lua-loop-callbacks|) which can be invoked whenever Nvim polls for input. 75--- When this is `false` most API functions are callable (but may be subject 76--- to other restrictions such as |textlock|). 77function vim . in_fast_event () end 78 79--- Creates a special empty table (marked with a metatable), which Nvim 80--- converts to an empty dictionary when translating Lua values to Vimscript 81--- or API types. Nvim by default converts an empty table `{}` without this 82--- metatable to an list/array. 83--- 84--- Note: If numeric keys are present in the table, Nvim ignores the metatable 85--- marker and converts the dict to a list/array anyway. 86--- @return table 87function vim . empty_dict () end 88 89--- Sends {event} to {channel} via |RPC| and returns immediately. If {channel} 90--- is 0, the event is broadcast to all channels. 91--- 92--- This function also works in a fast callback |lua-loop-callbacks|. 93--- @param channel integer 94--- @param method string 95--- @param ...? any 96function vim . rpcnotify ( channel , method , ... ) end 97 98--- Invokes |RPC| `method` on `channel` and blocks until a response is received. 99--- 100--- Note: Msgpack NIL values in the response are represented as |vim.NIL|. 101--- 102--- Example: see [nvim_exec_lua()] 103--- 104--- @param channel integer 105--- @param method string 106--- @param ...? any 107function vim . rpcrequest ( channel , method , ... ) end 108 109--- Compares strings case-insensitively. 110--- @param a string 111--- @param b string 112--- @return 0|1|-1 113--- if strings are 114--- equal, {a} is greater than {b} or {a} is lesser than {b}, respectively. 115function vim . stricmp ( a , b ) end 116 117--- Gets a list of the starting byte positions of each UTF-8 codepoint in the given string. 118--- 119--- Embedded NUL bytes are treated as terminating the string. 120--- @param str string 121--- @return integer[] 122function vim . str_utf_pos ( str ) end 123 124--- Gets the distance (in bytes) from the starting byte of the codepoint (character) that {index} 125--- points to. 126--- 127--- The result can be added to {index} to get the starting byte of a character. 128--- 129--- Examples: 130--- 131--- ```lua 132--- -- The character 'æ' is stored as the bytes '\xc3\xa6' (using UTF-8) 133--- 134--- -- Returns 0 because the index is pointing at the first byte of a character 135--- vim.str_utf_start('æ', 1) 136--- 137--- -- Returns -1 because the index is pointing at the second byte of a character 138--- vim.str_utf_start('æ', 2) 139--- ``` 140--- 141--- @param str string 142--- @param index integer 143--- @return integer 144function vim . str_utf_start ( str , index ) end 145 146--- Gets the distance (in bytes) from the last byte of the codepoint (character) that {index} points 147--- to. 148--- 149--- Examples: 150--- 151--- ```lua 152--- -- The character 'æ' is stored as the bytes '\xc3\xa6' (using UTF-8) 153--- 154--- -- Returns 0 because the index is pointing at the last byte of a character 155--- vim.str_utf_end('æ', 2) 156--- 157--- -- Returns 1 because the index is pointing at the penultimate byte of a character 158--- vim.str_utf_end('æ', 1) 159--- ``` 160--- 161--- @param str string 162--- @param index integer 163--- @return integer 164function vim . str_utf_end ( str , index ) end 165 166--- The result is a String, which is the text {str} converted from 167--- encoding {from} to encoding {to}. When the conversion fails `nil` is 168--- returned. When some characters could not be converted they 169--- are replaced with "?". 170--- The encoding names are whatever the iconv() library function 171--- can accept, see ":Man 3 iconv". 172--- 173--- @param str string Text to convert 174--- @param from string Encoding of {str} 175--- @param to string Target encoding 176--- @return string? : Converted string if conversion succeeds, `nil` otherwise. 177function vim . iconv ( str , from , to , opts ) end 178 179--- Schedules {fn} to be invoked soon by the main event-loop. Useful 180--- to avoid |textlock| or other temporary restrictions. 181--- @param fn fun() 182--- @return nil result 183--- @return string? err Error message if scheduling failed, `nil` otherwise. 184function vim . schedule ( fn ) end 185 186---@nodoc 187---@class vim._core 188vim . _core ={} 189 190--- @nodoc 191--- Polls the main event loop for up to {timeout} milliseconds. 192--- @param timeout integer 193--- @param fast_only boolean 194function vim . _core . loop_poll ( timeout , fast_only ) end 195 196--- @nodoc 197--- Flushes pending UI updates. 198function vim . _core . ui_flush () end 199 200--- @nodoc 201--- Checks for interrupt, clears it, and consumes input if present. 202--- @return boolean 203function vim . _core . check_interrupt () end 204 205--- @nodoc 206--- Executes one Ex command line obtained from `getline`, which is also called for any 207--- continuation lines (`:append` text, `:function` body, heredoc, …). See `vim._core.exmode`. 208--- @param getline fun(): string? 209--- @return boolean # false if {getline} returned nil before any line was read (EOF). 210function vim . _core . ex_docmd ( getline ) end 211 212--- @nodoc 213--- Parses `keys` (internal representation) into a list of key chords. See |vim.keycode()|. 214--- @param keys string 215--- @return vim.keycode.chord[] 216function vim . _core . keyparse ( keys ) end 217 218--- Subscribe to |ui-events|, similar to |nvim_ui_attach()| but receive events in a Lua callback. 219--- Used to implement screen elements like popupmenu or message handling in Lua. 220--- 221--- {callback} receives event name plus additional parameters. See |ui-popupmenu| 222--- and the sections below for event format for respective events. 223--- 224--- Callbacks for `msg_show` events originating from internal messages (as 225--- opposed to events from commands or API calls) are executed in |api-fast| 226--- context; showing the message needs to be scheduled. 227--- 228--- Excessive errors inside the callback will result in forced detachment. 229--- 230--- WARNING: This api is considered experimental. Usability will vary for 231--- different screen elements. In particular `ext_messages` behavior is subject 232--- to further changes and usability improvements. This is expected to be 233--- used to handle messages when setting 'cmdheight' to zero (which is 234--- likewise experimental). 235--- 236--- Example (stub for a |ui-popupmenu| implementation): 237--- 238--- ```lua 239--- ns = vim.api.nvim_create_namespace('my_fancy_pum') 240--- 241--- vim.ui_attach(ns, {ext_popupmenu=true}, function(event, ...) 242--- if event == 'popupmenu_show' then 243--- local items, selected, row, col, grid = ... 244--- print('display pum ', #items) 245--- elseif event == 'popupmenu_select' then 246--- local selected = ... 247--- print('selected', selected) 248--- elseif event == 'popupmenu_hide' then 249--- print('FIN') 250--- end 251--- end) 252--- ``` 253--- 254--- @since 0 255--- 256--- @param ns integer Namespace ID 257--- @param opts table<string, any> Optional parameters. 258--- - {ext_…}? (`boolean`) Any of |ui-ext-options|, if true 259--- enable events for the respective UI element. 260--- - {set_cmdheight}? (`boolean`) If false, avoid setting 261--- 'cmdheight' to 0 when `ext_messages` is enabled. 262--- @param callback fun(event: string, ...): any Function called for each UI event. 263--- A truthy return value signals to Nvim that the event is handled, 264--- in which case it is not propagated to remote UIs. 265function vim . ui_attach ( ns , opts , callback ) end 266 267--- Detach a callback previously attached with |vim.ui_attach()| for the 268--- given namespace {ns}. 269--- @param ns integer Namespace ID 270function vim . ui_detach ( ns ) end