Commit Graph
11468 Commits
Author SHA1 Message Date
Barrett Ruth 4ceb92cd76 feat(dir): open entries in splits with a, o mappings #41834 2026-09-11 19:01:41 -04:00
Justin M. Keyes a6d91a8d7c feat(multicursor): {Visual}[count]Q matches in Visual selection #41863
Problem:
`[count]Q` cannot be limited to a Visual selection.

Solution:
`{Visual}[count]Q` places cursors on matches within a Visual selection
(linewise).

TODO:
This works linewise, even if the visual selection is charwise/block. If
we really want to limit by charwise/block selection, then we should add
that feature to `seachpos()` or similar. Every caller of `seachpos()`
should not have to cobble together bespoke support thereof.
2026-09-11 10:30:53 -04:00
Justin M. Keyes fbe3a6131e fix(multicursor): {Visual}Q should not move primary cursor #41862
Problem:
`{Visual}Q` moves the primary to the top of the selection, for no
particular reason. And it's inconsistent with `[count]Q`.

Solution:
Keep the primary on the line where the selection ended, aligned to the
shared screen column so it still coincides with that line's cursor.
2026-09-11 09:22:46 -04:00
glepnir 2a344d8c84 fix(lsp): snippet is not expanded when resolve races the user #41774
Problem:
on_complete_done() defers clear_word() and the snippet expansion until
completionItem/resolve answers, and drops both when 'changedtick' moved
meanwhile. Typing right after accepting leaves the plain word in the
buffer.

Solution:
Expand before requesting, and anchor the resolved edits with an extmark
instead of gating them on 'changedtick'.
2026-09-11 07:49:57 -04:00
Barrett Ruth f5c4ef5c25 feat(lsp): support timeout_ms for async formatting #41850
Problem:
`vim.lsp.buf.format()` does not support a timeout for asynchronous
requests.

Solution:
Honor an explicit timeouts per client so formatting can continue.
Do not permit a default value for async format requests.
2026-09-11 05:25:33 -04:00
Barrett Ruth 4cad27fbcf feat(health): async healthchecks #41673
Problem:
:checkhealth blocks as healthchecks perform slow work.

Solution:
Partially fix it: run Lua healthchecks in vim.async tasks and await
vim.health subprocesses. Existing synchronous checks still block
until they leverage the new apis.
2026-09-11 01:52:54 -04:00
Justin M. Keyes 28ff47b8a4 fix(ui2): dialog messages offset by the pager line count #41839
Problem:
expand_msg() derives its start row from the pager buffer even when the
target is the cmd or dialog buffer, so the copied lines are appended
instead of replacing, and the copied extmarks are placed at pager rows in
a smaller buffer: "Invalid 'end_col': out of range", thrown inside a UI
event handler.

Solution:
Offset only when appending to a visible pager, and read the line count
after msg_clear(), whose autocmds may write to the pager. Copy marks with
`strict = false`, since the rows and columns are recomputed for a
different buffer and should clamp rather than raise.

AI-assisted
2026-09-11 01:01:16 -04:00
zeertzjqandMaxim Kim fcf32b8219 vim-patch:36d01cf: runtime(typst): do not highlight code blocks and raw text
Similar to markdown syntax, by default do not highlight raw and code blocks.

Syntax highlighting groups are still in place so it is possible for
users to add their own if needed.

- typstMarkupRawInline
- typstMarkupRawBlock

closes: vim/vim#21260

https://github.com/vim/vim/commit/36d01cff54addfe5352221bd39bff1d91af88623

Co-authored-by: Maxim Kim <habamax@gmail.com>
2026-09-11 08:57:59 +08:00
zeertzjqandHirohito Higashi 5bab388c47 vim-patch:71a0e7c: runtime(netrw): netrw#fs#Glob() cannot list a remote directory
Problem:  netrw#fs#Glob() calls s:NetrwRemoteListing() and uses
          s:THINLIST, which are script-local to autoload/netrw.vim and
          not visible in autoload/netrw/fs.vim.  Listing a remote
          directory in the tree view fails with E117 and E121.
