Commit Graph

36116 Commits

Author SHA1 Message Date
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

86ae6858ab

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)

f637bceb61

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)

46cd43bda1

----

"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.

f7a023e580

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)

6b0e528368

----

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

871e6c6cf9

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

07faa961a0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-10 23:39:54 +00:00
zeertzjq
5ecff6c96f vim-patch:9.2.0330: tests: some patterns in tar and zip plugin tests not strict enough (#38947)
Problem:  Some patterns in tar and zip plugin tests not strict enough.
Solution: Use assert_equal() for lines that should match exactly. Match
          a literal dot properly (zeertzjq).

closes: vim/vim#19946

2fbc69c9ad
2026-04-11 07:26:35 +08:00
bfredl
64fee8e075 Merge pull request #38928 from bfredl/alot_is_alot
refactor(oldtest): one test_alot.vim file is already alot
2026-04-10 20:20:49 +02:00
Justin M. Keyes
843a7223e7 Merge #38501 :log, stdpath("state")/logs 2026-04-10 12:38:38 -04:00
Olivia Kinnear
8715877417 feat(ex): add :log command 2026-04-10 11:08:26 -05:00
Evgeni Chasnovski
94c0e54e5b fix(pack): more advice for out-of-sync lockfile #38931
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`.
2026-04-10 11:36:04 -04:00
Maria Solano
c1c2648284 feat(snippet): support multiple sessions #29340 2026-04-10 10:08:10 -04:00
Ellison
45f50d238a feat(vim.net): custom request() headers #38837
Problem
Cannot specify headers in vim.net.request() call.

Solution
Support opts.headers in vim.net.request opts.
2026-04-10 09:55:57 -04:00
bfredl
eea1b99282 refactor(oldtest): one test_alot.vim file is already alot
neovim always uses encoding=utf8. Thus a lot of utf8 tests are just a
lot of tests. Meanwhile test_regexp_latin.vim is a bit of a lone child,
it can just run as a separate test without a shell layer (running it in
the same process as its utf8 sibling is not allowed
2026-04-10 13:21:20 +02:00
zeertzjq
6d43869aa0 Merge pull request #38924 from zeertzjq/vim-9.2.0325
vim-patch:9.2.{0325,0326}: tar plugin fixes
2026-04-10 13:13:00 +08:00
zeertzjq
ec8d352117 vim-patch:9.2.0326: runtime(tar): but with dotted path
Problem:  runtime(tar): but with dotted path
Solution: Do not strip everything after the first dot
          (Aaron Burrow)

tar#Extract was getting the extensionless basename by
stripping away everything starting with the leftmost
dot.  So if a directory had a dot or the file had an
'extra' dot then the code did the wrong thing.  For
example, if it was given:

  /tmp/foo.bar/baz.tar.gz

Then it would treat /tmp/foo as the extensionless
basename, but it actually should have grabbed:

  /tmp/foo.bar/baz

This patch fixes the issue by instead looking at the
rightmost dot(s).

This bug was discovered by ChatGPT 5.4.  I wrote the
patch and tested vim.

closes: vim/vim#19930

4a1bcc67b4

Co-authored-by: Aaron Burrow <burrows@fastmail.com>
2026-04-10 12:30:38 +08:00
zeertzjq
dc3b49d5a1 vim-patch:9.2.0325: runtime(tar): bug in zstd handling
Problem:  patch 9.2.0325: runtime(tar): bug in zstd handling
Solution: use correct --zstd argument, separated from other arguments,
          rework testing framework (Aaron Burrow).

The tar.vim plugin allows vim to read and manipulate zstd archives,
but it had a bug that caused extraction attempts to fail.
Specifically, if the archive has a .tar.zst or .tzst extension, then
the code was generating invalid extraction commands that looked like
this:

  tar --zstdpxf foo.tar.zst foo

When they should be like this:

  tar --zstd -pxf foo.tar.zst foo

This patch changes the flag manipulation logic so that --zstd isn't
glued to pxf.

The labor for this change was divided between ChatGPT 5.4 and me.
ChatGPT 5.4 identified the issue (from a code scan?), and I wrote
the patch and tested vim.

related: vim/vim#19930

00285c035a

Note: tests need the next patch to pass in Nvim.

Co-authored-by: Aaron Burrow <burrows@fastmail.com>
2026-04-10 12:30:31 +08:00
Olivia Kinnear
6bea0cdbdc feat(logs)!: move logs to stdpath("state")/logs 2026-04-09 21:54:33 -05:00
zeertzjq
5c8a93001c Merge pull request #38923 from zeertzjq/vim-9598174
vim-patch: jjdescription syntax updates
2026-04-10 10:52:02 +08:00
zeertzjq
d8aafb20e1 vim-patch:f554a7c: runtime(jjdescription): Add highlighting for 'Renamed' status lines
`jj status` output uses the 'R' prefix for renamed files.

closes: vim/vim#19879

f554a7c709

Co-authored-by: Joël Stemmer <jstemmer@google.com>
2026-04-10 09:59:37 +08:00
zeertzjq
08118fe6f2 vim-patch:9598174: runtime(jjdescription): Anchor status matches to start of line
The regex for status line highlighting was too broad, `jjComment` lines
containing e.g. the letter 'A' followed by a space anywhere in the line
were highlighted.

related: vim/vim#19879

959817472d

Co-authored-by: Joël Stemmer <jstemmer@google.com>
2026-04-10 09:59:19 +08:00
zeertzjq
b10ae3b72b vim-patch:72cefe6: runtime(help): support highlighting groups in translated syntax doc (#38922)
closes: vim/vim#19942

72cefe6b72

Also include a blank line change from 9d9381fb28

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-04-10 08:23:48 +08:00
zeertzjq
10e385cf30 vim-patch:9.2.0329: tests: test_indent.vim leaves swapfiles behind (#38921)
Problem:  tests: test_indent.vim leaves swapfiles behind
Solution: Close open buffer using :bw! instead of :close!

158947e294

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-09 23:56:18 +00:00
zeertzjq
93b3ea26ac vim-patch:9.2.0327: filetype: uv scripts are not detected (#38920)
Problem:  filetype: uv scripts are not detected
          (Asger Hautop Drewsen)
Solution: Detect uv scripts as python filetype if the shebang line
          contains "uv run"

Reference:
https://docs.astral.sh/uv/guides/scripts/#using-a-shebang-to-create-an-executable-file

fixes: vim/vim#19941

6c16ccaf61

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-10 07:28:24 +08:00
zeertzjq
cfbbec6fda vim-patch:9.2.0324: 0x9b byte not unescaped in <Cmd> mapping (#38919)
Problem:  0x9b byte not unescaped in <Cmd> mapping (BenYip).
Solution: Translate K_CSI to CSI like what is done in vgetc().
          (zeertzjq).

fixes:  vim/vim#19936
closes: vim/vim#19937

3e2012914e
2026-04-10 07:03:56 +08:00
Yi Ming
f9e068117b refactor(lsp): share code by get_locations #38902
Problem:
`vim.lsp.buf.definition`/`vim.lsp.buf.declaration` use the same underlying code
via `get_locations`, whereas `vim.lsp.buf.reference` does not. This is because
`buf.reference` does not perform a jump when there is only one item.

Solution:
In #38510, I simplified the jump logic using `:cfirst`, so they can now share
code more easily. Additionally, this PR enables `buf.definition` to display the
corresponding qflist name.
2026-04-09 13:46:50 -04:00
Luis Calle
24811c0a14 fix(vim.pos): Range:intersect() drops buf #38898
new() only supports nargs=5 or nargs=2, but this was passing 4 args.
2026-04-09 11:01:28 -04:00
zeertzjq
9c5fba5df0 fix(messages): truncate warning messages only in display (#38901)
For now, add a private "_truncate" flag to nvim_echo, using a truncation
method similar to showmode().
2026-04-09 04:11:32 +00:00
Jordan
3a4a66017b feat(api): rename buffer to buf #35330
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: Justin M. Keyes <justinkz@gmail.com>
2026-04-08 20:34:47 -04:00
zeertzjq
eefb50e352 vim-patch:9.2.0323: filetype: buf.lock files are not recognized (#38897)
Problem:  filetype: buf.lock files are not recognized
Solution: Detect buf.lock files as yaml filetype
          (Stefan VanBuren)

Reference:
https://buf.build/docs/configuration/v2/buf-lock/

closes: vim/vim#19935

c2734dc03c

Co-authored-by: Stefan VanBuren <svanburen@buf.build>
2026-04-08 23:11:20 +00:00
glepnir
6473d007e7 fix(lsp): apply_text_edits causes unwanted BufDelete events #38778
Problem:
Since 2f6d1d3c88, `apply_text_edits`
unconditionally sets `buflisted=true`, causing spurious BufDelete events
if plugins restore the original 'buflisted' state on unlisted buffers:
65ef6cec1c/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.
2026-04-08 17:10:52 -04:00