Commit Graph

36142 Commits

Author SHA1 Message Date
dundargoc 8a4bee3ed0 build: update clang v21, fix warnings
- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per
  `readability-uppercase-literal-suffix`
2026-04-14 18:39:38 +02:00
tao e243bed18f docs: Windows nightly installation script #39053
Problem:
On Windows, when installing nightly build via winget, often
encounter "Installer hash does not match".

Solution:
use `Invoke-WebRequest` to download the msi package, then install
it via `msiexec`.
2026-04-14 12:22:03 -04:00
Justin M. Keyes b3e7fe6647 Merge pull request #38688 from eamonburns/master
fix(build.zig): remove runtime dependency on Windows SDK
2026-04-14 12:20:49 -04:00
Justin M. Keyes faad7c73ac test: n.rmdir() save-and-restore CWD #39048 2026-04-14 15:37:06 +00:00
zeertzjq c0f33c9a86 vim-patch:6836599: runtime(zip): Detect path traversal issues on Windows (#39051)
https://github.com/vim/vim/commit/6836599733950e1f52864a9742ff3e5bca5820fd

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-14 22:01:34 +08:00
Evgeni Chasnovski b8a24bfadf test(pack): use n.rmdir() to delete directories #39046
Problem: using `vim.fs.rm(dir_path, { force = true, recursive = true })`
  can result in an error on Windows if the process has a handle to it.

Solution: Use `n.rmdir()` helper in cases when its possible side effects
  (like changing working directory) does not matter.
2026-04-14 08:22:11 -04:00
luukvbaal f0f9620b38 fix(cmdline): avoid Ex-mode NULL cmdline_block event #39043
Problem: Attempting to emit cmdline_block event with NULL cmdbuff after
<C-\><C-N> in Ex-mode.

Solution: Don't emit cmdline_block event when cmdbuff is NULL.
2026-04-14 08:12:24 -04:00
Justin M. Keyes e70cb6b1d8 ci: mention "backport" in PR title #39040
This doesn't affect the merged commit(s), only the PR title.
2026-04-14 06:27:27 -04:00
Justin M. Keyes d77808ec59 docs: lsp, options, api #38980
docs: lsp, options

- revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b

Close #38991

Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-14 06:09:54 -04:00
Justin M. Keyes 65b40e69ac fix(lua): not obvious which _meta/ files are generated #39035
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`.
2026-04-14 05:38:47 -04:00
Justin M. Keyes 829e9ec65e refactor(options): generate "modeline disallowed" doc text #39019
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`).
2026-04-14 04:04:03 -04:00
glepnir aa7cba995d fix(completion): preselect ignores completeopt flag #39030
Problem: compl_preselect_match is set even when completeopt doesn't
include preselect.

Solution: Check kOptCotFlagPreselect in ins_compl_add before setting
compl_preselect_match.
2026-04-14 02:30:16 -04:00
Eamon Burns b34cd44ae6 fix(build.zig): call build_libluv with standard optimize mode 2026-04-13 16:03:30 -07:00
phanium 7bb8231577 fix(terminal): do not reflow altscreen on resize #38812
Problem: reflow can break tui display
Solution: disable reflow on altscreen
2026-04-13 18:15:34 -04:00
Justin M. Keyes df8d98173c feat(api): rename buffer to buf in retval #38900
In 3a4a66017b, 4d3a67cd62
we renamed "buffer" to "buf" in dict parameters.

