Commit Graph

35824 Commits

Author SHA1 Message Date
altermo
bc00aec21c test(treesitter): skip unreliable select test #38391
The test sometimes(around 1/30) fails on PUC-lua.
2026-03-20 17:42:27 -04:00
Evgeni Chasnovski
3d37aa3116 fix(pack): account for Git's "insteadOf" in :checkhealth #38393
Problem: It is possible (and documented in `:h vim.pack`) that plugin's
  `src` uses "insteadOf" Git config. In that case comparing it directly
  to repo's `origin` will error.

Solution: Add extra check that lockfile's `src` is not equal to repo's
  `origin` when taking Git's "insteadOf" into account.

  However, still report the original lockfile's `src` in the
  `:checkhealth` output, as it seems to be a clearer indication of what
  actually is wrong.
2026-03-20 17:40:45 -04:00
Evgeni Chasnovski
9595f07425 feat(ux): sexy intro #38378
Problem: Intro is not sexy.

Solution: Make it sexy.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-20 16:56:00 -04:00
Maria Solano
9986360065 docs: add comment on how [...]() behaves (#38389)
docs: add comment on how `[]()` behaves
2026-03-20 09:55:47 -07:00
Mathias Fussenegger
507cd63418 fix(lsp): handle completion/resolve response arriving after on_insert_leave
If a user accepts completion and immediately exits insert mode, it
could happen that `Context.cursor` was nil by the time the
`completion/resolve` response arrives, leading to an error.
2026-03-20 17:20:08 +01:00
Shadman
24684f90ea feat(progress): status api, 'statusline' integration #35428
Problem:
Default statusline doesn't show progress status.

Solution:
- Provide `vim.ui.progress_status()`.
- Include it in the default 'statusline'.

How it works:
Status text summarizes "running" progress messages.
 - If none: returns empty string
 - If one running item: "title:  percent%"
 - If multiple running items: "Progress: N items avg-percent%"
2026-03-20 07:18:20 -04:00
Justin M. Keyes
f9b2189b28 Merge #38047 _provider_foreach 2026-03-20 05:11:27 -04:00
Yochem van Rosmalen
72a63346d8 feat(stdlib): vim.fs.ext() returns file extension #36997
Problem:
Checking the extension of a file is done often, e.g. in Nvim's codebase
for differentiating Lua and Vimscript files in the runtime. The current
way to do this in Lua is (1) a Lua pattern match, which has pitfalls
such as not considering filenames starting with a dot, or (2)
fnamemodify() which is both hard to discover and hard to use / read if
not very familiar with the possible modifiers.

vim.fs.ext() returns the file extension including the leading dot of
the extension. Similar to the "file extension" implementation of many
other stdlibs (including fnamemodify(file, ":e")), a leading dot
doesn't indicate the start of the extension. E.g.: the .git folder in a
repository doesn't have the extension .git, but it simply has no
extension, similar to a folder named git or any other filename without
dot(s).
2026-03-20 05:08:00 -04:00
zeertzjq
1244fe157f vim-patch:ecf90b9: CI: make dependabot monitor .github/actions directory (#38383)
and also set `cooldown`, `groups`

related: vim/vim#19747
closes:  vim/vim#19756

ecf90b92f1

Co-authored-by: ichizok <gclient.gaap@gmail.com>
2026-03-20 17:02:21 +08:00
Yi Ming
29c6176f08 fix(lsp): unify LSP error logging prefixes #38354
Problem
The format of LSP log messages is inconsistent; some include underscores, while others are not logged at all.

Solution
Standardize log recording and unify the log message prefixes with the module names.
2026-03-20 04:51:36 -04:00
Tristan Knight
a8ffa6e323 fix(lsp): guard dynamic capability attachment #38382
Problem:
The capability attach path for client/registerCapability can initialize a capability even when the capability was only registered in specific buffers

Solution:
Check supports_method() before attaching capabilities from the dynamic registration handler so unsupported registrations are ignored.

AI-assisted: OpenCode
2026-03-20 04:48:19 -04:00
glepnir
24714c0d43 refactor(test): clean up pumborder round test cases #38368
Problem: pumborder round tests contained redundant.

Solution: Remove unnecessary test code.
2026-03-20 04:46:57 -04:00
zeertzjq
238d4fa71a fix(terminal): possible missing refresh with buffer updates (#38388)
Problem:
Terminal refresh may be missed if buffer update callbacks poll for uv
events. Example test failure on FreeBSD:

FAILED   test/functional/terminal/buffer_spec.lua @ 1049: :terminal buffer scrollback is correct if buffer update callbacks poll for uv events
test/functional/terminal/buffer_spec.lua:1004: Row 1 did not match.
Expected:
  |*19995: TEST{MATCH: +}|
  |*19996: TEST{MATCH: +}|
  |*19997: TEST{MATCH: +}|
  |*19998: TEST{MATCH: +}|
  |*19999: TEST{MATCH: +}|
  |^[Process exited 0]                                |
  |{5:-- TERMINAL --}                                    |
Actual:
  |*19696: TEST                                       |
  |*19697: TEST                                       |
  |*19698: TEST                                       |
  |*19699: TEST                                       |
  |*19700: TEST                                       |
  |^[Process exited 0]                                |
  |{5:-- TERMINAL --}                                    |

Solution:
Call changed_lines() after resetting invalid region in refresh_screen().
Handle terminal being invalidated in the middle of refresh_timer_cb().
2026-03-20 12:05:19 +08:00
zeertzjq
d36e7787c1 vim-patch:9.2.0209: freeze during wildmenu completion (#38386)
Problem:  Vim may freeze if setcmdline() is called while the wildmenu or
          cmdline popup menu is active (rendcrx)
Solution: Cleanup completion state if cmdbuff_replaced flag has been set
          (Yasuhiro Matsumoto)

fixes:  vim/vim#19742
closes: vim/vim#19744

332dd22ed4

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-03-20 08:44:01 +08:00
zeertzjq
f577e05522 vim-patch:9.2.0202: [security]: command injection via newline in glob() (#38385)
Problem:  The glob() function on Unix-like systems does not escape
          newline characters when expanding wildcards. A maliciously
          crafted string containing '\n' can be used as a command
          separator to execute arbitrary shell commands via
          mch_expand_wildcards(). This depends on the user's 'shell'
          setting.
Solution: Add the newline character ('\n') to the SHELL_SPECIAL
          definition to ensure it is properly escaped before being
          passed to the shell (pyllyukko).

closes: vim/vim#19746

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-w5jw-f54h-x46c

645ed6597d

Co-authored-by: pyllyukko <pyllyukko@maimed.org>
2026-03-20 08:19:52 +08:00
zeertzjq
a18d51a958 vim-patch:9.2.0204: filetype: cps files are not recognized
Problem:  filetype: cps files are not recognized
Solution: Detect *.cps files as json filetype (Guillaume Barbier).

Reference:
https://github.com/cps-org/cps
https://cps-org.github.io/cps/

closes: vim/vim#19758

53884ba7a8

Co-authored-by: Guillaume Barbier <barbier.guillaume60@gmail.com>
2026-03-20 08:17:18 +08:00
zeertzjq
e2c3106b85 vim-patch:9.2.0201: filetype: Wireguard config files not recognized
Problem:  filetype: Wireguard config files not recognized
Solution: Detect /etc/wireguard/*.conf files as dosini filetype
          (Furkan Sahin).

closes: vim/vim#19751

cc8798e719

Co-authored-by: Furkan Sahin <furkan-dev@proton.me>
2026-03-20 08:17:18 +08:00
tris203
1f558f8d09 fix(lsp): improve diagnostics handling and comments
- Add TODO comments for aggregating diagnostics from all pull namespaces
  and for clearing diagnostics when an empty array is received, referencing
  the LSP specification.
- Update diagnostics refresh logic to safely access previousResultId,
  preventing potential nil errors.
2026-03-19 20:02:26 +00:00
tris203
0cda018345 fix(lsp/diagnostic): key resultId by client and identifier
Previously, resultId for diagnostics was keyed only by client_id, which
could cause issues when multiple identifiers are used by the same client.
This change introduces a composite key of client_id and identifier for
client_result_id, ensuring correct tracking of diagnostic results per
identifier. Updates all relevant logic to use the new keying scheme.
2026-03-19 17:51:21 +00:00
tris203
95dce376f3 fix(lsp): handle providers without subcapabilities
Previously, the LSP client assumed all providers had subcapabilities,
which could cause issues when a provider did not. This change adds a
check for the presence of subcapabilities before attempting to access
them, ensuring correct handling of both cases. This improves
compatibility with servers that register providers without additional
capabilities.
2026-03-19 17:51:21 +00:00
tris203
6a49a277f5 fix(lsp): request diagnostics from all registrations
Update diagnostic refresh to request diagnostics from all provider
registrations using _provider_foreach. This ensures diagnostics are
fetched from every registered provider during a refresh.

Co-authored-by: ZieMcd <ziemcd@gmail.com>
2026-03-19 17:51:21 +00:00
tris203
c8d9ade16a refactor(lsp): replace _provider_value_get with _provider_foreach
Introduce _provider_foreach to iterate over all matching provider
capabilities for a given LSP method, handling both static and dynamic
registrations. Update diagnostic logic and tests to use the new
iteration approach, simplifying capability access and improving
consistency across features.
2026-03-19 17:51:21 +00:00
Yi Ming
06befe1e34 feat(defaults): map "grx" to vim.lsp.codelens.run() #37689
Problem
Unlike inlay hints, code lenses are closely related to running commands;
a significant number of code lenses are used to execute a command (such
as running tests). Therefore, it is necessary to provide a default
mapping for them.

Solution
Add a new default mapping "grx" (mnemonic: "eXecute", like "gx").
2026-03-19 13:47:52 -04:00
skewb1k
e7684fb642 docs: example_init #38372
* docs(example_init): consistently use `:h`

* docs(example_init): align PLUGINS section with the overall style

Since this entire file is example, all sections use declarative voice,
avoiding "For example".
Replaces summary list with related help tags.

* docs(example_init): adjust mini.completion URI

See https://github.com/nvim-mini/mini.nvim/discussions/1970

* docs(example_init): misc grammar fix
2026-03-19 13:22:32 -04:00
glepnir
531442ddd8 fix(ui): apply 'pumborder' to mouse menu, fix overflow #36193
Problem:
Mouse popup menus (right-click context menus) do not respect the
'pumborder' option and could overflow screen boundaries when borders
were enabled near the edge.

Solution:
- Remove the mouse menu exclusion from border rendering.
- Add boundary check to shift menu left when border would exceed screen
  width, ensuring complete visibility of menu content and borders.
2026-03-19 13:11:35 -04:00
mpal9000
4b0700c618 fix(lsp): vim.Range check in document_color.color_presentation() (#38374)
Problem:
`vim.lsp.document_color.color_presentation()` throws, due to incorrect use of the `vim.Range` API.

Solution:
Change `vim.Range.has(a, b)` call to `a:has(b)`.
2026-03-19 10:00:45 -07:00
Justin M. Keyes
b927ee2c48 Merge #38376 fix(ui2): move windows to current tabpage 2026-03-19 12:57:30 -04:00
Luuk van Baal
e58a842749 fix(ui2): wrong condition used to detect active pager
Problem:  Entering the pager is scheduled to avoid errors while in the
          cmdwin. Meanwhile the current window is used as a condition to
          detect an active pager.
Solution: Keep track of when the user is in the pager (or entered the
          cmdwin while the pager was open).
2026-03-19 16:38:57 +01:00
Luuk van Baal
dff3028fe7 fix(ui2): move windows to current tabpage
Problem:  Windows are closed and re-opened after changing tabpage (and
          might be removed from the current tabpage after 094b297a).
Solution: Ensure windows are on the current tabpage by moving them.
2026-03-19 16:38:44 +01:00
Olivia Kinnear
e406c4efd6 feat(lsp): vim.lsp.get_configs() #37237
Problem:
No way to iterate configs. Users need to reach
for `vim.lsp.config._configs`, an internal interface.

Solution:
Provide vim.lsp.get_configs().
Also indirectly improves :lsp enable/disable completion
by discarding invalid configs from completion.
2026-03-19 07:33:34 -04:00
zeertzjq
4c48f19e51 vim-patch:partial:9.2.0193: using copy_option_part() can be improved (#38369)
Problem:  using copy_option_part() can be improved
Solution: Refactor and use the return value of copy_option_part() to
          avoid strlen() calls (John Marriott).

In addition, this commit includes the following changes:

memline.c:
- In recover_names():
  - Replace calls to vim_strsave() with vim_strnsave() for the literal
    strings
  - Use a string_T to store local variable dir_name.

bufwrite.c:
- In buf_write()
  - move variable wp to where it is used.

help.c:
- In fix_help_buffer():
  - replace call to add_pathsep() with after_pathsep()

optionstr.c:
- In export_myvimdir():
  - use a string_T to store local variable buf
  - replace call to add_pathsep() with after_pathsep()

scriptfile.c:
- In do_in_path():
  - use a string_T to store local variable buf
  - measure the lengths of prefix and name once before the while loop
  - replace call to add_pathsep() with after_pathsep()
  - move some variables closer to where they are used

spellfile.c:
- In init_spellfile():
  - use a string_T to store local variable buf

closes: vim/vim#19725

a74e5fc5b9

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-03-19 10:31:11 +00:00
zeertzjq
7d6b6b2d14 fix(terminal): don't poll for output during scrollback refresh (#38365)
Problem:
If buffer update callbacks poll for uv events during terminal scrollback
refresh, new output from PTY process may lead to incorrect scrollback.

Solution:
Don't poll for output to the same terminal as the one being refreshed.
2026-03-19 18:16:57 +08:00
zeertzjq
08c64bb036 vim-patch:faad250: runtime(doc): Fix typo in if_pyth.txt (#38362)
closes: vim/vim#19733

faad250544

Co-authored-by: Barrett Ruth <br.barrettruth@gmail.com>
2026-03-19 11:10:54 +08:00
zeertzjq
e1c4e5523f vim-patch:39ee7d1: runtime(yara): add ftplugin for yara filetype (#38361)
Add a minimal ftplugin `runtime/ftplugin/yara.vim` that sets:
- `commentstring` for YARA line comments (`//`)
- `comments` for YARA block comment (`/* */`)
- `formatoptions` to wrap comment lines and continue comment after newlines
This was heavily inspired from `runtime/ftplugin/c.vim`

closes: vim/vim#19736

39ee7d17b9

Co-authored-by: Thomas Dupuy <thom4s.d@gmail.com>
2026-03-19 11:10:39 +08:00
zeertzjq
875958c9a1 fix(terminal): don't refresh for sync flush when exiting (#38363)
Fixes the following error log:

    ERR 2026-03-18T20:17:36.920 T281.9357.0 buf_updates_send_changes:258: Disabling buffer updates for dead channel 1
2026-03-19 02:53:52 +00:00
Justin M. Keyes
1b2b715389 fix(messages): disallow user-defined integer message-id #38359
Problem:
`nvim_echo(…, {id=…})` accepts user-defined id as a string or integer.
Generated ids are always higher than last highest msg-id used. Thus
plugins may accidentally advance the integer id "address space", which,
at minimum, could lead to confusion when troubleshooting, or in the
worst case, could overflow or "exhaust" the id address space.

There's no use-case for it, and it could be the mildly confusing, so we
should just disallow it.

Solution:
Disallow *integer* user-defined message-id.
Only allow *string* user-defined message-id.
2026-03-18 21:07:17 -04:00
Maria Solano
4430c9a424 feat(lsp): migrate document_color to capability framework (#38344)
* feat(lsp): migrate `document_color` to capability framework

* feat(lsp): use `vim.Range` in `document_color` module
2026-03-18 17:18:48 -07:00
Sean Dewar
6f12663de5 fix(api): nvim_get_option_value FileType autocmd handling #37414
Problem:
nvim_get_option_value with "filetype" set silently returns incorrect
defaults if autocommands are blocked, like when they're already running.

Solution:
Allow its FileType autocommands to nest: `do_filetype_autocmd(force=true)`.
Also error if executing them fails, rather than silently return wrong defaults.

Endless nesting from misbehaving scripts should be prevented by the recursion
limit in apply_autocmds_group, which is 10.
2026-03-18 20:11:59 -04:00
tao
19715e6e8a fix(fs): expand drive-relative paths on Windows #37084
Problem:
On windows, if a drive-relative path doesn't contain a slash,
`path_to_absolute` can't split out the relative component, causing
expansion to fails. e.g., `c:` `c:.` `c:..` `c:foo.md`

Solution:
For these cases, we can pass letter and colon to `path_full_dir_name`.
Notably, `..` is included as well.
if that relative path exists, it can be expanded correctly.
2026-03-18 19:54:19 -04:00
Juan Pablo Briones
f4f1149292 fix(options): vim.opt fails for 'fillchars' #37141
Problem:
When `to_vim_value[info.metatype](info, value)` is called, a list value
such as `{'eob:a'}` is treated like a map, which generates `1:eob:a`.

Note: commands like `:lua vim.opt.wildmode={'longest:full'}` are not an
issue because only cases harcoded in `key_value_options` have metatype `map`.

Solution:
Check for array type and use the same logic as in array metatypes.
2026-03-18 19:19:47 -04:00
glepnir
8f9278d7c2 fix(menu): right-click menu fails with E335 when using V after i_ctrl-o #37349
Problem:
Right-click menu fails with E335 when using V in Insert mode (after
i_ctrl-o). The mode detection checks restart_edit before VIsual_active,
incorrectly selecting Insert mode binding even when Visual mode is
active.

Solution:
Check Visual mode before Insert mode, to match get_menu_mode() priority
order.
2026-03-18 18:52:06 -04:00
Justin M. Keyes
65e193a425 Merge #38351 docs 2026-03-18 15:55:20 -04:00
Justin M. Keyes
286b78de9b docs: misc, terminal
Close #38319
Close #38348

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Barrett Ruth <br.barrettruth@gmail.com>
2026-03-18 20:40:20 +01:00
Justin M. Keyes
7dfb8e3497 docs: terminal.txt new layout 2026-03-18 20:07:32 +01:00
Yi Ming
addd408b39 fix(lsp): redraw codelens after request completed #38352
Problem:
When code lens is enabled, `on_attach` is executed, but it does not trigger a redraw. Another event, eg, moving the cursor, is required to trigger a redraw and execute the decoration provider's `on_win`.

Solution:
Trigger a `redraw` after each request is completed.
2026-03-18 11:02:46 -04:00
Ayaan
63642ebf80 refactor(terminal): impl "[Process exited]" in Lua #38343
Problem:
"[Process exited]" is implemented in C with anonymous namespace
and users have no way to hide it.

Solution:
- Handle "TermClose" event in Lua.
- User can delete the "nvim.terminal" augroup to avoid "[Process exited]".
2026-03-18 07:54:41 -04:00
skewb1k
20225fc330 build: suppress -Wfree-nonheap-object false positives in lua_cjson #37250
Problem:
Building with GCC emits -Wfree-nonheap-object warnings in lua_cjson code
when calling strbuf_free(), despite the free being conditionally valid.
This is an unresolved GCC issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98753

Solution:
Supress warnings with the -Wno-free-nonheap-object flag for now.
2026-03-18 05:27:19 -04:00
zeertzjq
c3308fa5fe test(tui_spec): remove unnecessary :messages (#38349)
The :echomsg commands already trigger a hit-enter prompt. The :messages
will lead to an intermediate state, which causes the test to be flaky.
2026-03-18 01:49:36 +00:00
zeertzjq
1d776d909f test: always show snapshot if screen:expect_unchanged() fails (#38347)
If the final screen state does match but an intermediate screen state
doesn't, show the first intermediate state.
2026-03-18 07:10:01 +08:00
mgleonard425
b38173e493 feat(terminal): synchronized output (mode 2026) #38284
Problem:
Applications running inside :terminal that use DEC private mode 2026
(synchronized output) to batch screen updates get garbled rendering.
Neovim's embedded libvterm does not handle mode 2026, so the
synchronization sequences are ignored and intermediate screen states
leak through as visual corruption.

Solution:
Add mode 2026 support to libvterm's state machine and wire it through
to terminal.c. When an application enables mode 2026, invalidation of
the terminal buffer is deferred until the application disables it,
causing all accumulated screen updates to flush as a single
atomic refresh.

* fix(terminal): harden sync output redraw gating

Problem:
The initial mode 2026 implementation gated invalidate_terminal()
but missed three other redraw paths: term_sb_push/term_sb_pop
bypassed the gate by directly adding to invalidated_terminals,
refresh_timer_cb could fire mid-sync flushing partial state, and
the 10ms timer delay after sync-end left a window for stale
repaints.

Solution:
- Gate term_sb_push/term_sb_pop during synchronized output
- Skip syncing terminals in refresh_timer_cb
- On sync end, schedule a zero-delay full-screen refresh via
  sync_flush_pending flag in terminal_receive()
- Add news.txt entry for mode 2026 support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(terminal): add vterm unit tests for mode 2026

Add unit-level tests for synchronized output (mode 2026) to
vterm_spec.lua, covering settermprop callbacks and DECRQM
query/response.

Suggested-by: justinmk

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(terminal): address review feedback for mode 2026

- Use multiqueue_put(main_loop.events) instead of restarting the
  global refresh timer on sync end, to avoid affecting other
  invalidated terminals.
- Add screen:expect_unchanged() to verify screen doesn't update
  during sync mode.
- Merge buffer-lines test into existing test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:40:49 -04:00