diff options
Diffstat (limited to 'runtime/doc/if_lua.txt')
-rw-r--r-- | runtime/doc/if_lua.txt | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 9dbbf87995..97bbb34078 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -252,13 +252,55 @@ For example, to use the "nvim_get_current_line()" API function, call print(tostring(vim.api.nvim_get_current_line())) ------------------------------------------------------------------------------ -vim.* utility functions +vim.* builtin functions + +vim.deepcopy({object}) *vim.deepcopy* + Performs a deep copy of the given object, and returns that copy. + For a non-table object, that just means a usual copy of the object, + while for a table all subtables are copied recursively. + +vim.gsplit({s}, {sep}, {plain}) *vim.gsplit* + Split a given string by a separator. Returns an iterator of the + split components. The separator can be a lua pattern, see + https://www.lua.org/pil/20.2.html + Setting {plain} to `true` turns off pattern matching, as it is passed + to `string:find`, see + http://lua-users.org/wiki/StringLibraryTutorial + + Parameters:~ + {s} String: String to split + {sep} String: Separator pattern. If empty, split by chars. + {plain} Boolean: If false, match {sep} verbatim + + Return:~ + Iterator of strings, which are the components of {s} after + splitting + +vim.split({s}, {sep}, {plain}) *vim.split* + Split a given string by a separator. Returns a table containing the + split components. The separator can be a lua pattern, see + https://www.lua.org/pil/20.2.html + Setting {plain} to `true` turns off pattern matching, as it is passed + to `string:find`, see + http://lua-users.org/wiki/StringLibraryTutorial + + Parameters:~ + {s} String: String to split + {sep} String: Separator pattern. If empty, split by chars. + {plain} Boolean: If false, match {sep} verbatim + + Return:~ + Table of strings, which are the components of {s} after + splitting vim.stricmp(a, b) *lua-vim.stricmp* Function used for case-insensitive string comparison. Takes two string arguments and returns 0, 1 or -1 if strings are equal, a is greater then b or a is lesser then b respectively. +vim.trim({string}) *vim.trim* + Returns the string with all leading and trailing whitespace removed. + vim.type_idx *lua-vim.type_idx* Type index for use in |lua-special-tbl|. Specifying one of the values from |lua-vim.types| allows typing the empty table (it is @@ -294,6 +336,16 @@ vim.types *lua-vim.types* `vim.types.dictionary` will not change or that `vim.types` table will only contain values for these three types. +------------------------------------------------------------------------------ +vim.* runtime functions + +Those functions are only available after the runtime files have been loaded. +In particular, they are not available when using `nvim -u NONE`. + +vim.inspect({object}, {options}) *vim.inspect* + Return a human-readable representation of the passed object. See + https://github.com/kikito/inspect.lua + for details and possible options. ============================================================================== The luaeval function *lua-luaeval* *lua-eval* *luaeval()* |