This commit also renames such keys in dict return-values.
2026-04-13 12:42:26 -04:00
zeertzjq 938c1e2194 vim-patch:86dcb18: Revert "runtime(jjdescription): allow to configure summary width" (#39011)
This reverts commit 86ae6858ababe1f80476368c617dc1812df5b781.

related: vim/vim#19905

https://github.com/vim/vim/commit/86dcb1878cdbd0a8af61664b14f034398e319026

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-13 22:26:56 +08:00
jdrouhard eb9cda5fcf test(ui/screen_basic_spec): scrolling behind floating window #38993
validate scrolling behavior in the presence of floating windows.
2026-04-13 07:54:07 -04:00
glepnir 53a29dce0e feat(completion): completeopt=preselect, LSP CompletionItem.preselect #36613
Problem: 
LSP CompletionItem.preselect is not supported.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionClientCapabilities

Solution:
- Add "preselect" field to complete-items and "preselect" flag
  to 'completeopt'.
- Set preselectSupport=true in LSP client capabilities.
2026-04-13 05:59:07 -04:00
Jan Edmund Lazo 09d4eba92b vim-patch:9.0.0856: MS-Windows: executable not found when running test (#39002)
Problem:    MS-Windows: executable not found when running individual test.
Solution:   Also look for vimd.exe. (Christopher Plewright, closes vim/vim#11525)

https://github.com/vim/vim/commit/d55bfcaa9b140c50cddf56a2c614f05f2f6f2533

Co-authored-by: Christopher Plewright <chris@createng.com>
2026-04-13 05:19:35 +00:00
Jan Edmund Lazo bbd880ca2e vim-patch:9.0.0354: MS-Windows: starting a python server for test sometimes fails (#38998)
Problem:    MS-Windows: starting a python server for test sometimes fails.
Solution:   Increase the waiting time for the port.

https://github.com/vim/vim/commit/a906e8e1abf0a4c9a058ec5ee8a4c321a008cd41

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-13 01:30:33 +00:00
zeertzjq 34288b3eec vim-patch:9.2.0339: regexp: nfa_regmatch() allocates and frees too often (#38996)
Problem:  nfa_regmatch() allocates and frees two list buffers on every
          call, causing unnecessary memory allocation overhead for
          frequently used patterns.
Solution: Cache the list buffers in the regprog struct and reuse them
          on subsequent top-level calls. Recursive calls still allocate
          their own buffers. Free cached buffers in nfa_regfree()
          (Yasuhiro Matsumoto).

Benchmark: 10K lines, `:%s` x50 iterations

| Pattern | Before | After | Improvement |
|---|---|---|---|
| `\<\(\w\+\%(ing\|tion\|ed\|ly\)\|\w\{3,}\)\>` (many matches) | 4.384s | 4.299s | -2% |
| `\(foo\|bar\|baz\)\{3,}\(qux\|quux\|corge\)\{2,}...` (no match, high nstate) | 16.927s | 3.015s | -82% |

closes: vim/vim#19956

https://github.com/vim/vim/commit/105d65e29b636981b2a92cd0205b19f85951d770

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-04-13 07:30:32 +08:00
zeertzjq b081cc3aeb test(terminal/channel_spec): wait some time for shell to start (#38995)
Problem:
The retry on Windows doesn't seem to actually work, as the test still
occasionally fails on Windows. Meanwhile the test can fail on Linux as
well:

FAILED   test/functional/terminal/channel_spec.lua @ 123: chansend sends lines to terminal channel in proper order
test/functional/terminal/channel_spec.lua:131: retry() attempts: 1
test/functional/terminal/channel_spec.lua:134: Failed to match any screen lines.
Expected (anywhere): "echo "hello".*echo "world""
Actual:
  |^ech$ o "hello"                                                                                      |
  |echo "world"                                                                                        |
  |hello                                                                                               |
  |$ world                                                                                             |
  |$                                                                                                   |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |                                                                                                    |
  |term://~/work/neovim/neovim/build/Xtest_xdg_terminal//32516:sh [-]                                  |
  |                                                                                                    |

Solution:
Use a wait before the chansend() instead.
2026-04-13 06:59:47 +08:00
Owen 26f77f8fcd feat(provider): support bun as node.js provider #38517
Problem:
Neovim's Node.js provider does not support the Bun package manager.
PR #26829 attempted to add this but used a hardcoded path and was abandoned.

Solution:
- Use `bun pm bin -g` to dynamically locate the global binary directory.
- Update `health.lua` to recognize bun installations.
2026-04-12 15:01:32 -04:00
Justin M. Keyes 4eb95c8ed2 revert: "fix(lsp): only resolve LSP configs once" #38990
revert eb90f5d9e3
2026-04-12 18:34:27 +00:00
Lars Debor 891bb0e6ce fix(lsp): show_document can't position cursor past EOL in insert-mode #38566
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.
2026-04-12 11:46:24 -04:00
glepnir fcdb148437 fix(pum): info float width grows on reselect with 'linebreak' #38680
Problem: win_linetabsize() includes wrap overhead from 'linebreak'
based on current window width, but the result sizes the window,
causing a feedback loop.

Solution: Temporarily set w_view_width to Columns before measuring.
2026-04-12 11:42:27 -04:00
glepnir 1033739b60 feat(api): nvim_set_hl can set "font" #37668
Problem: Cannot set highlight group fonts via API, only via :highlight
command.

Solution: Add font parameter in nvim_set_hl().
2026-04-12 11:19:40 -04:00
Emilv2 37eb1b9979 fix(lsp): send didOpen on save to all clients+groups #37454
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.
2026-04-12 10:56:12 -04:00
Barrett Ruth b7cbad7489 fix(tui): use erase_chars for short clears #38973
Problem:
Due to optimizations c936ae0f36, nvim prints literal spaces instead of using
`erase_chars` in widths <= 5 even if the terminal advertises `erase_chars`
support (perhaps a small-output size heuristic). However, this is not
semantically neutral: in some terminals, erased cells and printed spaces are
copied differently.

I ended up with two useful groups of results.

First, I tested raw terminal behavior without nvim involved:

    | Terminal | Raw plain text | Raw `erase_chars` | Raw literal spaces |
    | --- | --- | --- | --- |
    | xterm | clean | trailing spaces copied | trailing spaces copied |
    | xfce4-terminal | clean | clean | trailing spaces copied |

Second, I tested nvim itself:

    | Terminal | no patch | with this patch |
    | --- | --- | --- |
    | xfce4-terminal | trailing spaces reproduced | clean |
    | xterm | trailing spaces reproduced | trailing spaces reproduced |
    | Alacritty | clean | clean |
    | Ghostty | clean | clean |
    | WezTerm | clean | clean |

Nvim often prints spaces instead of sending `erase_chars`, which this patch
changes for short clears when the terminal advertises it. This fixes
xfce4-terminal because raw `erase_chars` are already cleaned up by the terminal,
while spaces aren't. ***Notably, xterm is different***: even when `erase_chars`
is sent directly (NO NVIM INVOLVED) xterm *still* copies those cleared blank
trailing cells (and this is documented). So for xterm, which is the only
remaining problematic fix, I'm quite sure there's nothing we ought to do on the
Nvim side.

Solution:
Drop the `width >= 5` condition.
2026-04-12 10:30:06 -04:00
Justin M. Keyes 52d466c500 Merge #38882 docs 2026-04-12 08:45:46 -04:00
Barrett Ruth 6e95d1ad13 fix(normal): pass count to 'keywordprg' as arg1 #38965
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'`.
2026-04-12 08:44:56 -04:00
glepnir 49086862fc fix(api): nvim_get_hl drops groups defined with link_global #38492
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.
2026-04-12 08:38:35 -04:00
Justin M. Keyes 30a80cbd7c docs: vim.pos 2026-04-12 14:17:50 +02:00
Justin M. Keyes a321c9adad docs: misc
Close #38748
Close #38866

Co-authored-by: Mario Loriedo <mario.loriedo@gmail.com>
Co-authored-by: Anakin Childerhose <anakin@childerhose.ca>
2026-04-12 14:17:50 +02:00
mnikic 2f6c560002 build: support GNU Hurd by skipping BSD sysctl checks #38975
Problem:
Neovim currently fails to build on GNU Hurd. Because Hurd relies on
glibc, `<sys/param.h>` defines the `BSD` macro for 4.4BSD compatibility.
The preprocessor incorrectly routes Hurd into the BSD code paths, which
fatally fail during compilation because Hurd lacks `<sys/sysctl.h>` and
the `sysctl()` function.

Solution:
Update the preprocessor guards in  `os/proc.c` to explicitly exclude
`__gnu_hurd__` from the BSD-specific `sysctl` blocks. Instead, group GNU
Hurd with the `__linux__` paths, as both systems rely on standard POSIX
interfaces and `/proc` parsing (which Hurd fully supports via its
`procfs` translator).

Testing:
The test suite does not fully pass yet natively on GNU Hurd
(specifically tests involving PTY closures and SIGHUP/SIGTERM trapping,
like `autocmd TermClose kills PTY job`). This is due to underlying
differences in Hurd's Mach RPC architecture and the `term` translator.
This patch does not attempt to fix those test executions, but simply
unblocks the core compiler as a necessary first step.
2026-04-12 08:07:15 -04:00
jdrouhard 73cfc3ca03 perf(ui): check rectangle intersection when looking for covering grids #38500
Problem:
The ui compositor does not use grid_scroll events when a grid other than
the built in msg_grid exists above the scrolled grid, regardless of
whether it actually intersects the scrolled grid anywhere in the
scrolled region.

When another layer exists at a higher zindex, the ui compositor falls
back to composing every line of the scrolled grid. This is especially
evident when using ui2 which creates a floating window that replaces the
built-in msg_grid. Scrolling around with ui2 enabled has poor
performance because the entire grid is recomposed on every scroll
instead of using grid_scroll.

Solution:
Instead of just checking whether another grid exists at a higher zindex
than curgrid, ensure there's a grid above the curgrid that is positioned
over the particular rectangle of interest, which could be a subrectangle
of the whole grid.

Grids above the curgrid that don't intersect there no longer count as
covering the curgrid, and the compositor can continue to use grid_scroll
scroll events. The floating window created for the command line/messages
with ui2 never intersects with the scrolled region of the main window
grid, which allows performant scrolling with it enabled.
2026-04-12 07:44:35 -04:00
zeertzjq fa22a78d2a vim-patch:86ae685: runtime(jjdescription): allow to configure summary width (#38972)
Allow to configure max length for the summary line and fall back to gits
setting.

closes: vim/vim#19905

https://github.com/vim/vim/commit/86ae6858ababe1f80476368c617dc1812df5b781

Co-authored-by: Emilia <emilia@bewitching.dev>
2026-04-12 08:00:51 +08:00
Jan Edmund Lazo 4a289bfce3 vim-patch:8.2.2035: MS-Windows: some tests may fail (#38969)
Problem:    MS-Windows: some tests may fail.
Solution:   Avoid test failures. (Yegappan Lakshmanan, closes vim/vim#7346)

https://github.com/vim/vim/commit/f637bceb6135139dc1891a15de8fa134c2ca2d97

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-12 07:10:28 +08:00
Jan Edmund Lazo 56fe6713ca vim-patch:8.2.0904: assuming modifyOtherKeys for rhs of mapping (#38970)
Problem:    Assuming modifyOtherKeys for rhs of mapping.
Solution:   Ignore seenModifyOtherKeys for mapped characters. (closes vim/vim#6200)

https://github.com/vim/vim/commit/46cd43bda102c3782bba1c4c629836e010734d77

----

"getchar.c" changes depend on patch 8.1.2145.
Can't port it due to tests.
"test_gui.vim" doesn't depend on GUI for all tests.

----

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-12 07:07:16 +08:00
Justin M. Keyes 6f015cdcdf feat(connect): filepath completion #38959
This is a stop-gap; the next step is for :connect to show a menu of
known peers (and perhaps also any files in CWD that look like sockets).
2026-04-11 11:05:13 -04:00
skewb1k 38aec2d3cd fix(pack): make 'stash' call compatible with older Git #38679
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.
2026-04-11 10:37:37 -04:00
glepnir af9a72d8c1 fix(lsp): check stale context in hover/signature callback #38724
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.
2026-04-11 10:32:56 -04:00
Jaehwang Jung 417d16df50 fix(lsp): codelens text flickers #38782
Problem:
When a new textDocument/codeLens response arrives with unresolved lenses,
on_win clears the existing codelens row before codeLens/resolve
completes. This causes the displayed codelens text to flicker while
typing.

Solution:
Keep the current virtual lines if any of the refreshed lenses are still
unresolved. Clear the old virtual lines only when the line no longer has
lenses or all its lenses are resolved.

A trade-off is that the user may temporarily see outdated codelenses.
However, that's preferable to spamming updates on every refresh.

AI-assisted: Codex
2026-04-11 10:27:11 -04:00
glepnir 01567ad4f6 fix(highlight): preserve inherited colors when update=true breaks links #38750
Problem: Breaking a link with update=true loses colors inherited from
the linked group.

Solution: Copy color indices from the linked group so inherited colors
remain visible in :hi output.
2026-04-11 10:14:27 -04:00
github-actions[bot] 0cb6dde5ee docs: update version.c #38816
vim-patch:9.2.0313: Callback channel not registered in GUI
vim-patch:9.2.0319: popup: rendering issues with partially transparent popups
vim-patch:9.2.0322: tests: test_popupwin fails
vim-patch:3e194b106 runtime(vimball): detect more path traversal attacks
vim-patch:9.2.0335: json_encode() uses recursive algorithm

vim-patch:9.2.0309: Missing out-of-memory check to may_get_cmd_block()
vim-patch:9.2.0310: unnecessary work in vim_strchr() and find_term_bykeys()

vim-patch:8.2.2824: MS-Windows: build failure with MSVC
vim-patch:9.1.1692: global_functions are not constant
2026-04-11 09:12:58 -04:00
zeertzjq 1d1b3c8e58 Merge pull request #38953 from janlazo/vim-8.2.0898
vim-patch:8.2.{898,2958}
2026-04-11 15:33:47 +08:00
Jan Edmund Lazo 08f9bf5d26 vim-patch:8.2.2958: function list test fails
Problem:    Function list test fails.
Solution:   Add newly added function to the list.  Fix typo.

https://github.com/vim/vim/commit/f7a023e580c695e86f68228adcf5c9e6ea00a4d5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-11 02:47:31 -04:00
Jan Edmund Lazo 828b91495c vim-patch:8.2.0898: missing help for a function goes unnoticed
Problem:    Missing help for a function goes unnoticed.
Solution:   Add a test. (Gary Johnson)

https://github.com/vim/vim/commit/6b0e528368415476bfc3a8414c9c70f9852b1517

----

Test relies on parsing runtime/doc/*.txt and src/evalfunc.c .
Error-prone because Vim and Nvim diverged on both documentation
and source code in spite of ported Vim patches.
Importing src/nvim/eval.lua is an alternative
but it uses associatve index such that it's unsorted.

Treat it as N/A because I can't rewrite any of its tests
under minimal effort.

----

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-11 02:05:03 -04:00
zeertzjq c4b592a6d0 vim-patch:9.2.0333: filetype: PklProject files are not recognized (#38949)
Problem:  filetype: PklProject files are not recognized
Solution: Detect PklProject files as pkl filetype
          (Nihaal Sangha).

Reference:
https://pkl-lang.org/
https://github.com/apple/pkl
https://github.com/apple/pkl-pantry

closes: vim/vim#19948

https://github.com/vim/vim/commit/871e6c6cf9835b1f266461f3eb6c7bf07e841779

Co-authored-by: Nihaal Sangha <nihaal.git@gmail.com>
2026-04-11 08:05:43 +08:00
zeertzjq 4f7b6083e5 vim-patch:9.2.0331: spellfile: stack buffer overflows in spell file generation (#38948)
Problem:  spell_read_aff() uses sprintf() into a fixed-size stack buffer
          without bounds checking. store_aff_word() uses STRCAT() to
          append attacker-controlled strings into newword[MAXWLEN] without
          checking remaining space. Both are reachable via :mkspell with
          crafted .aff/.dic files (xinyi234)
Solution: Replace sprintf() with vim_snprintf() in spell_read_aff().
          Replace STRCAT() with STRNCAT() with explicit remaining-space
          calculation in store_aff_word().

closes: vim/vim#19944

https://github.com/vim/vim/commit/07faa961a05bc5ea007ab70ff483ea1b32c3371d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-10 23:39:54 +00:00