summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim
AgeCommit message (Collapse)AuthorFiles
2026-04-22backport: fix(ui2): ensure msg window is visible after closing tab (#39245)neovim-backports[bot]1
fix(ui2): ensure msg window is visible after closing tab Problem: After closing a tabpage while the msg window is showing a message, it is hidden while the msg window still contains a message. Solution: Unhide the msg window after entering a tabpage and it still contains a message. (cherry picked from commit 607fcfb37acd78b0e26c35acb463093957d94c45) Co-authored-by: Luuk van Baal <luukvbaal@gmail.com> Co-authored-by: Linykq <yukunlin590@gmail.com>
2026-04-22fix(:restart): avoid ERR/WRN logging on Windows with --listen (#39287)zeertzjq1
Problem: :restart leads to ERR/WRN logging on Windows with --listen. Solution: Add a log_level flag to vim._with() and use it to suppress logging from serverstart()/serverstop() during restart. (cherry picked from commit 208951cbc0ccf05b78edbaa10cfa00175e84f864)
2026-04-22fix(options): default 'titlestring' shows CWD #39233Nick Krichevsky1
Problem: In the default 'titlestring', if the containing directory is the CWD, it renders as "." Solution: Add `:p` to the titlestring. (cherry picked from commit e68e76935267afbf84bff9fffa69f963ebce0f5a)
2026-04-22fix(:restart): --listen reusage on windows #39281neovim-backports[bot]1
Problem: On Windows, :restart cannot immediately reuse the canonical --listen address because named pipe release is asynchronous. Solution: Start the new Nvim server on a temporary address; in the new Nvim, retry serverstart() with the original ("canonical") address until it succeeds. (cherry picked from commit 5891f2f3dc41eda44c0072d726cf95e54aba85ad) Co-authored-by: Sanzhar Kuandyk <92693103+SanzharKuandyk@users.noreply.github.com>
2026-04-22fix(pack): GIT_DIR/GIT_WORK_TREE env vars may interfere #39279fleesk1
Problem: With GIT_DIR/GIT_WORK_TREE set, the LSP on the vim.pack.update() confirmation buffer does not show the correct git log on hover. Solution: Temporarily remove the git vars from the environment. (cherry picked from commit e53e728c925641397bc25969457db67189a2eb75)
2026-04-21backport: refactor(test): drop deprecated exc_exec #39255Justin M. Keyes1
2026-04-20fix(ui2): don't dismiss expanded messages for non-typed key #39247luukvbaal2
Problem: Invalid check for non-typed key to dismiss expanded cmdline. Unable to delay the timer that removes a message from the msg window. Solution: Check for empty string instead of nil to determine whether a key is typed. Restart the timer if it expires while the user is in the msg window. Allow entering the msg window with a mouse click. (cherry picked from commit faa7c15b5a711435ed9d90f7fbf2a2ff8f1255c7)
2026-04-20docs: misc #39243Justin M. Keyes2
2026-04-20fix(api): expose fg_indexed/bg_indexed in nvim_get_hl (#39240)Justin M. Keyes2
Problem: fg_indexed/bg_indexed were dropped from nvim_get_hl output due to a wrong short_keys guard. HL_FG_INDEXED also wasn't cleared in hl_blend_attrs, and HLATTRS_DICT_SIZE was too small. Solution: Remove the short_keys guard, clear HL_FG_INDEXED in hl_blend_attrs, bump HLATTRS_DICT_SIZE to 24, and clarify docs that these flags mean rgb is an approximation of the cterm palette index. (cherry picked from commit 01861c2f955119cc88158273e100b3490c3df6e1) Co-authored-by: glepnir <glephunter@gmail.com>
2026-04-19backport docs: misc (#39206)Justin M. Keyes6
docs: misc (cherry picked from commit 54398c587473c0f1d96b601a281477e184865401)
2026-04-18fix(lsp): skip codelens refresh redraw for deleted buffer #39193Jaehwang Jung1
Problem: After on_refresh() sends a textDocument/codeLens request, the buffer may be deleted before the response arrives. The response callback then tries to redraw that deleted buffer and raises Invalid buffer id error. Solution: Check buffer validity before redrawing. AI-assisted: Codex Co-authored-by: Yi Ming <ofseed@foxmail.com> (cherry picked from commit 97caa88972c767122d18034f7462ed8b923b5fe0)
2026-04-18fix(lsp): show CompletionItem.detail in info popup #38904glepnir1
Problem: completionItem/resolve response's `detail` field is silently dropped. Only `documentation` is shown in the popup. Solution: Prepend `detail` as a fenced code block before `documentation` in the info popup, skipping if documentation already contains it. (cherry picked from commit b351afb1b1c564c5a4e6856764d4db21a873242c)
2026-04-18docs(events): Lua types for autocmd event-data #38518Aditya Malik2
Problem: No LuaLS types for event-data fields (ev.data). Types are only documented ad hoc in scattered locations. Solution: Add runtime/lua/vim/_meta/events.lua defining vim.event.<name>.data classes for events that provide ev.data. Reference the types from each event's help in autocmd.txt, lsp.txt, and pack.txt. (cherry picked from commit 2cb240319b61eb98abcaae08b3c0a6d98fce53ac)
2026-04-18fix(lua): make `vim._with()` work with `buf=0` and `win=0` context #39151Evgeni Chasnovski1
Problem: Using `buf=0`/`win=0` context in `vim._with` should be equivalent to using explicit buffer/window identifier respectively. Solution: Explicitly adjust context in case of `buf=0` or `win=0`. (cherry picked from commit 3a4cc5db0b8eb1d825a2a57d177853e1b4c90e28)
2026-04-18fix(vim.filetype): match() fails if g:ft_ignore_pat is not defined #39158Evgeni Chasnovski1
Problem: Calling `vim.filetype.match({ filename = '...', buf = ... })` during startup results in an error due to not yet defined `g:ft_ignore_pat`. Solution: Add a guard to check `g:ft_ignore_pat` related properties only if the variable is defined. This also allows to simplify other tests which did not depend on `g:ft_ignore_pat` but required it explicitly set to work. (cherry picked from commit 6b9b4a1377b330fca651287025c1bf5242ac9790)
2026-04-17vim-patch:8.2.2440: documentation based on patches is outdated (#39144)zeertzjq1
Problem: Documentation based on patches is outdated. Solution: Add changes to documentation in a patch. https://github.com/vim/vim/commit/853886722c051ecaef6d818ce32a822e4f43dc2b Trailing space was removed in later patches. Also fix a few more misplaced error numbers from #8155. Co-authored-by: Bram Moolenaar <Bram@vim.org> (cherry picked from commit 39410ef42ba3bd5c4db5fa3f944b5abca935d3dc)
2026-04-17docs(pack): improve "Synchronize across machines" steps #39122Evgeni Chasnovski1
Problem: Sometimes automatic lockfile synchronization after `:restart` might fail, like due to bad/absent Internet connection. This would remove failed to install entries from the lockfile (since they are not on disk and lockfile is meant to lock the latest plugin version on disk). Solution: Document that this should be treated as an unwanted update and use steps similar to "Revert plugin after an update" use case. (cherry picked from commit 42e9d8dfd1056e99713cb3f8a0155d1555cf896d)
2026-04-16fix(treesitter): TSNode:id() with NUL byte causes unreliable select() #39134altermo1
Problem: `TSNode:id()` returns the underlying c pointer as a string, which may include NUL bytes. In PUC Lua, `('%s'):format('\0a\0')` returns `''` and not `'\0a\0'` (i.e. treats the string as a c-string (which terminates at the NUL byte)). This resulted in two different nodes being able to have the same id. Solution: Use concatenation `..` instead of `string.format()`. (cherry picked from commit bb2284d75e7e2b0587610d1ae4d681d185622645)
2026-04-16fix(ui2): dialog paging is inconsistent #39128luukvbaal1
Problem: - Paging keys in the dialog window consume input when the user may not expect it. The dismissable title hint intended to mitigate that results in having to press Escape twice to abandon the prompt. - Mimicked "msgsep" float border is taking up unnecessary space when window takes up the entire screen. Solution: - Use (conventional, albeit less convenient) keys intended for scrolling to page the dialog window: <(Mousewheel/Page)Up/Down>, <Home/End>. - Only set the float top border when separation is actually necessary, i.e. window does not reach the first row. (cherry picked from commit f0a8e6f3377c5393859c85cd44c1d2c57e8fe2d2)
2026-04-16backport test: lint naming conventions (#39124)Justin M. Keyes3
test: lint naming conventions Problem: Naming conventions are not automatically checked. Solution: Add a check to the doc generator. Eventually we should extract this somehow, but that will require refactoring the doc generator... Note: this also checks non-public functions, basically anything that passes through `gen_eval_files.lua` and `gen_vimdoc.lua`. And that's a good thing.
2026-04-16refactor(lsp): fix typing for LSP methods #39099Luis Calle1
Problem Some variables use the wrong type (ClientToServer instead of ServerToClient) and some use vaguer types that could be more strict. Solution Use the correct types. (cherry picked from commit 530cfa1323cea6b392b1b4c8e643f324b166f89e)
2026-04-15backport: refactor: update usages of deprecated "buffer" param #39090Justin M. Keyes4
2026-04-15Merge #39088 test: replace busted with local harnessJustin M. Keyes1
2026-04-15refactor(api): rename "window" to "win" (positional parameters) #39083Justin M. Keyes2
continues d0af4cd9094f. This commit renames positional parameters. This is only "cosmetic", but is intended to make it extra clear which name is preferred, since people often copy existing code despite the guidelines in `:help dev-naming`. (cherry picked from commit 71ac4db335e00b03b27d2c4aa5ab90c083a3a3e7)
2026-04-15test: replace busted with local harnessLewis Russell1
Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex (cherry picked from commit 55f9c2136e52d8719495b6021ce7e8d64c5141fe)
2026-04-15fix(lua): make vim.deep_equal cycle-safeLewis Russell1
AI-assisted: Codex (cherry picked from commit e289f9579c73b4f6da105dfad87bd90e0dc6d973)
2026-04-15refactor(api): rename buffer to buf (positional parameters) #39013Justin M. Keyes1
In 3a4a66017b74, 4d3a67cd6201, df8d98173cbc we renamed "buffer" to "buf" in dict parameters and return-values. This commit renames positional parameters. This is only "cosmetic", but is intended to make it extra clear which name is preferred, since people often copy existing code despite the guidelines in `:help dev-naming`. (cherry picked from commit d0af4cd9094f3439382622906da5b1c5cd82c294)
2026-04-14docs: lsp, options, apiJustin M. Keyes7
- revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b74 Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-14fix(lua): not obvious which _meta/ files are generated #39035Justin M. Keyes17
Problem: - Not obvious which _meta/ are generated and which should be edited manually. - The require guard (`error('Cannot require a meta file')`) is not consistently present in all meta files. Solution: - Update headers. - Add require() guard to all meta files. - Rename generated meta files with `.gen.lua`. (cherry picked from commit 65b40e69acbcb28c0e7ef9228f731c444a788e93)
2026-04-14refactor(options): generate "modeline disallowed" doc text (#39034)neovim-backports[bot]1
Problem: - Lots of redundant text in options docs for "not allowed in a modeline", even though we already have a flag that indicates that. - `deny_in_modelines` is an old vestigial flag only used by 'encoding' (which never changes). Solution: - Generate docs based on the `secure` flag. - Remove the `deny_in_modelines` flag (`kOptFlagNoML`). (cherry picked from commit 829e9ec65e37588ee1b8329a42b2c31b33b599bf) Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-13backport: feat(api): rename buffer to buf in retval #39015Justin M. Keyes1
In 3a4a66017b74192caaf9af9af172bdc08e0c1608, 4d3a67cd620152d11ab9b5f5bdd973f84cc2d44b we renamed "buffer" to "buf" in dict parameters. This commit also renames such keys in dict return-values.
2026-04-12revert: "fix(lsp): only resolve LSP configs once" #38990Justin M. Keyes1
revert eb90f5d9e3a6615870f9bf0b28e30f6e84ccd6f4 (cherry picked from commit 4eb95c8ed23864d101ee23a41ce52e27b7b4393e)
2026-04-12fix(lsp): show_document can't position cursor past EOL in insert-mode #38566Lars Debor1
Problem: vim.lsp.util.show_document insert mode is unable to set the cursor after the target character position if the target character is at end of line. Solution: Move cursor after the target character (in append position) in this case. (cherry picked from commit 891bb0e6ce513dc885cebe995918e5db4e69174a)
2026-04-12fix(lsp): send didOpen on save to all clients+groups #37454Emilv22
Problem: _get_and_set_name edits the name for the whole group, thus only one client per group gets the didOpen message. Solution: move the logic to _changetracking and loop over every client per group. (cherry picked from commit 37eb1b99792c81c5f437e6d5a2fbb8dfba7c1472)
2026-04-12docs: miscJustin M. Keyes2
2026-04-12docs: vim.posJustin M. Keyes2
2026-04-12fix(api): nvim_get_hl drops groups defined with link_global #38492glepnir2
Problem: hlgroup2dict passes &ns_id to ns_get_hl twice. The first call (link=true) sets *ns_hl = 0 when link_global is set, so the second call and the sg_cleared guard both see ns_id == 0 and bail out. The group is silently dropped from the result. Solution: use a temporary copy of ns_id for each ns_get_hl call so the original value is preserved. (cherry picked from commit 49086862fc521c29dd8fb7c96cc23a267f1bf397)
2026-04-12fix(normal): pass count to 'keywordprg' as arg1 #38965Barrett Ruth1
Problem: If `'keywordprg'` begins with `:`, `3K` turns the count into an Ex range. Commands that don't support that then fail. Vim passes the count as the first arg (see #19436, vim/vim#10745). Solution: Pass `[count]` as the first arg for `'keywordprg'`. (cherry picked from commit 6e95d1ad138cb25e04ef98c95f93d1a7af8c1f49)
2026-04-11fix(pack): make 'stash' call compatible with older Git #38679skewb1k1
Problem: On Git versions 2.13..2.26 there is a bug that prevents using `stash --message`. Solution: Use the full `stash push --message` form to avoid that bug. (cherry picked from commit 38aec2d3cdd317231e6e89ef5a9a51ebdda757b7)
2026-04-11fix(lsp): check stale context in hover/signature callback #38724glepnir1
Problem: hover/signature callback lacked consistency checks, so slow LSP servers could open a float after the cursor had already moved away. Solution: guard the callback with buf validity, buf version, and cursor position checks before opening the float. Also fix table capacity calculation. (cherry picked from commit af9a72d8c105129bb107ee0bc9a38ade44caf7b6)
2026-04-10fix(pack): more advice for out-of-sync lockfile #38931Evgeni Chasnovski1
Problem: If the lockfile points to the revision that is not on disk, the `:checkhealth vim.pack` suggests to run `vim.pack.update()`. Although usually it should resolve the problem, it is not always the case: like if the state on disk is already the latest available. Solution: Add an extra suggestion with a more drastic measure by manually removing `rev` field from the lockfile for it to be repaired after the `:restart`. (cherry picked from commit 94c0e54e5b93049274031a0bc59c831ad40db201)
2026-04-09fix(vim.pos): Range:intersect() drops `buf` #38898Luis Calle1
new() only supports nargs=5 or nargs=2, but this was passing 4 args. (cherry picked from commit 24811c0a1410703d78e77c6a3233ff85f87964ef)
2026-04-09fix(messages): truncate warning messages only in display (#38901)zeertzjq3
For now, add a private "_truncate" flag to nvim_echo, using a truncation method similar to showmode(). (cherry picked from commit 9c5fba5df0b60cd25ac2c180a7d82fca47a105e6)
2026-04-09backport: feat(api): rename buffer to buf (#38899)Justin M. Keyes18
feat(api): rename buffer to buf Problem: `:help dev-name-common` states that "buf" should be used instead of "buffer" but there are cases where buffer is mentioned in the lua API. Solution: - Rename occurrences of "buffer" to "buf" for consistency with the documentation. - Support (but deprecate) "buffer" for backwards compatibility. Co-authored-by: Jordan <46637683+JordanllHarper@users.noreply.github.com>
2026-04-08docs(api): nvim_exec_autocmds() default "pattern"Sean Dewar1
Problem: nvim_exec_autocmds() documentation incorrectly describes the default for "pattern" as *, when it's actually the current file name (like :doautocmd). Solution: correct it. Add a test.
2026-04-08Merge pull request #38894 backportsJustin M. Keyes3
2026-04-08fix(lsp): apply_text_edits causes unwanted BufDelete events #38778glepnir1
Problem: Since 2f6d1d3c887a87d9402137425b418dd12a904aac, `apply_text_edits` unconditionally sets `buflisted=true`, causing spurious BufDelete events if plugins restore the original 'buflisted' state on unlisted buffers: https://github.com/neovim/neovim/blob/65ef6cec1cb766334c59d3255595dfe523b11020/src/nvim/option.c#L2159-L2169 Solution: - Don't set 'buflisted' in `apply_text_edits`. Set it more narrowly, in `apply_workspace_edit` where the semantics requires affected buffers to be visible to the user. - Also skip setting 'buflisted' if it would not be changed, to avoid redundant `OptionSet` events. (cherry picked from commit 6473d007e7b9f7f14b06190117f0bb0269fa938c)
2026-04-08refactor(filetype): move _get_known_filetypes, return a Set #38886Justin M. Keyes2
- `_get_known_filetypes` may be useful for other internal code, so move it to an internal function. - Use a set instead of a list, for performance.
2026-04-08feat(vim.version): add __eq to vim.VersionRange #38881ngicks1
Problem: vim.VersionRange had no __eq metamethod, so comparing 2 distinct but same value instances always returned false. In vim.pack.add this caused redundant lockfile rewrites, even when the resulting lockfile content was unchanged. Solution: Add __eq metamethod on vim.VersionRange
2026-04-08fix(lsp): check filetype registry in health (#38885)neovim-backports[bot]1
fix(health): misleading warnings re filetypes registered w/ vim.filetype.add() #38867 Problem: `:checkhealth vim.lsp` validates configured filetypes against `getcompletion('', 'filetype')`. This only reflects runtime support files. This causes false warnings in `:checkhealth vim.lsp` for configured filetypes that are known to the Lua filetype registry, including values added with `vim.filetype.add()` and built-in registry-only filetypes. Solution: Build the healthcheck's known-filetype set from both `getcompletion('', 'filetype')` and `vim.filetype.inspect()`. (cherry picked from commit 20a3254ad42dfb08faad275c1c79764de8e24c69) Co-authored-by: Barrett Ruth <62671086+barrettruth@users.noreply.github.com>