Solution: Use netrw#Call() and netrw#Expose(), which exist to reach
          the script-local functions and variables of netrw.vim.

closes: vim/vim#21259

https://github.com/vim/vim/commit/71a0e7ca13b3c5a4c260bb43bbe602c26049f160

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-09-11 08:57:10 +08:00
zeertzjqand231tr0n 619d3ee5cf vim-patch:cbcb209: runtime(python): missing Python syntax keywords
Problem:  Missing newer Python keywords and builtins in syntax highlighting.
Solution: Add aiter, anext, BaseExceptionGroup, ExceptionGroup,
          PythonFinalizationError, and EncodingWarning to the Python
          syntax file (231tr0n).

closes: vim/vim#21254

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

Co-authored-by: 231tr0n <zeltronsrikar@gmail.com>
2026-09-11 08:56:58 +08:00
Lewis Russell 9dd0eeb6ea refactor(help): reuse help.lua to generate build tags
Make gen_helptags.lua call help.lua instead of keeping its own tag
parser. Builds and :helptags now use the same code.

Allow the shared code to run without Neovim, and fail the build when tag
generation reports an error.

AI-assisted
2026-09-10 20:05:49 +01:00
Lewis Russell 515c61f075 perf(fs): defer path joining in find()
Only join paths for matches and entries needed for traversal. This
avoids string processing for rejected files and improves selective
searches across the Neovim tree by about 19-25%.

AI-assisted
2026-09-10 14:57:10 +02:00
Lewis Russell d663d8f4b3 perf(help): generate helptags with LPeg
Problem: Generating helptags builds and queries a full vimdoc syntax
tree. This is much slower than the previous scanner and also happens
before discovering that the tags file cannot be written.

Solution: Extract tags with an LPeg grammar, reading each file once and
skipping example blocks and ordinary text. Open the output first so
unwritable directories can return immediately.

This restores legacy handling of tags inside inline code spans. On an
arm64 Mac, the 5.36 MB runtime corpus takes 24 ms instead of 604 ms,
with identical generated tags.

