aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
Commit message (Collapse)AuthorAge
...
* docs(lua): clarify fs.find() documentation #24394futsuuu2023-07-19
|
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* refactor(lua2dox): overhaul (#24386)Lewis Russell2023-07-18
|
* fix: doc errorsLewis Russell2023-07-17
|
* docs(lua): change *lua-foo* -> *vim.foo*Lewis Russell2023-07-17
|
* docs(lua): move function docs to lua filesLewis Russell2023-07-17
|
* docs: handle whitespace in emmycommentsLewis Russell2023-07-17
|
* docs(lua): do not render self argsLewis Russell2023-07-17
|
* docs(lua): adds links to related keymap functions to keymap.set (#24337)Mathias Fußenegger2023-07-13
| | | Might help with discovery, given that there is no `keymap.get()`
* fix(lint): lint warnings #24226Raphael2023-07-10
|
* docs: gather @notes items into one sectionJustin M. Keyes2023-07-08
| | | | related: 21eacbfef399
* docs: "Return (multiple)" headingJustin M. Keyes2023-07-08
| | | | | | | | | | | Problem: Lua functions that return multiple results are declared by using multiple `@return` docstring directives. But the generated docs don't make it obvious what this represents. Solution: - Generate a "Return (multiple)" heading for multiple-value functions. - Fix `@note` directives randomly placed after `@return`.
* docs: MAINTAIN.md, nvim_get_markJustin M. Keyes2023-07-08
|
* feat(lua): allow vim.wo to be double indexed (#20288)Lewis Russell2023-07-07
| | | | | | | | * feat(lua): allow vim.wo to be double indexed Problem: `vim.wo` does not implement `setlocal` Solution: Allow `vim.wo` to be double indexed Co-authored-by: Christian Clason <c.clason@uni-graz.at>
* refactor(defaults): use vim.region for visual star (*,#)Justin M. Keyes2023-07-06
| | | | | | | | | | | | | Problem: The parent commit added a new vim.get_visual_selection() function to improve visual star. But that is redundant with vim.region(). Any current limitations of vim.region() should be fixed instead of adding a new function. Solution: Delete vim.get_visual_selection(). Use vim.region() to get the visual selection. TODO: fails with visual "block" selections.
* fix(defaults): visual mode star (*,#) is fragileSteven Ward2023-07-06
| | | | | | | | | | | | Problem: Visual mode "*", "#" mappings don't work on text with "/", "\", "?", and newlines. Solution: Get the visual selection and escape it as a search pattern. Add functions vim.get_visual_selection and _search_for_visual_selection. Fix #21676
* fix(vim.ui.open): return (don't show) error messageJustin M. Keyes2023-07-05
| | | | | | | | | | Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
* fix(gx): visual selection, expand env varsJustin M. Keyes2023-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- Rejected experiment: move vim.ui.open() to vim.env.open() Problem: `vim.ui` is where user-interface "providers" live, which can be overridden. It would also be useful to have a "providers" namespace for platform-specific features such as "open", clipboard, python, and the other providers listed in `:help providers`. We could overload `vim.ui` to serve that purpose as the single "providers" namespace, but `vim.ui.nodejs()` for example seems awkward. Solution: `vim.env` currently has too narrow of a purpose. Overload it to also be a namespace for `vim.env.open`. diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 913f1fe20348..17d05ff37595 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -37,8 +37,28 @@ local options_info = setmetatable({}, { end, }) -vim.env = setmetatable({}, { - __index = function(_, k) +vim.env = setmetatable({ + open = setmetatable({}, { + __call = function(_, uri) + print('xxxxx'..uri) + return true + end, + __tostring = function() + local v = vim.fn.getenv('open') + if v == vim.NIL then + return nil + end + return v + end, + }) + }, + { + __index = function(t, k, ...) + if k == 'open' then + error() + -- vim.print({...}) + -- return rawget(t, k) + end local v = vim.fn.getenv(k) if v == vim.NIL then return nil
* feat(vim.ui): vim.ui.open, "gx" without netrwmarshmallow2023-07-04
| | | | | | Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
* fix(docs): ignore_invalid #24174Justin M. Keyes2023-06-27
| | | Regex bug in scripts/gen_help_html.lua:ignore_invalid()
* docs: autocmds, miscJustin M. Keyes2023-06-25
|
* test: spellcheck :help (vimdoc) files #24109Justin M. Keyes2023-06-22
| | | | | | | Enforce consistent terminology (defined in `gen_help_html.lua:spell_dict`) for common misspellings. This does not spellcheck English in general (perhaps a future TODO, though it may be noisy).
* fix(vim.json)!: remove global options, "null", "array_mt" #24070Justin M. Keyes2023-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: - `vim.json` exposes various global options which: - affect all Nvim Lua plugins (especially the LSP client) - are undocumented and untested - can cause confusing problems such as: https://github.com/codota/tabnine-nvim/commit/cc76ae3abe2f129d44b5a8edee2529e0ee0dcf69 - `vim.json` exposes redundant mechanisms: - `vim.json.null` is redundant with `vim.NIL`. - `array_mt` is redundant because Nvim uses a metatable (`vim.empty_dict()`) for empty dict instead, which `vim.json` is configured to use by default (see `as_empty_dict`). Example: ``` :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}')) --> { bar = {}, foo = vim.empty_dict() } ``` Thus we don't need to also decorate empty arrays with `array_mt`. Solution: Remove the functions from the public vim.json interface. Comment-out the implementation code to minimize drift from upstream. TODO: - Expose the options as arguments to `vim.json.new()`
* docs #24061Justin M. Keyes2023-06-19
| | | | | | | | | | | | | | - nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932 - NVIM_APPNAME: UIs normally should NOT set this. ref #23520 fix #24050 fix #23660 fix #23353 fix #23337 fix #22213 fix #19161 fix #18088 fix #20693
* docs #22363Justin M. Keyes2023-06-19
| | | | | | | | | Co-authored by: zeertzjq <zeertzjq@outlook.com> Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com> Co-authored by: nobe4 <nobe4@users.noreply.github.com> - docs: mention --luadev-mod to run with lua runtime files When changing a lua file in the ./runtime folder, a new contributor might expect changes to be applied to the built Neovim binary.
* docs: various clarifications (#23999)zeertzjq2023-06-12
| | | | | Close #18907 Close #20314 Close #23749
* docs: fix vim.tbl_get type annotations #23992Stanislav Asunkin2023-06-11
|
* feat(lua): use callable table as iterator in vim.iter (#23957)Mathias Fußenegger2023-06-10
| | | | A table passed to `vim.iter` can be a class instance with a `__call` implementation for the iterator protocol.
* docs: fix typos (#23917)Jonas Strittmatter2023-06-10
|
* feat(lua): add ringbuffer (#22894)Mathias Fußenegger2023-06-08
| | | https://en.wikipedia.org/wiki/Circular_buffer
* feat(lua): add `vim.system()`Lewis Russell2023-06-07
| | | | | | | | | | | | | | | feat(lua): add vim.system() Problem: Handling system commands in Lua is tedious and error-prone: - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval. - vim.loop.spawn is too low level Solution: Add vim.system(). Partly inspired by Python's subprocess module Does not expose any libuv objects.
* fix: version-range < and <= #23539Gianmaria Bajo2023-06-06
| | | | | | | | | vim.version.range() couldn't parse them correctly. For example, vim.version.range('<0.9.0'):has('0.9.0') returned `true`. fix: range:has() accepts vim.version() So that it's possible to compare a range with: vim.version.range(spec):has(vim.version())
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* docs: small fixes (#23619)dundargoc2023-06-02
| | | | | | Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: Gustavo Ferreira <gustavo.ferreira@imaginecurve.com> Co-authored-by: Kai Moschcau <mail@kmoschcau.de> Co-authored-by: Lampros <hauahx@gmail.com>
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* feat(fs): expose join_paths as `vim.fs.joinpath` (#23685)Christian Clason2023-05-20
| | | This is a small function but used a lot in some plugins.
* docs: small fixesdundargoc2023-05-13
| | | | | | | | | Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: HiPhish <hiphish@posteo.de> Co-authored-by: Julio B <julio.bacel@gmail.com> Co-authored-by: T727 <74924917+T-727@users.noreply.github.com> Co-authored-by: camoz <camoz@users.noreply.github.com> Co-authored-by: champignoom <66909116+champignoom@users.noreply.github.com>
* feat(lua): add hl priority opts on yank (#23509)marcoSven2023-05-06
| | | | | feat(lua): add hl priority opts on_yank Signed-off-by: marcoSven <me@marcosven.com>
* Merge pull request #23382 from gpanders/iter-benchmarkGregory Anders2023-04-29
|\ | | | | Add vim.iter benchmark to benchmark test suite
| * perf(iter): reduce number of table allocationsGregory Anders2023-04-28
| | | | | | | | | | | | | | | | Packing and unpacking return values impairs performance considerably. In an attempt to avoid creating tables as much as possible we can instead pass return values between functions (which does not require knowing the number of values a function might return). This makes the code more complex, but improves benchmark numbers non-trivially.
* | vim-patch:8.2.0578: heredoc for interfaces does not support "trim"zeertzjq2023-04-29
|/ | | | | | | | Problem: Heredoc for interfaces does not support "trim". Solution: Update the script heredoc support to be same as the :let command. (Yegappan Lakshmanan, closes vim/vim#5916) https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55
* refactor(build): include lpeg as a librarybfredl2023-04-27
|
* Merge pull request #23303 from gpanders/more-vim-iterGregory Anders2023-04-25
|\ | | | | Create iter_spec and vim.iter module
| * refactor(iter): move helper functions under vim.iterGregory Anders2023-04-25
| | | | | | | | vim.iter is now both a function and a module (similar to vim.version).
* | feat(lua): vim.keycode (#22960)ii142023-04-25
|/ | | | | | Using nvim_replace_termcodes is too verbose, add vim.keycode for translating keycodes. Co-authored-by: ii14 <ii14@users.noreply.github.com>
* fix(iter): remove special case totable for map-like tablesGregory Anders2023-04-19
| | | | | | | | | | | | | | | | | | | | | | | This was originally meant as a convenience but prevents possible functionality. For example: -- Get the keys of the table with even values local t = { a = 1, b = 2, c = 3, d = 4 } vim.iter(t):map(function(k, v) if v % 2 == 0 then return k end end):totable() The example above would not work, because the map() function returns only a single value, and cannot be converted back into a table (there are many such examples like this). Instead, to convert an iterator into a map-like table, users can use fold(): vim.iter(t):fold({}, function(t, k, v) t[k] = v return t end)
* feat(lua): add vim.iter (#23029)Gregory Anders2023-04-17
| | | | | vim.iter wraps a table or iterator function into an `Iter` object with methods such as `filter`, `map`, and `fold` which can be chained to produce iterator pipelines that do not create new tables at each step.
* feat(lua)!: add stricter vim.tbl_islist() and rename old one to ↵NAKAI Tsuyoshi2023-04-14
| | | | | | | | | | | | vim.tbl_isarray() (#16440) feat(lua)!: add stricter vim.tbl_islist(), rename vim.tbl_isarray() Problem: `vim.tbl_islist` allows gaps in tables with integer keys ("arrays"). Solution: Rename `vim.tbl_islist` to `vim.tbl_isarray`, add new `vim.tbl.islist` that checks for consecutive integer keys that start from 1.
* feat(lua): vim.tbl_contains supports general tables and predicates (#23040)Christian Clason2023-04-14
| | | | | | | | | | | | * feat(lua): vim.tbl_contains supports general tables and predicates Problem: `vim.tbl_contains` only works for list-like tables (integer keys without gaps) and primitive values (in particular, not for nested tables). Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new `vim.tbl_contains` that works for general tables and optionally allows `value` to be a predicate function that is checked for every key.
* feat(lua): vim.region accepts getpos() arg (#22635)NAKAI Tsuyoshi2023-04-11
|