Commit Graph

35552 Commits

Author SHA1 Message Date
zeertzjq
c4fdd3b072 vim-patch:9148644: runtime(env): add ftplugin for env filetype (#38098)
Patch 9.2.0033 (vim/vim#19260) introduced a dedicated `env` filetype for
.env files, which were previously detected as `sh`. This left env
files without `commentstring`, `comments`, or `formatoptions` since
no ftplugin was added alongside the new filetype.

Add runtime/ftplugin/env.vim to set these options, matching the
behavior that .env files had when they used the `sh` filetype.

closes: vim/vim#19522

9148644c1e

Co-authored-by: snelling-a <72226000+snelling-a@users.noreply.github.com>
2026-02-28 08:00:17 +08:00
zeertzjq
3e128cd798 Merge pull request #38099 from zeertzjq/vim-9.1.0535
vim-patch:9.1.{0535,0539},9.2.0070
2026-02-28 07:46:36 +08:00
zeertzjq
cd4c7850d0 vim-patch:9.2.0070: tests: various tests leave swapfiles around
Problem:  tests: various tests leave swapfiles around
Solution: close open buffers using :bw! instead of :close!

2fa34b6422

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 07:06:44 +08:00
zeertzjq
6ce964aed6 vim-patch:9.1.0539: Not enough tests for what v9.1.0535 fixed
Problem:  Not enough tests for what v9.1.0535 fixed
Solution: Add another test for ex-mode

This comes from: https://groups.google.com/g/vim_dev/c/F5-tDqoafz8/m/GqKF-uQsLD0J

related: vim/vim#15120

248efab9b5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-02-28 07:04:49 +08:00
zeertzjq
453dfbf7d6 vim-patch:9.1.0535: newline escape wrong in ex mode
Problem:  newline escape wrong in ex mode (Konrad Schwarz)
Solution: partly revert patch 7.3.014, remove backslash in front of a
          newline when not in prompt mode in ex line mode
          (Mohamed Akram)

This fixes newline escaping to allow passing multiple commands to
":global", multiple lines to shell commands, and ending lines in append
mode with backslashes. This should fix a POSIX/(traditional) VI
incompatiblity.

This reverts a previous incorrect attempt at patch v7.3.014 to fix
append mode which removed half of trailing backslashes which lead to,
eg. the following two commands being parsed as having a different number
of backslashes:

```
!echo foo\\\
```

```
!echo foo\\ \
```

fixes: vim/vim#6135
fixes: vim/vim#7244
closes: vim/vim#15120

f3daa4525b

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2026-02-28 07:04:08 +08:00
Yochem van Rosmalen
4a4de73043 fix(help): better align local-additions #38097
Problem:
Descriptions of plugins often contain taglinks which are generally
concealed. This misaligns them by 2 characters with descriptions that
don't have a taglink in them.

Solution:
Don't count "bar" characters (`|`) for the description width.

Example:

Actual buffer content:
```
myplugin.txt                  |lsp| is cool
myplugin.txt        this is a nice plugin
```

Rendered as:
```
myplugin.txt                  lsp is cool
myplugin.txt        this is a nice plugin
```
2026-02-27 17:50:51 -05:00
Yochem van Rosmalen
dc5d313d66 fix(vim.fs): joinpath() should ignore empty items #38077
Problem:
vim.fs.joinpath treats empty string as a path segment
(it adds a path separator for each empty item):

    print(vim.fs.joinpath('', 'after/lsp', '')) -- '/after/lsp/'
    print(vim.fs.joinpath('', '')) -- '/'

Especially problematic if the empty segment is the first segment, as
that converts the path to an absolute path.

Solution:
Ignore empty (length of 0) path segments.

Benchmark:

    local function test(func)
      local t = vim.uv.hrtime()
      for _ = 1, 100000, 1 do
        func('', 'this/is', 'a/very/long/path', '', 'it', 'really', 'is')
      end
      print(math.floor((vim.uv.hrtime() - t) / 1e6), 'ms')
    end

- with Iter():filter() --> 370 ms
- building new segments table --> 208 ms
- with vim.tbl_filter --> 232 ms
- Instead of gsub split on `/` in all parts --> 1870 ms
2026-02-27 17:45:07 -05:00
dependabot[bot]
4747975754 ci: bump actions/download-artifact from 7 to 8
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 14:04:49 +01:00
bfredl
044300b72c Merge pull request #38074 from bfredl/mapfix
fix(map): use names like Map_key_value not Map_keyvalue
2026-02-27 13:58:04 +01:00
dependabot[bot]
64fabe64e5 ci: bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 13:51:05 +01:00
Riccardo Mazzarini
2368a9edbd feat(terminal): support SGR dim, overline attributes #37997
Problem:
libvterm doesn't support parsing the dim and overline attributes, so when a program running in the embedded terminal emits one of these escape codes, we ignore it and don't surface it to the outer terminal.

Solution: tweak libvterm to add support for both attributes.
2026-02-27 11:46:22 +00:00
bfredl
84d3bbef23 fix(map): use names like Map_key_value not Map_keyvalue
This makes little difference in practice except for extremely unlikely
ambiguities. But it looks nicer in compiler errors and stacktraces where
you see the fully expanded names
2026-02-27 11:47:07 +01:00
Kyle
5cbb9d613b fix(startup): wait for bg detection before user config #37075
Problem:
Automatic background detection sets the background option too late,
which loads colorschemes twice and causes problems when the user's
terminal background doesn't match the default (#32109, #36211, #36416).

Solution:
Use a DA1 query to determine whether the TTY supports OSC 11. Wait for
background detection and setting to complete before processing user
config.

Note: To preserve the existing behavior as much as possible, this triggers
OptionSet manually on VimEnter (since it won't trigger automatically if
we set bg during startup). However, I'm unsure if this behavior is
truly desired given that the documentation says OptionSet is triggered
"After setting an option (except during |startup|)."

Also fixes flickering issue #28667. To check for flickering:

    nvim --clean --cmd "set termguicolors" --cmd "echo \"foo\"" --cmd "sleep 10"

On master, this gives me a black screen for 10 seconds, but on this
branch, the background is dark or light depending on the terminal
background (since the option is now set during startup rather than after
VimEnter).
2026-02-27 04:52:52 -05:00
glepnir
f45c550f4e fix(restart): drop "-s <scriptfile>" from v:argv on :restart #38058
Problem: When nvim is started with "-s -" (read from stdin), ":restart"
drops the "-" argument but keeps "-s", leaving an orphaned "-s" in the
restarted server's argv, causing a crash.

Solution: Drop "-s" and its scriptfile argument when copying v:argv for
the restarted server. Like "-- [files…]", the scriptfile is a one-shot
startup input that should not be replayed on restart
2026-02-27 04:30:45 -05:00
Christian Clason
acf8103199 build(deps): bump luajit to a553b3de2 2026-02-27 09:49:58 +01:00
zeertzjq
18c5f06c9f vim-patch:partial:9.2.0068: Inefficient use of list_append_string() (#38083)
Problem:  Inefficient use of list_append_string()
Solution: Pass string length to list_append_string() where it is known
          (John Marriott).

closes: vim/vim#19491

455d62e38a

N/A patches:
vim-patch:9.2.0063: memory leak in type_name_list_or_dict()
vim-patch:9.2.0065: memory leak in invoke_sync_listeners()
vim-patch:9.2.0066: memory leak in build_drop_cmd()
vim-patch:9.2.0067: memory leak in dict_extend_func()

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-02-27 07:32:08 +08:00
Christian Clason
6435c61bd6 build(deps): bump tree-sitter-markdown to v0.5.3 2026-02-26 19:26:35 +01:00
Christian Clason
d94c29114e build(deps): bump tree-sitter-lua to v0.5.0 2026-02-26 19:26:35 +01:00
Christian Clason
37ce3d6261 build(deps): bump tree-sitter-vim to v0.8.1 2026-02-26 19:26:35 +01:00
Riccardo Mazzarini
ea5007b37f fix(lps): separate namespaces for pull/push diagnostics #37938
Problem:
Regression from b99cdd0:
Pull diagnostics (from `textDocument/diagnostic`) and push diagnostics
(from `textDocument/publishDiagnostics`) use the same namespace, which
is a problem when using language servers that publish two different sets
of diagnostics on push vs pull, like rust-analyzer (see
https://github.com/rust-lang/rust-analyzer/issues/18709#issuecomment-2551394047).

Solution:
Rename `is_pull` to `pull_id` which accepts a pull namespace instead of
just a boolean.
2026-02-26 12:05:30 -05:00
zeertzjq
7852993f49 vim-patch:9.2.0061: Not possible to know when a session will be loaded (#38071)
Problem:  Not possible to know when a session will be loaded.
Solution: Add the SessionLoadPre autocommand (Colin Kennedy).

fixes:  vim/vim#19084
closes: vim/vim#19306

1c0d468d72

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2026-02-26 21:30:44 +08:00
zeertzjq
34b3bd1ac5 test(treesitter/fold_spec): fix flaky test (#38075) 2026-02-26 21:28:52 +08:00
luukvbaal
e63346dfe9 fix(messages): reset redirection message column at message start #38068
Problem:  Leading message newlines (not emitted with ext_messages since
          4260f73) were responsible for resetting the redirection message
          column (while the newline itself is later pruned...).
Solution: Ensure the redirection column is reset at the start of a message.
          (Instead of re-adjusting all the newline callsites which can
          themselves hopefully be pruned if ext_messages is enabled by
          default.)
2026-02-26 07:45:33 -05:00
bfredl
8f1c161d9d Merge pull request #38040 from bfredl/seenfix
fix(marktree): fix edge case bug regarding changing intersections
2026-02-26 12:49:29 +01:00
bfredl
37c0efb21c fix(marktree): fix edge case bug regarding changing intersections
fix #37867

This bug happens when only one end is moved between different nodes,
but the other end is also moved but within the same node.
When this happens we need the correct previous position even for the
internal move. This code shall be refactored to make the intent clearer,
(and avoid some unnecessary processing) but this is a fix for the observable
bug.

Thanks to KevinGoodsell for providing a deterministic
reproduce using fuzzing techniques.
2026-02-26 10:30:41 +01:00
bfredl
3a4a7a7efb Merge pull request #37722 from bfredl/fastpackadd
perf(runtime): hardware accelerated "packadd opt_package"
2026-02-26 10:29:49 +01:00
github-actions[bot]
be8969f4cc docs: update version.c (#38053)
vim-patch:9.2.0001: tests: Test_popup_setbuf() fails
vim-patch:9.2.0047: Vim9: Comment parsing error with lambda
vim-patch:9.2.0052: Wayland: hiding lower half of command line in tiny vim

Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-02-26 12:02:20 +08:00
anondeveg
6ba32713ad feat(secure): allow 'path' parameter for trust action 'allow' (#38001) 2026-02-25 20:55:05 -06:00
zeertzjq
e86ccdbeae test: remove remaining use of feed_command() in terminal/ (#38069)
Also deduplicate screen lines in some other tests.
2026-02-26 10:06:34 +08:00
zeertzjq
1fe1b2525f vim-patch:9.2.0054: eval_addblob() is inefficient (#38067)
Problem:  eval_addblob() is inefficient
Solution: Replace per-byte ga_append() loop with a single ga_grow() and
          mch_memmove() for each source blob.  This eliminates N grow
          checks and function call overhead for blob concatenation
          (Yasuhiro Matsumoto).

closes: vim/vim#19494

c389ae8c44

Omit the pointless int -> long changes in other functions.

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-02-26 08:15:57 +08:00
zeertzjq
9288357d59 vim-patch:9.2.0055: memory leak in ExpandFromContext() (#38066)
Problem:  memory leak in ExpandFromContext()
Solution: Free the variable (Huihui Huang).

fixes:  vim/vim#19500
closes: vim/vim#19505

9c3279ddc3

N/A patches:
vim-patch:9.2.0056: memory leak in ex_substitute
vim-patch:9.2.0057: memory leak in exe_newdict()
vim-patch:9.2.0058: Compile error in did_set_previewpopup()
vim-patch:9.2.0059: memory leak in fill_assert_error

Co-authored-by: Huihui Huang <625173@qq.com>
2026-02-26 00:04:34 +00:00
Mathias Fußenegger
583308f599 fix(diagnostic): handle stale diagnostic extmark ids #38060
Problem:
If a server is slow with catching up, there can be stale diagnostics
for deleted lines. Then if a user uses `jump` it can error like:

    E5108: Lua: ...runtime/lua/vim/diagnostic.lua:670: attempt to index a nil value
    stack traceback:
            ...runtime/lua/vim/diagnostic.lua:670: in function 'get_logical_pos'
            ...runtime/lua/vim/diagnostic.lua:687: in function 'diagnostic_lines'
            ...runtime/lua/vim/diagnostic.lua:1122: in function 'next_diagnostic'
            ...runtime/lua/vim/diagnostic.lua:1665: in function 'jump'

Solution:
Fallback to diagnostic location. That's better than the failure.
2026-02-25 13:26:56 -05:00
luukvbaal
4ef217e272 fix(ui2): leftover empty lines in msg window #38059
Problem:  Timer removing a message from the msg buffer does not remove
          empty lines if window is closed (col([ui.wins.msg]) fails).
Solution: Use nvim_buf_get_text() to check if line is empty.
2026-02-25 13:21:30 -05:00
Justin M. Keyes
c0f8b3fb66 refactor(test): simplify v:argf tests #38055 2026-02-25 13:06:53 -05:00
zeertzjq
1983c70d10 test(lsp): flaky lsp/semantic_tokens_spec #38063
The wait added in #37853 doesn't seem to do anything as request is sent
immediately on InsertLeave, and the number 4 also seems wrong. Instead,
the actual cause for the flakiness that the feed() (and hence the buffer
change) may arrive before the scheduled initialization of capabilities,
causing there be only only one textDocument/semanticTokens/full request
instead of two.
2026-02-25 13:04:31 -05:00
Christian Clason
44429b4d96 build(deps): bump wasmtime to v36.0.6 2026-02-25 18:32:39 +01:00
Christian Clason
88ff4f1ac3 build(deps): bump tree-sitter to v0.26.6 2026-02-25 18:32:39 +01:00
Christian Clason
39769b4ac2 build(deps): bump luajit to fc3d17eb4 2026-02-25 11:04:51 +01:00
bfredl
3aa04f7ee4 perf(runtime): hardware accelerated "packadd opt_package"
fixes #37586

when doing `packadd mypackage` up to two exact paths are added
to &rtp. Instead of recalculating runtime_search_path from scratch,
we can "just" splice these two paths in

This is simple in theory, but get complicated in practice as
"after" dirs do exist and need some wrangling.

Echasnovski did some benchmarking, to show that this reduces overhead
of a init.lua configuration style where separate `packadd!` calls are
used spread out during the config. In addition, "batched" addition
(either using "start" packages or packadd! a lot of opt packages at
once) does not regress.

A theoretical simplification could be to NEVER explicitly add "after"
dirs to &rtp, but implicitly add all existing "after" dirs in reverse
order when calculating the effective run time path. This might be tricky
to do without breaking 12 tpope plugins again tho.

We might also instead consider solutions where &rtp remains fully expanded but no longer is the main source of truth. But this is all post 0.12 work. This PR is an alright stopgap to make 0.12 fully support intended use cases of vim.pack.add() .
2026-02-25 09:39:54 +01:00
Sanzhar Kuandyk
cf874cee33 feat(startup): provide v:argf for file arguments #35889
Problem:
- `:args` and `argv()` can change after startup.
- `v:arg` includes options/commands, not just files.
- Plugins (e.g. Oil) may rewrite directory args.

Solution:
- New read-only var `v:argf`: snapshot of file/dir args at startup.
- Unaffected by `:args` or plugins.
- Unlike `v:argv`, excludes options/commands.
- Paths are resolved to absolute paths when possible

Example:

    nvim file1.txt dir1 file2.txt
    :echo v:argf
    " ['/home/user/project/file1.txt', '/home/user/project/dir1', '/home/user/project/file2.txt']
2026-02-25 03:38:08 -05:00
zeertzjq
6d73bf4886 vim-patch:29b5938: runtime(sshconfig): Add 3 additional keywords to syntax script (#38050)
closes: vim/vim#19488

29b5938d79

Co-authored-by: James Roberts-Thomson <jamesrt@gmail.com>
2026-02-25 08:09:09 +08:00
zeertzjq
327dcb8970 vim-patch:9.2.0046: filetype: neon files are not recoginzed (#38049)
Problem:  filetype: neon files are not recoginzed
Solution: Detect *.neon files as neon filetype
          (przepompownia)

Reference:
https://doc.nette.org/en/neon/format
https://github.com/fpob/nette.vim

closes: vim/vim#19496

ddd90672f2

Co-authored-by: przepompownia <przepompownia@users.noreply.github.com>
2026-02-25 07:53:43 +08:00
luukvbaal
844caca881 fix(ui2): multiline/color replaced message, expanded cmdline, error messages #38044
Problem:  - Unintentionally inserting lines for a replaced multiline
          message that also has multiple highlights.
          - Scheduled check to see if the expanded cmdline window was
          entered makes it difficult to keep track of what happens when
          the key pressed to dismiss it results in a message.
          - Reading the first line of an error message should be enough
          notice for something going wrong.
          - "search_cmd" messages should not be shown with 0 'cmdheight'.
          - Unable to configure dynamically changed pager height.
          - Enabling UI2 doesn't make sense with no UIs attached.

Solution: - Only insert a line for the first chunk after a newline.
          - Use getmousepos() to check if the expanded cmdline was
          clicked to enter the pager.
          entering the pager to serve as a configuration interface.
          - Don't expand the cmdline for error messages; user can press g<.
          - Don't show "search_cmd" messages with 'cmdheight' set to 0.
          - Change 'eventignorewin' to ensure WinEnter is fired when
          - Have enable() return early when no UIs are attached.
2026-02-24 17:05:38 -05:00
phanium
16aab4cb48 fix(treesitter): InspectTree only show the largest injection #37906
Problem:
:InspectTree don't show luadoc injection lua file. Since luadoc share
the same "root" with comment in their common primary (lua) tree.
Current logic simply show the largest (comment injection) and ignore all
smaller one (luadoc injection).

Solution:
Handle different lang injections separately. Then sort them by
byte_length to ensure the draw tree consistent.
2026-02-24 16:22:30 -05:00
luukvbaal
39c4e0f336 fix(messages): unwanted ext_messages newlines for confirm() #38045
Problem:  Newlines emitted with ext_messages intended to position
          the message/prompt on the message grid.
Solution: Don't emit these newlines with ext_messages, followup to 4260f73e.
2026-02-24 13:01:31 -05:00
glepnir
3115a18a80 refactor(test): lsp completion spec cleanup #38041
Problem: retry/feed/tbl_map patterns duplicated everywhere, detach check was a false negative

Solution: extract wait_for_pum/extract_word_abbr/word_sorter helpers,
fix assert_cleanup_after_detach with positive+negative pum confirmation
2026-02-24 09:20:58 -05:00
glepnir
5eb1c4df54 refactor(test): avoid deprecated functions #37017
Problem:
Tests are using some deprecated functions.

Solution:
Replace with command, pcall_err, etc.
2026-02-24 07:15:24 -05:00
github-actions[bot]
5d6846c389 docs: update version.c #37962
vim-patch:9.1.0001: tests: Test_popup_setbuf() fails
vim-patch:9.2.0018: high cpu usage with Wayland compositor
vim-patch:472f46e23 README.md: mention r/vim and #vim libera
vim-patch:dbd924f6a runtime(syntax-tests): Fail when executable syntax tests are found
vim-patch:70a9273dc Filelist: Fix CI error caused by xdg.vim missing in Filelist
vim-patch:405ba5010 runtime(doctags): remove unused header include file
vim-patch:47eb32fc9 translation(zh): Update menu translation for changed "Sponsor" entry
vim-patch:9.2.0038: Wayland: Not using bool type
vim-patch:a99dcca17 Maintainers: Update MAINTAINERS file
vim-patch:7b7a6f941 Add information for runtime files in the bug template.
vim-patch:9b16aa34b CI: Avoid referencing the unstable ddebs.ubuntu.com/noble-proposed mirror
vim-patch:9.2.0044: Wayland: still performance issues

Co-authored-by: marvim <marvim@users.noreply.github.com>
2026-02-24 03:40:03 -05:00
Oleksandr Chekhovskyi
d9d8c660fd fix(watch): invalid joined path #37973
Problem:
When vim._watch.watch() is used to watch a single file, libuv returns
the basename as the filename argument in the callback. The code joins
this with the watched path, producing a nonsensical path like
"/path/to/file.lua/file.lua", which causes ENOTDIR errors on
subsequent fs_stat calls.

Solution:
Check whether the watched path is a directory before joining the
filename. When watching a file, ignore the filename from libuv and
use the watched path directly.
2026-02-23 17:33:13 -05:00
Yochem van Rosmalen
b57ed5e940 refactor(gen): let Hugo build html docs #37972
Problem:
The html and css of the website's documentation pages are defined in
long strings in gen_help_html.lua, making it hard to maintain and
improve them. E.g. adding in headers that state the documentation is for
nightly Nvim has been a long standing feature request.

Solution:
Move the inlined css and html (e.g. the <head>, <nav>, etc.) to Hugo.

Now that the website is build with Hugo, we can use its templating
system to generate the full html/css from the Tree-sitter tree:
https://github.com/neovim/neovim.github.io/pull/437
2026-02-23 17:26:27 -05:00