AI-assisted
2026-09-10 12:34:13 +01:00
zeertzjqandWu, Zhenyu b99d1b0a5a vim-patch:9.2.1052: filetype: evcxr history files are not recognized (#41797)
Problem:  filetype: evcxr history files are not recognized
Solution: Detect evcxr/history.txt as rust filetype (Wu, Zhenyu).

Reference:
https://github.com/evcxr/evcxr/blob/main/evcxr_repl/README.md

closes: vim/vim#21164

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

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2026-09-10 09:57:31 +00:00
Justin M. Keyes 8c292c96dd fix(autocmd): dot-repeat triggers InsertCharPre #41806
Problem:
InsertCharPre is triggered for stuffed text (".", i_CTRL-R, i_CTRL-A).
But that text was already transformed when it was typed: the `v:char`
result is appended to the redo buffer literally (`redo_append_lit()`).
So "." transforms it again, e.g. an autopair handler turns "()" into
"())".

Solution:
Skip InsertCharPre for stuffed text.

Precedent: `vgetorpeek()` disables abbreviations for stuffed text for
the same reason (it is post-expansion).

Macros are unaffected.
2026-09-10 05:57:03 -04:00
Lewis Russell d039f19af5 build: enable more EmmyLua checks
Enable checks for unused code, deprecated calls, return types, and
annotations.

Fix the warnings and replace the deprecated highlight function. Keep
exceptions where old APIs are still needed or the checker gets it wrong.

AI-assisted
2026-09-09 22:31:58 +01:00
glepnir 08dd3adffb feat(api): add ev.win to autocmd callback args #39826
Problem: Autocmd callbacks currently have to rely on curwin, which may
already have changed by the time they run. This is especially noticeable
for WinNew, WinClosed, WinResized and WinScrolled.

Solution: Track the window in the autocmd context and expose it as ev.win.
Pass it explicitly for the window events that need it.
2026-09-09 15:42:20 -04:00
Justin M. Keyes ac167f943a fix(terminal): check file timestamps on terminal-job exit #41814
Problem:
When a `:!` command runs, file timestamps are checked and W12 or
`FileChangedShell` is triggered. But not when a `:terminal` job exits.

Only `enter_buffer()` checks, so whether you get the W12 warning depends
on how you happen to return to the file: `:term` works, `:tabnew | term`
does not.

    echo foo > testfile
    nvim --clean testfile
    " Edit the buffer, don't save it.
    :!mv testfile testfile2
    :tabnew | term sh
    touch testfile2 && mv testfile2 testfile
    exit

'autoread' is defeated because `:!mv` deletes the file, so
`should_watch()` fails and the watcher stops. `ensure_watcher()` only
re-runs on `BufReadPost`/`BufWritePost`/`OptionSet`, so nothing watches
the file when the terminal moves it back.

Solution:
Set `need_check_timestamps` on terminal-job exit, same as `:!cmd`
(`os_shell`).
2026-09-09 15:14:26 -04:00
stenjaandJason Stenftenagel a55f134ee3 fix(lsp): stale client when rpc.connect fails #41792
Problem:
When vim.lsp.rpc.connect is used for an LSP and the connection fails
(due to ECONNREFUSED, for example), the LSP client is left
uninitialized. Subsequent calls to vim.lsp.start will reuse the
uninitialized client, but no new connection will be attempted.

Solution:
When vim.lsp.rpc.connect encounters a connection error, terminate the
client. This allows the user to do something in response to the failed
connection in the on_exit callback, and also makes it so subsequent
attempts to start the LSP will try to establish a new connection rather
than using the previous uninitialized client.

Co-authored-by: Jason Stenftenagel <jasonstenftenagel@gmail.com>
2026-09-09 13:31:26 -04:00
Justin M. Keyes d24cafc06a fix(multicursor): failed motion at primary is still cascaded #41812
Problem:
In follow-mode, a motion that fails at the primary cursor (e.g. "j" at
EOB) still cascades to other cursors, so they move while the primary
does not, which causes them to be deduplicated...

Also affects Visual sessions: "Vjd" at EOB deletes 1 line at the primary
but (potentially) 2 lines at every multicursor.

Solution:
If a motion "beeps", don't replay it.

"3w" near the end still replays (it moved), as does "0" at column
0 (does not beep). This feels like a usable and intuitive compromise.
2026-09-09 12:10:01 -04:00
Olivia Kinnear ec2c58ed26 docs: add help tag for vim.async 2026-09-09 15:50:38 +01:00
Volodymyr Chernetskyi 8e0045f43a feat(lsp): support workspace/foldingRange/refresh #41780
Problem:
Servers cannot request refreshing stale LSP folding ranges after a
project-wide change.

Solution:
Advertise `workspace.foldingRange.refreshSupport` and re-request folding
ranges for active buffers when handling `workspace/foldingRange/refresh`.

AI-assisted
2026-09-09 08:45:10 -04:00
glepnir 0a844adc13 fix(lsp): newlines in the completion word from insertText #41801
Problem:
A textEdit is cut to its first line but an insertText is not, so its
newlines reach the |complete-items| word.

Solution:
Cut it the same way.
2026-09-09 08:04:23 -04:00
Justin M. Keyes cb2e9cdfd3 fix(multicursor): clipboard=unnamed, explicit "+yy #41804
Problem:
- With `clipboard=unnamed[plus]`, per-cursor yanks are joined into '"'
  on exit, but not the clipboard.
- Multicursor `"+yy` calls the clipboard provider per-cursor, behaving
  as "last wins".

Solution:
- Never cascade to/from the clipboard provider.
- Implicit clipboard (`clipboard=unnamed[plus]`) uses the cursor-local
  unnamed register, so the cascade needs no `start_batch_changes()`. On
  exit, the clipboard gets the same joined result as the `"` register.
- Operations that reference the explicit clipboard registers `"+` / `"*`
  while multicursor is active, use the cached (primary) clipboard value.
2026-09-09 07:25:32 -04:00
Lewis Russell efdd73c096 feat(watch): add on_error callback
Problem: Watcher failures are reported inconsistently, and callers
cannot detect when a watcher is no longer usable.

Solution: Route startup and event failures and unexpected inotifywait
exits through an optional on_error callback. Log to nvim-watch.log by
default. Ignore disappearing child directories and exits caused by
cancellation. Let LSP log failures and notify once per message, using
INFO for missing roots and ERROR otherwise, without interrupting
registration.

AI-assisted
2026-09-09 11:39:57 +01:00
zeertzjqand231tr0n b7f9aceadd vim-patch:5867d1f: runtime(svelte): include svelte syntax script and syntax tests (#41796)
closes: vim/vim#21200

https://github.com/vim/vim/commit/5867d1f8eec240b104388f87545e3ee530c28b42

Co-authored-by: 231tr0n <zeltronsrikar@gmail.com>
2026-09-09 00:34:53 +00:00
Lewis Russell 6a54396db4 build: enable more EmmyLua checks
- call-non-callable
- missing-fields
- redefined-label
- redefined-local
- undefined-field
- unreachable-code

Promote redefined-local and unreachable-code to warnings.

Fix DOS line-ending handling for multiline semantic tokens, and support
intersection types in the help parser.

AI-assisted
2026-09-08 16:50:53 +01:00
zeertzjqandVrushali-Z e66fdc1eac vim-patch:9.2.1038: CursorLineFold/Sign highlighting depends on 'cursorlineopt' (#41785)
Problem:  CursorLineFold and CursorLineSign are only applied when
          'cursorlineopt' contains "number" or is "both"
          (Evgeni Chasnovski).
Solution: Apply those groups whenever 'cursorline' is set, independent
          of 'cursorlineopt' (Vrushali Zampalkar).

fixes:  vim/vim#20480
closes: vim/vim#21112

https://github.com/vim/vim/commit/1f8d3c44c5bd5a3d5032b3fc53e9d3aa1052583c

Co-authored-by: Vrushali-Z <zampalkarvasu@gmail.com>
2026-09-08 15:24:45 +00:00
zeertzjqandQiming zhao 3c9fe92e42 vim-patch:9.2.1045: runtime(netrw): raises E46 when changing directory fails (#41783)
Problem:  Netrw raises E46 when changing directory fails.
Solution: Remove unused assignments to the read-only directory argument
          and cover both error-handling branches with a regression test
          (Qiming zhao).

When :lcd fails with E472, s:NetrwLcd() assigns to a:newdir instead of
returning -1. The fallback assignment also refers to dirname, which is
undefined on this path. Neither assignment can update the caller's
directory variable. Keep the existing option restoration and failure
return while removing the invalid assignments.

Supported by AI.

closes: vim/vim#21226

https://github.com/vim/vim/commit/2f72e4c72f98a5760e2c783ab07f9865e91217a8

Co-authored-by: Qiming zhao <chemzqm@gmail.com>
2026-09-08 14:57:40 +00:00
zeertzjqandSPFab 94636bdff0 vim-patch:58ed368: runtime(org): Fix escape in formatlistpat (#41782)
The regex atom \| needs an extra escape for a :set command

closes: vim/vim#21214

https://github.com/vim/vim/commit/58ed368ab9645b527d388a5c4dbbc8e8bc6e7193

Co-authored-by: SPFab <42518661+SPFabGerman@users.noreply.github.com>
2026-09-08 14:28:46 +00:00
glepnir b3bd442c5c fix(lsp): completion dynamicRegistration breaks capability readers #41771
Problem:
A server that supports dynamic registration must not also declare
completionProvider at initialize, so server_capabilities.completionProvider
is nil for anything reading it directly.

Solution:
Do not advertise it by default. A client that follows a registration can
declare it itself.
2026-09-08 05:48:38 -04:00
Volodymyr Chernetskyi 8d5ebdf986 fix(lsp): announce typeHierarchy and executeCommand capabilities #41762
Problem:
Type hierarchy (#28388, #28467) and `workspace/executeCommand` (#11607) are
implemented, but `textDocument.typeHierarchy` and `workspace.executeCommand`
are missing from `make_client_capabilities()`.

Solution:
Declare both capabilities.

AI-assisted
2026-09-07 15:11:00 -04:00
Volodymyr Chernetskyi 9f425311c3 fix(lsp): semantic tokens ignore 'fileformat' when sizing line endings #41733
Problem:
The eol_offset used to decode multiline semantic tokens is computed as

    vim.bo.fileformat[bufnr] == 'dos' and 2 or 1

which indexes the option value rather than the buffer, so it is never
"dos" and the offset is always 1. A token that crosses a line boundary
in a 'fileformat' of "dos" is then decoded one code unit short per line
ending, and the highlight extends past the end of the token.

Solution:
Read the option with the buffer-scoped form, vim.bo[bufnr].fileformat.

The existing multiline test covers both formats now. Its token length of
82 counts the line endings it spans, so the same token reaches four
characters less far once the buffer is "dos".

AI-assisted
2026-09-07 12:47:48 -04:00
Volodymyr Chernetskyi ce5e230af8 fix(lsp): show_document() reports a failed buffer load #41731
Problem:
vim.lsp.util.show_document() can fail to load the target buffer, most
visibly with E325 when another process owns the file's swapfile and the
user declines to open it. The Vim error escapes show_document() and
surfaces inside whichever LSP handler called it, instead of being
reported as a failure to show the document.

Solution:
Load the buffer up front with vim.fn.bufload(), before any of that
state is touched, and report the error instead of raising.

AI-assisted
2026-09-07 16:21:11 +00:00
Lewis Russell 65ef6fdaee build: replace LuaLS with EmmyLua
Problem: LuaLS struggles with the generics used in Nvim's runtime,
requiring broad diagnostic suppressions. Indexing is also slow.

Solution: Use EmmyLua for type checks in the build and CI. It offers
more sophisticated type checking, substantially better support for
generics, and much better flow analysis.

Correct the affected annotations. Use `@internal`, supported directly by
EmmyLua, instead of `@nodoc` for shared internal declarations, and
support it in the help parser.

AI-assisted
2026-09-07 15:33:22 +01:00
Lewis Russell cd52c77cd5 fix(help): resolve generic and nullable type references
Problem: K on generic and nullable type annotations can jump to the
wrong help tag. Generated See references repeat the type names.

Solution: Strip generic arguments and nullable suffixes when resolving
help tags. Remove the redundant generated See references.

AI-assisted
2026-09-07 15:33:22 +01:00
glepnir 937f835a3e feat(lsp): support dynamic registration of completionProvider #41748
Problem:
dynamicRegistration is declared false, and completionProvider is read
from server_capabilities only.

Solution:
Declare it, and prefer registerOptions per field.
2026-09-07 09:53:35 -04:00
Lewis Russell fdf071959e perf(watch): prune excluded subtrees during setup
Problem:
The LSP client excludes paths such as Git objects and installed
dependencies from file watching. However, watchdirs() still traverses
these subtrees before filtering which directories receive watchers,
paying the filesystem and Lua traversal cost for excluded content.

Solution:
Prune excluded subdirectories during the initial walk, and document
that excluding a directory also excludes its descendants.

Using the LSP client's existing **/node_modules/*/** exclusion on a
synthetic macOS tree with 100 installed packages and 4,000 files:
                     Before  After
  Directory scans       503    103
  Entries inspected    4502    202
  Directory watchers    103    103

The measurements use real filesystem calls and watcher handles, with
identical watcher paths for this exclusion.

Ref: #23291

AI-assisted
2026-09-07 13:30:57 +01:00
Volodymyr Chernetskyi a31f9affde fix(msgpack): strptime() fails east of UTC+12 #41743
Problem:
msgpack#strptime() finds a timestamp by bisecting strftime() output, and
brackets the search with the extreme UTC offsets. The lower bound
subtracts 12 hours, but -12:00 is the westernmost offset, which produces
the *largest* timestamp for a given local time. The easternmost offset
is +14:00, so in any zone east of UTC+12 the search can start above the
target and the function throws:

    internal-start-string:Internal error: start > string

With TZ=GMT-14, four of the five timestamps in msgpack_spec.lua fail,
as do three tests in shada_spec.lua, which reaches the same function
through shada#strings_to_sd().

Solution:
Subtract 14 hours instead. The upper bound is already generous enough at
+14, and widening a bisection bracket downwards cannot change the result
in zones that worked before.

The test disables the python3 provider, because msgpack#strptime() only
uses the Vimscript implementation changed here when no provider answers,
and otherwise hands the work to datetime.strptime().

AI-assisted
2026-09-07 08:24:16 -04:00
Justin M. Keyes 1c8d5581d9 Merge #41118 from altermo/optwin-tab-scope
optwin.lua improvements
2026-09-07 08:20:24 -04:00
zeertzjq 4d1793a106 Merge pull request #41717 from janlazo/vim-0ed11ba
vim-patch:9.1.1429,{0ed11ba,57d6d00}
2026-09-07 20:08:06 +08:00
Lewis Russell 80c2181ce9 refactor(pack): use vim.async
Problem: vim.pack uses a private async implementation even though
vim.async is now available.

Solution: Remove the private implementation and run plugin operations in
structured task scopes. Bound parallel work with semaphores and use
protected awaits so cancellation still propagates.

AI-assisted
2026-09-07 10:53:56 +01:00
altermo ec957ffd8c refactor(optwin): use current window as fallback 2026-09-07 11:05:19 +02:00
altermo 9975b73dfb fix(optwin): handle tabpage local options 2026-09-07 11:05:19 +02:00
b222398553 vim-patch:57d6d00: runtime(doc): Add documentation style
closes: vim/vim#17627

https://github.com/vim/vim/commit/57d6d004331f1770b5f04ba28ac242c0e0c8a005

Co-authored-by: Damien Lejay <damien@lejay.be>
Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
2026-09-06 23:57:11 -04:00
Jan Edmund LazoandHirohito Higashi 594381d758 vim-patch:0ed11ba: runtime(doc): Tweak documentation style a bit
https://github.com/vim/vim/commit/0ed11ba223ec69dfefc8cc5800fb3e0d610fd9f8

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2026-09-06 23:56:32 -04:00
zeertzjqandDawid Dziurla 31626aed41 vim-patch:a96c3bc: runtime(robot): Include ftplugin and set comment options
Set 'comments' and 'commentstring' for Robot Framework files.

closes: vim/vim#21220

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

Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
2026-09-07 08:05:11 +08:00
zeertzjqandDoug Kearns 87ef6ad92b vim-patch:d53f436: runtime(gdb): Update syntax for GDB 17
closes: vim/vim#21219

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

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-09-07 08:05:11 +08:00
zeertzjqandQiming zhao 1e92632c1f vim-patch:22b72dc: runtime(spup): fix E92 in syntax script
Problem:  Spup syntax fails for an out-of-range comment mode.
Solution: Add the missing let to the fallback assignment (Qiming zhao).

Setting oneline_comments above 3 raises E492 while loading the syntax
script. Use a valid legacy Vim script assignment to restore the default
value of 2.

Validated with oneline_comments set to 1, 2, 3, 4 and 99, and with the
variable unset. The original script fails with E492 for a value of 4.
The corrected script loads and applies the expected comment mode.

closes: vim/vim#21227

Supported by AI.

https://github.com/vim/vim/commit/22b72dca7e6240d3b54ed85084904dc61503da7c

Co-authored-by: Qiming zhao <chemzqm@gmail.com>
2026-09-07 08:05:11 +08:00
zeertzjqandYegappan Lakshmanan 797171f45f vim-patch:ca2e65a: runtime(doc): Update quickfix help text with missing information
closes: vim/vim#21229

Supported by AI.

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

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-09-07 08:05:09 +08:00