aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
Commit message (Collapse)AuthorAge
...
* feat(vim.diff): allow passing an integer for linematchLewis Russell2023-04-04
|
* docs: fix typosdundargoc2023-04-04
| | | | | | Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: himanoa <matsunoappy@gmail.com>
* feat: allow function passed to defaulttable to take an argument (#22839)Gregory Anders2023-04-01
| | | | Pass the value of the key being accessed to the create function, to allow users to dynamically generate default values.
* refactor(loader): cache hash informationLewis Russell2023-03-31
| | | | | | | | | | | Whenever we run fs_stat() on a path, save this information in the loader so it can be re-used. - Loader.loadfile: Remove arguments `hash` as it is no longer needed. - Loader.loader: Use _G.loadstring instead of Loader.load This allows plugins to wrap loadstring to inspection and profiling - factor out read file logic
* feat(vim.fs): improve normalizeLewis Russell2023-03-26
| | | | | | - Add options argument with an option to expand env vars - Resolve '//' -> '/' - Use in vim.loader
* feat(lua): add `vim.loader`Folke Lemaitre2023-03-26
| | | feat: new faster lua loader using byte-compilation
* feat(api): nvim_exec2(), deprecate nvim_exec() #19032Evgeni Chasnovski2023-03-25
| | | | | | | Problem: The signature of nvim_exec() is not extensible per ":help api-contract". Solution: Introduce nvim_exec2() and deprecate nvim_exec().
* docs: more details about vim.region (#21116)Jakub Łuczyński2023-03-25
|
* refactor(vim.gsplit): remove "keepsep"Justin M. Keyes2023-03-22
| | | | string.gmatch() is superior, use that instead.
* feat(vim.gsplit): gain features of vim.splitJustin M. Keyes2023-03-22
| | | | | | | | | | | | | Problem: - vim.split has more features than vim.gsplit. - Cannot inspect the "separator" segments of vim.split or vim.gsplit. Solution: - Move common implementation from vim.split into vim.gsplit. - TODO: deprecate vim.split in favor of vim.totable(vim.gsplit())? - Introduce `keepsep` parameter. Related: 84f66909e4008a57da947f1640bfc24da5e41a72
* feat(lua): allow `:=expr` as a shorter version of `:lua =expr`bfredl2023-03-22
| | | | | | | | | | | | | | | | existing behavior of := and :[range]= are unchanged. `|` is still allowed with this usage. However, :=p and similar are changed in a way which could be construed as a breaking change. Allowing |ex-flags| for := in the first place was a mistake as any form of := DOES NOT MOVE THE CURSOR. So it would print one line number and then print a completely different line contents after that.
* feat(vim.version): more coercion with strict=falseJustin M. Keyes2023-03-20
| | | | | | | | | | | | | Problem: "tmux 3.2a" (output from "tmux -V") is not parsed easily. Solution: With `strict=false`, discard everything before the first digit. - rename Semver => Version - rename vim.version.version() => vim.version._version() - rename matches() => has() - remove `opts` from cmp()
* feat: add `vim.filetype.get_option()`Lewis Russell2023-03-20
|
* fix(lua): vim.deprecate() shows ":help deprecated" #22677Justin M. Keyes2023-03-15
| | | | | | | | | | | Problem: vim.deprecate() shows ":help deprecated" for third-party plugins. ":help deprecated" only describes deprecations in Nvim, and is unrelated to any 3rd party deprecations. Solution: If `plugin` is specified, don't show ":help deprecated". fix #22235
* docs(html): render @see items as a list #22675Justin M. Keyes2023-03-15
| | | | | | | | | | | Needed for "flow" HTML layout. Flow layout before: See also: https://github.com/kikito/inspect.lua https://github.com/mpeterv/vinspect Flow layout after: See also: - https://github.com/kikito/inspect.lua - https://github.com/mpeterv/vinspect
* refactor!: rename vim.pretty_print => vim.printJustin M. Keyes2023-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The function name `vim.pretty_print`: 1. is verbose, which partially defeats its purpose as sugar 2. does not draw from existing precedent or any sort of convention (except external projects like penlight or python?), which reduces discoverability, and degrades signaling about best practices. Solution: - Rename to `vim.print`. - Change the behavior so that 1. strings are printed without quotes 2. each arg is printed on its own line 3. tables are indented with 2 instead of 4 spaces - Example: :lua ='a', 'b', 42, {a=3} a b 42 { a = 3 } Comparison of alternatives: - `vim.print`: - pro: consistent with Lua's `print()` - pro: aligns with potential `nvim_print` API function which will replace nvim_echo, nvim_notify, etc. - con: behaves differently than Lua's `print()`, slightly misleading? - `vim.echo`: - pro: `:echo` has similar "pretty print" behavior. - con: inconsistent with Lua idioms. - `vim.p`: - pro: very short, fits with `vim.o`, etc. - con: not as discoverable as "echo" - con: less opportunity for `local p = vim.p` because of potential shadowing.
* Merge pull request #13834 from bfredl/omniluabfredl2023-03-07
|\ | | | | omnifunc for builtin lua
| * feat(lua): omnifunc for builting lua interpreterBjörn Linse2023-03-06
| | | | | | | | | | | | | | also make implicit submodules "uri" and "_inspector" work with completion this is needed for `:lua=vim.uri_<tab>` wildmenu completion to work even before uri or _inspector functions are used.
* | refactor(vim.version): cleanupJustin M. Keyes2023-03-06
| | | | | | | | | | | | | | - version.cmp(): assert valid version - add test for loading vim.version (the other tests use shared.lua in the test runner) - reduce test scopes, reword test descriptions
* | feat(lua): add semver apiKelly Lin2023-03-06
|/
* docs(lua): number → integer (#22517)Jaehwang Jung2023-03-04
|
* docs(inspect): number → integer (#22511)Jaehwang Jung2023-03-04
|
* docs(uri): number → integer (#22515)Jaehwang Jung2023-03-04
|
* feat(vim.fs): pass path to find() predicate, lazy evaluate #22378Mike2023-03-01
| | | | | | | | Problem: No easy way to find files under certain directories (ex: grab all files under `test/`) or exclude the content of certain paths (ex. `build/`, `.git/`) Solution: Pass the full `path` as an arg to the predicate.
* feat(lua): make sure require'bit' always works, even with PUC lua 5.1bfredl2023-02-22
|
* docs: naming conventions, guidelinesJustin M. Keyes2023-02-22
| | | | close #21063
* fix(treesitter): fix most diagnosticsLewis Russell2023-02-04
|
* docs(vim.fs): normalize Windows example was incorrect (#21966)C.D. MacEachern2023-01-25
|
* build: make generated source files reproducible #21586Arnout Engelen2023-01-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Build is not reproducible, because generated source files (.c/.h/) are not deterministic, mostly because Lua pairs() is unordered by design (for security). https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671 https://www.lua.org/manual/5.1/manual.html#pdf-next > The order in which the indices are enumerated is not specified [...] > >> The hardening of the VM deliberately randomizes string hashes. This in >> turn randomizes the iteration order of tables with string keys. Solution: - Update the code generation scripts to be deterministic. - That is only a partial solution: the exported function (funcs_metadata.generated.h) and ui event (ui_events_metadata.generated.h) metadata have some mpack'ed tables, which are not serialized deterministically. - As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0) that preserves table order. - Longer-term we should change the mpack'ed data structure so it no longer uses tables keyed by strings. Closes #20124 Co-Authored-By: dundargoc <gocdundar@gmail.com> Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
* docs(lua): use luaref tag instead of www.lua.org #21813Naru2023-01-15
|
* feat(lua)!: execute Lua with "nvim -l"Justin M. Keyes2023-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Nvim has Lua but the "nvim" CLI can't easily be used to execute Lua scripts, especially scripts that take arguments or produce output. Solution: - support "nvim -l [args...]" for running scripts. closes #15749 - exit without +q - remove lua2dox_filter - remove Doxyfile. This wasn't used anyway, because the doxygen config is inlined in gen_vimdoc.py (`Doxyfile` variable). - use "nvim -l" in docs-gen CI job Examples: $ nvim -l scripts/lua2dox.lua --help Lua2DoX (0.2 20130128) ... $ echo "print(vim.inspect(_G.arg))" | nvim -l - --arg1 --arg2 $ echo 'print(vim.inspect(vim.api.nvim_buf_get_text(1,0,0,-1,-1,{})))' | nvim +"put ='text'" -l - TODO? -e executes Lua code -l loads a module -i enters REPL _after running the other arguments_.
* docs(lua): adjust some type annotationsnotomo2023-01-04
|
* docs(lua): fix treesitter parsing errorsChristian Clason2023-01-01
|
* docs(lua): add `vim.json` (#21538)Christian Clason2022-12-27
|
* Merge pull request #21402 from lewis6991/feat/fs_lsLewis Russell2022-12-22
|\
| * feat(fs): add opts argument to vim.fs.dir()Lewis Russell2022-12-20
| | | | | | | | Added option depth to allow recursively searching a directory tree.
* | feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`Folke Lemaitre2022-12-17
|/
* feat(lsp): initial support for semantic token highlightingJohn Drouhard2022-12-08
| | | | | | * credit to @smolck and @theHamsta for their contributions in laying the groundwork for this feature and for their work on some of the helper utility functions and tests
* docs(lua): add guide to using Lua in Neovim (#21137)dundargoc2022-12-08
| | | | | | | | Add introductory guide explaining how to use Lua in Neovim: where to put Lua files, how to set variables and options, how to create mappings, autocommands, and user commands. Adapted with kind permission from https://github.com/nanotee/nvim-lua-guide
* docs(lua): correct vim.spell.check example (#21311)Jack Rowlingson2022-12-06
|
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* docs: add language annotation to Nvim manualChristian Clason2022-12-02
|
* feat(help): highlighted codeblocksChristian Clason2022-11-29
|
* feat(secure): add `:trust` command and vim.secure.trust() (#21107)Jlll12022-11-28
| | | | | | | | | Introduce vim.secure.trust() to programmatically manage the trust database. Use this function in a new :trust ex command which can be used as a simple frontend. Resolves: https://github.com/neovim/neovim/issues/21092 Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: ii14 <ii14@users.noreply.github.com>
* docs(lua): correct the tags for vim.opt_local and vim.opt_global (#21138)dundargoc2022-11-28
|
* docs: fix typos (#21168)dundargoc2022-11-26
|
* docs(lua): add clarifications for fs.find() and fs.normalize() (#21132)AzerAfram2022-11-24
| | | | Co-Authored-By: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-Authored-By: zeertzjq <zeertzjq@outlook.com>
* feat: add vim.secure.read()Gregory Anders2022-11-17
| | | | | | | | | This function accepts a path to a file and prompts the user if the file is trusted. If the user confirms that the file is trusted, the contents of the file are returned. The user's decision is stored in a trust database at $XDG_STATE_HOME/nvim/trust. When this function is invoked with a path that is already marked as trusted in the trust database, the user is not prompted for a response.
* fix(vim.ui.input): return empty string when inputs nothing (#20883)Jongwook Choi2022-11-08
| | | | | | | | | | | fix(vim.ui.input): return empty string when inputs nothing The previous behavior of `vim.ui.input()` when typing <CR> with no text input (with an intention of having the empty string as input) was to execute `on_confirm(nil)`, conflicting with its documentation. Inputting an empty string should now correctly execute `on_confirm('')`. This should be clearly distinguished from cancelling or aborting the input UI, in which case `on_confirm(nil)` is executed as before.
* Enable new diff option linematch (#14537)Jonathon2022-11-04
| | | Co-authored-by: Lewis Russell <me@lewisr.dev>