Commit Graph

35977 Commits

Author SHA1 Message Date
Luis Calle
79a2235fd1 perf(vim.pos): use nvim_buf_line_count instead of fetching all lines #38686 2026-04-01 15:28:31 -04:00
phanium
a2d9863c27 fix(ui2): vim.on_key should return nil instead of false (#38668) 2026-04-01 15:07:26 +02:00
zeertzjq
a0fcf32ad5 vim-patch:82ebaa7: runtime(racket): Make visual K mapping more robust for shell injection (#38677)
fyi @benknoble

82ebaa79b0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-01 19:21:24 +08:00
zeertzjq
65e2218585 vim-patch:9.2.0277: tests: test_modeline.vim fails (#38672)
Problem:  tests: test_modeline.vim fails (after v9.2.0276)
Solution: Rewrite the tests to use the existing s:modeline_fails()
          function, update documentation (zeertzjq).

8c8772c6b3
2026-04-01 08:43:03 +00:00
Jan Edmund Lazo
8367340b05 build(vim-patch): N/A runtime files (#38666)
* fix(vim-patch): runtime/doc/print.txt is N/A

- https://github.com/neovim/neovim/issues/21471

* fix(vim-patch): test_urls.vim is N/A

- https://github.com/neovim/neovim/pull/35593
2026-04-01 04:25:43 +00:00
zeertzjq
fa51f5502f vim-patch:12c6417: runtime(sshconfig): Add missing kex algorithm (#38656)
These are available already with openssh 10.2p1.

closes: vim/vim#19864

12c6417587

Co-authored-by: Thomas Braun <thomas.braun@byte-physics.de>
2026-04-01 10:00:31 +08:00
zeertzjq
c7604323e3 vim-patch:9.2.0276: [security]: modeline security bypass (#38657)
Problem:  [security]: modeline security bypass
Solution: disallow mapset() from secure mode, set the P_MLE flag for the
          'complete', 'guitabtooltip' and 'printheader' options.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-8h6p-m6gr-mpw9

75661a66a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-01 08:00:33 +08:00
zeertzjq
a89d7dcb91 docs: misc (#38578) 2026-04-01 07:59:51 +08:00
zeertzjq
d29db48e0a vim-patch:374f06f: runtime(racket): Use shellescape() to harden the K mapping
fyi: @benknoble

374f06ffd8

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Michał Majchrowicz <mmajchrowicz@afine.com>
2026-04-01 07:58:14 +08:00
zeertzjq
ec1bea9c05 vim-patch:e551e71: runtime(tera): use fnameescape() when loading separate syntax files
e551e71d7e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-01 07:58:14 +08:00
zeertzjq
0860b24c2c vim-patch:52169db: translation(cleanup): squeeze successive empty lines and remove stray comments
closes: vim/vim#19860

52169dbc28

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2026-04-01 07:46:16 +08:00
zeertzjq
9b9c72f6d4 vim-patch:cca3df9: translation: improve the po/cleanup.vim script
explicitly delete into the black-hole register

closes: vim/vim#15499

cca3df9275

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2026-04-01 07:46:16 +08:00
Justin M. Keyes
2b7d793cd6 Merge #38579 from liskin/terminfo-urxvt
fix(termkey): use terminfo for (shift+)left/right keys
2026-03-31 18:07:08 -04:00
Matthew Chen
410ba8374d fix(tutor): open a temporary copy instead of original file #38522
Problem:
`:Tutor` should open a copy of the tutor file instead of the original. This is
because edits modify the original file buffer, and crashes or other misuse could
potentially corrupt the original file even if it's WO.

Solution:
Copy the tutor file to a temp path before opening. Store the original path in
`b:tutor_file` so metadata json loading still works.

- `tutor#TutorCmd` will now copy the tutor file to a temp path via `tempname()`
  before opening with `drop`. Store the original path in `b:tutor_file` only
  after the buffer is created.
- `tutor#LoadMetadata` now uses `b:tutor_file` to resolve the JSON path instead
  of `expand('%')`, which now points to the temp copy buffer
- `ftplugin/tutor.vim` does not make the `tutor#LoadMetadata` call anymore. It
  was guarded by `filereadable(expand('%').'.json')` which fails for the new
  temp copy path logic . Instead, `tutor#LoadMetadata` is already called
  directly inside `tutor#TutorCmd` since we are already assumed to enable
  interactive.

Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
2026-03-31 15:27:06 -04:00
luukvbaal
75e5e37942 fix(ui2): flicker when entering pager from expanded cmdline #38639
Problem:  'showcmd' causes flickering when pressing "g<" to enter the
          pager when the cmdline is expanded for messages.
          Initial keypress for an incomplete mapping is not giving 'showcmd'
          feedback while cmdline is expanded for messages (which is only
          dismissed upon the vim.on_key callback after 'timeoutlen').

Solution: Delay dismissing expanded cmdline when vim.on_key() callback
          receives "g".
          Place 'showcmd' "last" virtual text during expanded cmdline.
2026-03-31 15:01:58 -04:00
Christian Clason
953f9bc398 build(deps): bump tree-sitter to v0.26.8 2026-03-31 19:56:21 +02:00
Yi Ming
e31bfb81ce fix(lsp): use winresetview() to avoid switching to normal mode (#38641) 2026-03-31 09:31:30 -07:00
luukvbaal
cd2a27507a fix(window): clear cmdline 'ruler' when window is closed #38631
Problem:  When 'ruler' is in last line of the screen and the current
          floating window is closed, the ruler is not cleared.
Solution: When closing the current floating window, redraw the cmdline
          if that contained, and will no longer contain the 'ruler'.
2026-03-31 11:11:33 -04:00
luukvbaal
1685ced335 fix(cmdline): redraw cmdline after empty message (#38485)
Problem: Cmdline is not redrawn after an empty message clears it.
Remembered last drawn cursor position may be outdated but
equal to the current cmdline content with UI2.
Solution: Ensure cmdline is redrawn after an empty message clears it.
Compare wanted cursor position with actual cursor position.
2026-03-31 14:16:55 +02:00
altermo
1bcf2d7f90 fix(treesitter): select with node ending with unicode char (#38557)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-03-31 13:03:18 +08:00
zeertzjq
da58fe8fd2 fix(defaults): check for TUI on non-stdio channel on startup (#38581) 2026-03-31 11:17:33 +08:00
zeertzjq
96d6042689 test(tui_spec): work around flaky test with ASAN (#38619)
FAILED   test/functional/terminal/tui_spec.lua @ 2641: TUI exits immediately when stdin is closed #35744
test/functional/terminal/tui_spec.lua:2648: Failed to match any screen lines.
Expected (anywhere): "%[Process exited 1%]"
Actual:
  |^                                                  |
  |[Process exited 129]{100:                              }|
  |{100:~                                                 }|
  |{100:~                                                 }|
  |{3:[No Name]                                         }|
  |                                                  |
  |{5:-- TERMINAL --}                                    |
2026-03-31 02:26:23 +00:00
zeertzjq
19fff0e0be vim-patch:9.2.0232: fileinfo not shown after :bd of last listed buffer (#38453)
Problem:  fileinfo not shown after :bd of last listed buffer
          (memeplex)
Solution: Set need_fileinfo to true in empty_curbuf()
          (Hirohito Higashi)

When deleting the last listed buffer with :bd, the new empty buffer's
file info (e.g. "[No Name]" --No lines in buffer--) was not displayed.
do_ecmd() only calls fileinfo() for existing buffers (oldbuf), not for
newly created empty buffers.

Set need_fileinfo in empty_curbuf() so the file info is displayed after
redraw.

fixes:  vim/vim#548
closes: vim/vim#19802

3d472d8675

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:13:54 +08:00
zeertzjq
bc272cc36f test(tui_spec): unskip a few more tests on Windows (#38618) 2026-03-31 00:54:53 +00:00
Eisuke Kawashima
dbc4800dda vim-patch:2844765: translation: do not add message location as comments into vim.pot (#38587)
Let's add the --no-location to the xgettext command line call, so that
the generated vim.pot file does not contain the message location. Those
will get out of date soon and we don't want to update vim.pot just
because the location in a comment changes.

2844765e90

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-31 07:59:57 +08:00
zeertzjq
a3a48392c5 fix(:restart): only pass --headless when there is no UI (#38580)
Change --embed so that the first UI can be on non-stdio channel even if
neither --headless nor --listen is passed.
2026-03-31 07:00:34 +08:00
Christian Clason
545007ac72 build(deps): bump luajit to 18b087cd2 2026-03-30 23:43:26 +02:00
Christian Clason
e508aa0fa8 fix(ui2): allow empty argument for enable() #38605
Problem: `vim._core.ui2.enable` requires passing an empty table for
default options, unlike other (native) Lua API.

Solution: Initialize `opts` with empty table if `nil` is passed.
2026-03-30 16:47:02 +00:00
Ayush Goyal
f50e7d8205 fix(ui2): correct buffer reference in msg:start_timer() (#38600)
Problem:  Mixing "buf" and "M.bufs.msg" in M.msg:start_timer().
          Cannot run `require("vim._core.ui2").enable(nil)`.
Solution: Replace "M.bufs.msg" with "buf". Allow `opts == nil`.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2026-03-30 16:36:45 +00:00
skewb1k
2dce2af768 docs: fix syntax errors in examples #38606 2026-03-30 11:49:30 -04:00
github-actions[bot]
183933998c docs: update version.c #38505
vim-patch:9.1.0333: tests: test_xdg fails on the appimage repo
vim-patch:9.1.0336: tests: typo in test_xdg
vim-patch:9.1.0339: tests: xdg test uses screen dumps
vim-patch:9.1.0347: A few typos in test_xdg when testing gvimrc
vim-patch:b9897ec27 runtime(xdg): remove // from 'undo' and 'viwedir'
vim-patch:2e9e7cb8e runtime(xdg): Move viminfofile storage to state dir
vim-patch:9.2.0255: tests: Test_popup_opacity_vsplit() fails in a wide terminal
vim-patch:9.2.0260: statusline not redrawn after closing a popup window
vim-patch:9.2.0261: terminal: redraws are slow
vim-patch:9.2.0264: Cannot disable kitty keyboard protocol in vim :terminal
vim-patch:9.2.0268: memory leak in call_oc_method()
vim-patch:9.2.0269: configure: Link error on Solaris

vim-patch:9.2.0258: memory leak in add_mark()
2026-03-30 11:02:32 -04:00
Yi Ming
57797ed7d4 feat(lsp): respect 'switchbuf' for jump commands, drop reuse_win #38510
Problem:
LSP jump operations such as `buf.definition`/`buf.type_definition` do
not follow the 'switchbuf' option. Instead their behavior is controlled
by `vim.lsp.LocationOpts.reuse_win`. When `reuse_win=true`, the effect
is very similar to `set switchbuf=useopen`.

Note that functions like `buf.definition` open the quickfix
window when there are multiple results, and jumping between quickfix
entries already follows 'switchbuf', so unifying the behavior is more
intuitive.

Solution:
Follow the 'switchbuf' option and drop `reuse_win`.

We can achieve this behavior by using :cfirst when the quickfix list has
only one item, rather than customizing the jump logic as before.
2026-03-30 10:54:55 -04:00
dependabot[bot]
f062c6fd43 ci: bump msys2/setup-msys2 from 2.30.0 to 2.31.0 in the github-actions group across 1 directory (#38601)
ci: bump msys2/setup-msys2

Bumps the github-actions group with 1 update in the / directory: [msys2/setup-msys2](https://github.com/msys2/setup-msys2).


Updates `msys2/setup-msys2` from 2.30.0 to 2.31.0
- [Release notes](https://github.com/msys2/setup-msys2/releases)
- [Changelog](https://github.com/msys2/setup-msys2/blob/main/CHANGELOG.md)
- [Commits](4f806de0a5...cafece8e6b)

---
updated-dependencies:
- dependency-name: msys2/setup-msys2
  dependency-version: 2.31.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-30 10:29:12 -04:00
zeertzjq
cbe142d3a4 vim-patch:068c060: runtime(rustfmt): not correctly escaping directory names (#38597)
Problem:  runtime(rustfmt): not correctly escaping directory names
Solution: Use fnamescape() (Michał Majchrowicz)

068c0604c9

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-03-30 19:32:55 +08:00
zeertzjq
80e5ccdd44 refactor(buffer.c): fix coverity warning (#38589)
The NULL checks added in #35679 are no longer needed after #38473.

_____________________________________________________________________________________________
*** CID 645258:           (REVERSE_INULL)
/src/nvim/buffer.c: 645             in close_buffer()
639             // Autocommands deleted the buffer.
640             emsg(_(e_auabort));
641             return false;
642           }
643           buf->b_locked--;
644           buf->b_locked_split--;
>>>     CID 645258:           (REVERSE_INULL)
>>>     Null-checking "win" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
645           if (abort_if_last && win != NULL && one_window(win, NULL)) {
646             // Autocommands made this the only window.
647             emsg(_(e_auabort));
648             return false;
649           }
650         }
/src/nvim/buffer.c: 626             in close_buffer()
620           // Autocommands deleted the buffer.
621           emsg(_(e_auabort));
622           return false;
623         }
624         buf->b_locked--;
625         buf->b_locked_split--;
>>>     CID 645258:           (REVERSE_INULL)
>>>     Null-checking "win" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
626         if (abort_if_last && win != NULL && one_window(win, NULL)) {
627           // Autocommands made this the only window.
628           emsg(_(e_auabort));
629           return false;
630         }
631
2026-03-30 14:50:12 +08:00
Maria Solano
92a667c07f fix(lsp): reset document color processed version on clear (#38582) 2026-03-29 18:20:27 -07:00
Justin M. Keyes
b6006679e7 docs: news #38583 2026-03-29 20:53:24 -04:00
Tomas Janousek
c4283caa17 fix(termkey): use terminfo for (shift+)left/right keys
Problem:
Since neovim 0.12, shift + arrow keys no longer works in rxvt-unicode
(TERM=rxvt-unicode-256color).

Solution:
Re-add `left` and `right` to `wanted_termkeys` so they're read from
terminfo instead of being handled by driver-csi. There seems to be quite
a few other terminals that define kLFT in terminfo.src and these are
likely to be affected as well.

Fixes: https://github.com/neovim/neovim/issues/38571
Fixes: 4b678a499c ("refactor(termkey): make termkey use internal terminfo properly")
2026-03-30 00:42:01 +01:00
Tomas Janousek
7150ae0150 revert: "fix(scripts): gen_terminfo clears Windows terminfo definitions #36736"
Problem:
`gen_terminfo.lua`'s output is unpredictable and depends on the system
ncurses version.

Invoking `tic` on `scripts/windows.ti` alone makes it use the system
terminfo definitions for the `use=…` fragments in `windows.ti` such as:

    use=xterm+256color, use=xterm+sl, use=xterm-new

This is particularly problematic on Debian, as they build ncurses with
`--with-xterm-kbs=del` [1], and thus some of the windows entries end up
with different definitions for `kTermKey_left`, which is almost
certainly not desired.

[1]: 2d238cf387/debian/rules (L149)

Solution:
This reverts commit 9f90992934.
2026-03-30 00:41:49 +01:00
Justin M. Keyes
ed822a085d build: version bump #38577 2026-03-29 19:37:04 -04:00
zeertzjq
33e17d66c6 vim-patch:9.2.0271: buffer underflow in vim_fgets() (#38575)
Problem:  buffer underflow in vim_fgets()
Solution: Ensure size is always greater than 1
          (Koda Reef)

3c0f8000e1

This currently never happens in Nvim.

Co-authored-by: Koda Reef <kodareef5@gmail.com>
2026-03-30 07:20:21 +08:00
Justin M. Keyes
844f2d2e13 ci(lintcommit): allow "NVIM vx.y.z" commit message #38563 2026-03-29 18:59:42 -04:00
Jan Edmund Lazo
83f0dd638c vim-patch:9.1.0327,9.2.0019 (#38567)
* vim-patch:9.2.0019: Hard to configure Vim according to full XDG spec

Problem:  Hard to configure Vim according to full XDG spec
Solution: Include the $VIMRUNTIME/xdg.vim script as an example.
          (Andrey Butirsky).

closes: vim/vim#19421

----

Nvim already supports XDG spec and provides 'stdpath()'.
runtime/xdg.vim is N/A.

----

4f04efb760

* vim-patch:9.1.0327: No support for using $XDG_CONFIG_HOME

Problem:  No support for using $XDG_CONFIG_HOME
Solution: optionally source $XDG_CONFIG_HOME/vim/vimrc
          (Luca Saccarola)

fixes: vim/vim#2034
closes: vim/vim#14182

---

test_xdg.vim can be applicable but it's a chore to swap "vimrc" with
"init.vim" and comment out gvimrc in all tests.
Nvim has enough XDG functional tests and runtime documentation.

Vim eventually rewrites the screendump tests such that
Nvim can run them in Unix-like systems.
It's possible to just port the latest version
and treat the older patches as N/A.

---

c9df1fb35a
2026-03-30 06:56:22 +08:00
Sean Dewar
8579946eda vim-patch:9.2.0254: w_locked can be bypassed when setting recursively
Problem:  w_locked can be bypassed when recursively set if not restored
          to its prior value.
Solution: Rather than save/restore everywhere, just make it a count,
          like other locks (Sean Dewar)

Requires the previous commit, otherwise b_nwindows will be wrong in
tests, which causes a bunch of weird failures.

closes: vim/vim#19728

7cb43f286e

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-03-29 23:49:24 +01:00
Sean Dewar
6617f85b76 vim-patch:9.2.0253: various issues with wrong b_nwindows after closing buffers
Problem:  close_buffer() callers incorrectly handle b_nwindows,
          especially after nasty autocmds, allowing it to go
          out-of-sync.  May lead to buffers that can't be unloaded, or
          buffers that are prematurely freed whilst displayed.
Solution: Modify close_buffer() and review its callers; let them
          decrement b_nwindows if it didn't unload the buffer.  Remove
          some now unneeded workarounds like 8.2.2354, 9.1.0143,
          9.1.0764, which didn't always work (Sean Dewar)

(endless yapping omitted)

related: vim/vim#19728

bf21df1c7b

b_nwindows = 0 change for free_all_mem() was already ported.

Originally Nvim returned true when b_nwindows was decremented before the end was
reached (to better indicate the decrement). That's not needed anymore, so just
return true only at the end, like Vim. (retval isn't used anywhere now anyways)

Set textlock for dict watchers at the end of close_buffer() to prevent them from
switching windows, as that can leave a window with a NULL buffer. (possible
before this PR, but the new assert catches it; added a test)

Despite textlock, things still aren't ideal, as watchers may observe the buffer
as unloaded and hidden (b_nwindows was decremented), yet still in a window...
Likewise, for Nvim, wipe_qf_buffer()'s comment may not be entirely accurate;
autocmds are blocked, but on_detach callbacks (textlocked) and dict watchers may
still run. Might be problematic, but those aren't new issues.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-03-29 23:49:24 +01:00
Sean Dewar
d539d6ac6e vim-patch:9.2.0252: Crash when ending Visual mode after curbuf was unloaded
Problem:  if close_buffer() in set_curbuf() unloads curbuf, NULL pointer
          accesses may occur from enter_buffer() calling
          end_visual_mode(), as curbuf is already abandoned and possibly
          unloaded.  Also, selection registers may not contain the
          selection with clipboard+=autoselect(plus).
Solution: Move close_buffer()'s end_visual_mode() call to buf_freeall(), after
          any autocmds that may restart it, but just before freeing anything
          (Sean Dewar)

related: vim/vim#19728

a8fdfd4fcb

Maybe this should be considered partial? clipboard+=autoselect isn't
implemented. If it is, we may need to update these comments to mention
TextYankPost being possible, and unskip its test.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-03-29 23:49:24 +01:00
zeertzjq
9c15a382de revert: "refactor(process): don't read from PTY master using uv_pipe_t" (#37401)
This reverts commit 75c8f75501.
2026-03-30 06:20:33 +08:00
Marcus Caisey
2eb14c54bc fix(lsp): highlight snippet preview when server can't completionItem/resolve (#38534)
Problem:
The snippet preview is not being highlighted by treesitter for
completion items from servers which don't support
`completionItem/resolve` (like gopls). This was broken by #38428.

Solution:
Call `update_popup_window` after updating the completion item with the
snippet preview.

I've added assertions to the `selecting an item triggers
completionItem/resolve + (snippet) preview` test case which covers the
snippet preview being shown since no tests failed when I removed the
`nvim__complete_set` call which actually populates the preview on this
codepath.
2026-03-29 14:48:11 -07:00
Justin M. Keyes
44d1f82fbf test: failing "treesitter.get_parser() returns nil for >= 0.12" 2026-03-29 18:50:37 +02:00
Justin M. Keyes
ce31b1faac version bump 2026-03-29 18:27:16 +02:00