Commit Graph

4789 Commits

Author SHA1 Message Date
bfredl
49dc3d9424 build(zig): run oldtests in zig builds with new lua runner
The new lua based runner replaces Makefile, runnvim.sh and runnvim.vim

As it happens, we run a `--headless` nvim inside a `:terminal` layer,
this is pointless.
Also there is still a lot remnants for oldesttests, but we don't
have any except for test1.in which just checks the environment
for following, nonexistant oldesttests. so just skip that.

For now, the actual vimscript code which runs in vim-under-test is
completely unchanged.

On macos, luajit is finally working with the latest ziglua master.
Also fix some minor bugs regarding locales, such as incorrect
HAVE_WORKING_LIBINTL checks
2026-06-02 11:12:11 +02:00
zeertzjq
edcaf1887a vim-patch:partial:9.2.0573: Vim9: missing EX_WHOLE on some block keywords (#40071)
Problem:  Several Vim9 keywords lack EX_WHOLE and can be shortened in
          Vim9 script, inconsistent with endif/enddef/endfor/endwhile/
          endtry which already have it.  The error from :endd in a
          nested function also hardcodes "enddef" instead of reporting
          what the user typed.  fullcommand("ho") returns "horizontal"
          even though :ho is below the documented 3-char minimum.
Solution: Add EX_WHOLE to :class, :def, :endclass, :endinterface,
          :endenum, :public and :static.  In get_function_body() pass
          the user-typed command to the error message.  Force :ho to
          CMD_SIZE in find_ex_command() so fullcommand() reflects the
          modifier minimum.  Extend tests and documentation accordingly
          (Peter Kenny).

fixes:  vim/vim#20032
closes: vim/vim#20191

38d9a16eba

Co-authored-by: Peter Kenny <github.com@k1w1.cyou>
2026-06-01 01:04:30 +00:00
Justin M. Keyes
f5fae7aa5c docs: misc, options, pos/range 2026-05-30 12:57:24 +02:00
Justin M. Keyes
88f3f0eeec fix(health): sort "Active Features" by name 2026-05-30 12:57:24 +02:00
zeertzjq
37abcdd044 vim-patch:9.2.0562: filetype: SGF files are not recognized
Problem:  filetype: SGF files are not recognized
Solution: Detect *.sgf as sgf filetype
          (Borys Lykah)

Reference:
https://www.red-bean.com/sgf/index.html

closes: vim/vim#20349

dda45ba88f

Co-authored-by: Borys Lykah <lykahb@fastmail.com>
2026-05-30 11:49:08 +08:00
zeertzjq
8b5a8c12cd vim-patch:9.2.0560: filetype: busybox shebang lines are not recognized
Problem:  filetype: busybox shebang lines are not recognized
Solution: Add filetype detection pattern for #!busybox sh, detect
          ash as shell in the shebang lines (Christoffer Aasted).

closes: vim/vim#20358

69f402e97f

Co-authored-by: Christoffer Aasted <dezzadk@gmail.com>
2026-05-30 11:41:23 +08:00
zeertzjq
06c7859220 vim-patch:9.2.0559: filetype: Kaitai struct files are not recogonized
Problem:  filetype: Kaitai struct files are not recogonized
Solution: Detect *.ksy files as yaml filetype (Wu, Zhenyu)

Reference:
https://doc.kaitai.io/

closes: vim/vim#20353

73e619d699

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2026-05-30 11:38:58 +08:00
zeertzjq
915fd47601 vim-patch:9.2.0558: filetype: Popcap Reanimation files are not recognized
Problem:  filetype: Popcap Reanimation files are not recognized
Solution: Recognize *.reanim files as xml filetype (Wu, Zhenyu).

Reference:
https://github.com/wszqkzqk/PvZ-Portable

closes: vim/vim#20354

c83d2f888e

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2026-05-30 11:37:01 +08:00
zeertzjq
75a1e1a848 vim-patch:9.2.0557: filetype: Kawasaki Robots files are not recognized
Problem:  filetype: Kawasaki Robots files are not recognized
Solution: Detect *.pg as kawasaki_as filetype, add filetype detection
          for *.as as atlas or kawasaki_as filetype (KnoP-01).

In Kawasaki robots (https://kawasakirobotics.com/products-robots/)
AS language

*.pg is the extention for a program file and
*.as is for a complete backup.

closes: vim/vim#20370

dec3d6c7da

Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
2026-05-30 11:34:48 +08:00
Olivia Kinnear
e728c100b5 feat(lua): support table lhs in vim.keymap.set()/del() #39948
Problem:
It is repetitive to map multiple keymaps to do the same thing. Here are some
cases where being able to do this would be useful:

    -- Visual movement for both j/k and down/up:
    vim.keymap.set({ 'n', 'x' }, { 'j', '<Down>' }, 'v:count == 0 ? "gj" : "j"', { expr = true })
    vim.keymap.set({ 'n', 'x' }, { 'k', '<Up>' }, 'v:count == 0 ? "gk" : "k"', { expr = true })
    -- Map multiple keys to `<Nop>` concisely:
    vim.keymap.set({ 'n', 'x' }, { '<Leader>', '<Localleader>', '<CR>' }, '<Nop>')
    -- Remove multiple keymaps at once:
    vim.keymap.del('n', { 'gri', 'grn', 'grr' })

Solution:
Support the `lhs` of `vim.keymap.set()` and `vim.keymap.del()` being a table, in
the same way that `modes` can be.
2026-05-29 14:45:33 -04:00
abdulahmoda
4b5f026ac9 fix(vim.fs): fs.dir() may return nil "type" on some filesystems #39749
Problem:
Currently, only some filesystems (Btrfs, ext2, ext3, ext4) have full
support of accessing the `dirent` entry-type. On other filesystems,
`uv.fs_scandir_next` may return `nil` for an existing but unsupported
entry-type.

This means consumers (such as `fs.dir()`), cannot know if `nil` means
"non-existent" or "unsupported".

Solution:
Fall back to `uv.fs_lstat` when `etype` is `nil`; return "unknown" if it
fails.
2026-05-29 14:24:22 -04:00
atusy
ac352a6df6 docs(treesitter): describe pattern_id of captures 2026-05-29 13:09:29 +02:00
zeertzjq
df1f8a60cf vim-patch:9.2.0551: filetype: Tolk files are not recognized
Problem:  filetype: Tolk files are not recognized
Solution: Detect *.tolk files as tolk filetype, include a syntax and
          filetype plugin (redavy)

Tolk is a new-generation language for writing smart contracts on TON
blockchain, which is vim/vim#1 in speed among other chains.

Reference:
https://docs.ton.org/blockchain-basics/tolk/overview

closes: vim/vim#20320

b9bba99712

Co-authored-by: redavy <hello.redavy@proton.me>
2026-05-29 09:06:12 +08:00
Yi Ming
5d85669a33 refactor: rename vim.transport to vim.net.transport #40021 2026-05-28 10:37:45 -04:00
Puneet Dixit
5acb2a1d33 docs(lsp): document on_list deduplication #39941
Problem:
Deduplicating LSP locations in the default handler changes list behavior for every user, while some configurations may intentionally return matching locations from multiple clients.

Solution:
Document how users can deduplicate locations in an on_list handler with vim.list.unique().

Co-authored-by: Deepak kudi <deepakkudi23@adsl-172-10-9-116.dsl.sndg02.sbcglobal.net>
Co-authored-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
2026-05-27 10:21:45 -04:00
luukvbaal
cad5a4cf5c fix(lsp): unwanted redraw for buffer not in window #40002
Problem:  Redrawing when a loaded buffer is not shown in any window on
          the current tabpage.
Solution: Check that buffer is shown in a (normal) window before redrawing.
2026-05-27 09:27:25 -04:00
zeertzjq
b3dfa86e02 vim-patch:9.2.0539: filetype: too many Bitbake include files are recognized (#40014)
Problem:  filetype: too many Bitbake include files are recognized
          (Brahmajit Das, after v9.1.1732)
Solution: Tighten the pattern to detect BitBake include files, update
          tests (Martin Schwan).

Be more strict when detecting BitBake inc files. In particular, only
match include keywords and variable assignments at the beginning of a
line (excluding whitespace).

Use non-capturing groups to slightly improve performance.

Use regex or-operators to exactly match BitBake assignment operators.
The previous expression would falsely match

    FOO .=. "bar"

, which is not valid BitBake syntax. The new capturing group is more
specific and matches only valid assignments.

fixes:  vim/vim#20288
closes: vim/vim#20335

2df68c8e4b

Co-authored-by: Martin Schwan <m.schwan@phytec.de>
2026-05-27 07:12:53 +08:00
zeertzjq
d214c24129 vim-patch:9.2.0538: Cannot keep leading whitespace in %{} statusline expr (#40007)
Problem:  A leading space in the result of a %{} item is sometimes
          stripped, and an all-digit result is converted to a number.
Solution: Add %0{} atom which inserts the expression result verbatim
          (glepnir)

fixes:  vim/vim#3898
closes: vim/vim#20315

e8d7a40b98

Co-authored-by: glepnir <glephunter@gmail.com>
2026-05-26 01:04:24 +00:00
acehinnnqru
a9d7cbd722 fix(lsp): calc correct screen_width when opts.relative == 'editor' (#39977) 2026-05-24 15:00:53 -07:00
zeertzjq
f53d9ac90b vim-patch:c7645fc: runtime(doc): add a few references to mouse behaviour (#39959)
fixes: vim/vim#20281

c7645fcda5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-23 07:47:49 +08:00
Yi Ming
680ab13951 refactor(lsp): avoid using coroutine when parsing frames 2026-05-22 18:20:55 +08:00
Yi Ming
0e81835fae refactor(lsp): message stream abstraction for message framing 2026-05-22 18:20:51 +08:00
Yi Ming
929e644a5a refactor(lsp): move vim.lsp._transport to vim.net._transport 2026-05-22 18:19:19 +08:00
Justin M. Keyes
b576807410 Merge #39939 from marcuscaisey/lsp-completion-details 2026-05-22 04:39:55 -04:00
Maria Solano
71c72c3409 fix(lsp): validate that workspace_edit isn't nil (#39947) 2026-05-21 19:00:02 -07:00
Marcus Caisey
2845f95171 fix(lsp): advertise that CompletionItem.detail can be resolved (#39934)
Problem:
We can resolve the `CompletionItem.detail` field but don't advertise
this capability.

Solution:
Add `detail` to
`textDocument.completion.completionItem.resolveSupport.properties`.
2026-05-21 13:57:53 -07:00
Marcus Caisey
c75365d22a refactor(lsp): centralise complete item info generation logic
Problem:
The logic for generating the complete item `info` is spread across
`_lsp_to_complete_items`, the `CompleteChanged` event handler, and
`CompletionResolver:request`. This has previously caused the `info`
shown for resolved (via `completionItem/resolve`) and unresolved items
to differ.

Solution:
Centralise the logic in a new `complete_item_info` function which is now
solely responsible for determining:
1. The `info` to show.
2. The markup kind of the `info`.
3. Whether the `info` is complete.

This simplifies the interaction between the 3 functions mentioned in the
problem:
- `_lsp_to_complete_items` calls `complete_item_info` and passes along
  the markup kind and whether the item needs resolving via the complete
  item's `user_data`.
- The `CompleteChanged` consumes the markup kind and whether the
  item needs resolving from the complete item's `user_data`.
- `CompletionResolver:request`, like `_lsp_to_complete_items` calls
  `complete_item_info` again and updates the current `info` if it's
  changed.
2026-05-21 18:22:13 +01:00
Marcus Caisey
d6d03716cf fix(lsp): show detail in popup when server can't completionItem/resolve
Problem:
`CompletionItem.detail` is only shown in the info popup if the server
supports `completionItem/resolve`.

Solution:
If the server doesn't support `completionItem/resolve`, prepend the
complete item `info` with `CompletionItem.detail` in a fenced codeblock,
same as we do when the server supports `completionItem/resolve`.

To ensure that completion items are displayed in the same way,
regardless of whether the server supports `completionItem/resolve`, i've
extracted out the test logic from the `selecting an item triggers
completionItem/resolve + (snippet) preview` case so that we can run the
same tests against a server which supports `completionItem/resolve` and
one which doesn't. Hopefully this should prevent the two behaviours
diverging again.
2026-05-21 18:22:13 +01:00
Marcus Caisey
ce7df01391 fix(lsp): resolve CompletionItem if resolvable fields aren't populated
Problem:
If `CompletionItem.documentation` is populated but `detail` is not, then
`detail` is not resolved.

Solution:
Ensure that we resolve a `CompletionItem` if either `detail` or
`documentation` are not populated.

I've also removed `detail` from the popup menu since otherwise it will
be populated in both the popup menu and the info popup after the
`CompletionItem` has been resolved. I think the info popup is the best
place for it anyway as when there is a completion item with a long popup
menu entry (when `detail` is a medium/long function signature for
instance), the whole popup menu gets widened and this steals horizontal
space that could be used to display the `documentation`. Now with
`detail` and `documentation` in the info popup, they share the same
horizontal space. This also aligns with how VSCode, nvim-cmp, blink.cmp,
and mini.nvim display `detail`.
2026-05-21 18:15:14 +01:00
Marcus Caisey
10a53e7637 fix(lsp): generate snippet preview from resolved textEdit.newText
Problem:
When a resolved `CompletionItem` with kind `Snippet` populates
`textEdit` instead of `insertText`, the contents are not previewed.

Solution:
Generate the snippet preview from `textEdit.newText` as well.
2026-05-21 17:47:08 +01:00
luukvbaal
89431707a0 fix(ui2): unable to stop display of very long message #39823
Problem:  Processing of a very long message may take a long time; there
          is no visual feedback of work being done, and no way to abort
          processing.
          Calculating text height for spill indicator inhibits
          performance for very long message.

Solution: Whenever writing part of a message is taking longer than 100ms,
          show the first part of the message, while checking for CTRL-C.
          Calculate ('wrap'-ed) text height accurately until 'lines',
          use line count beyond that.
2026-05-21 05:24:39 -04:00
Kyle
7337e02563 refactor(docs): generate tui.txt $NVIM_TERMDEFS keys #39836
Problem:
Potential documentation drift in `tui.txt` if fields for
`$NVIM_TERMDEFS` change.

Solution:
Generate docs for `tui.txt`. Add `brief_xform` to `gen_vimdoc.lua` to
allow transforming briefs during generation.
2026-05-21 04:39:45 -04:00
Maria Solano
3883cba996 fix(lsp): flush change notifications on save (#39894) 2026-05-20 16:33:10 -07:00
Justin M. Keyes
9aa4608401 refactor: introduce nvim_on internally #39883
Problem:
`nvim_create_autocmd` is too verbose and its `callback` requires extra
"nesting".

Solution:
Introduce `nvim_on`. Start using it internally. Then we can get a feel
for how it should look before making it public.
2026-05-20 17:33:01 -04:00
Justin M. Keyes
799cbfff85 fix(vim.secure): read() command injection vulnerability #39918
Problem:
Malicious filename can execute code because of ":" cmdline expansion.

Solution:
Use `fnameescape()`.

fix https://github.com/neovim/neovim/issues/39914
2026-05-20 15:27:43 -04:00
Justin M. Keyes
e446779726 fix(health): "Create bug report" button 2026-05-20 14:09:20 +02:00
Justin M. Keyes
74ea3875b4 fix(health): show Nvim-owned checks at the top 2026-05-20 14:09:20 +02:00
Justin M. Keyes
6674329d15 feat(health): highlight current buffer
Problem:
A benefit of the old `:LspInfo` was that it showed info related to the
"current buffer" a bit more clearly.

Solution:
Highlight the "current buffer" in the LSP checkhealth report.
2026-05-20 14:09:20 +02:00
Justin M. Keyes
7812087341 fix(health): cleanup LSP healthcheck
Problem:
filewatcher and position-encoding info is reported after the big list of
client details.

Solution:
- report the info in the top-level, not in dedicated subsections.
2026-05-20 14:09:20 +02:00
Justin M. Keyes
735a7d0c9e feat(fswatch): report filewatchers in :checkhealth 2026-05-20 14:09:20 +02:00
Olivia Kinnear
f0c3cc2398 fix(pack): collect "Removed plugin" into one message #39840 2026-05-20 06:45:05 -04:00
Justin M. Keyes
1f75fef951 Merge #39889 from ofseed/pos-util
refactor(pos,range): drop `to_cursor`, extract `vim.pos._util`
2026-05-20 05:35:09 -04:00
Justin M. Keyes
f1fad32e2e docs: misc, custom text-object #39877
text-object-define is a pattern I found in tpope's plugins (e.g.
https://github.com/tpope/vim-jdaddy) which shows an elegant way to
define a text-object. (Any mistakes in the example are my fault.)
2026-05-20 05:21:27 -04:00
Yi Ming
cd3b544611 refactor(pos,range): add missing validators and improve the docs
Problem:
Our documentation is incomplete or inconsistent in several ways:
- Some public APIs lack corresponding validators.
- Some public APIs lack usage examples.
- The meaning of some return values or parameters is not clearly explained.

Solution:
Add the missing validators, examples, and clarifications.
2026-05-20 16:23:03 +08:00
Yi Ming
b1c1f32089 refactor(pos,range): extract vim.pos._util
Problem:
- To share logic, creating a `vim.Range` currently creates two `vim.Pos` values
  as intermediates, which causes unnecessary table allocations.
- `pos.lua` and `range.lua` contain some overlapping logic.

Solution:
Add `vim.pos._util`, a module for handling
positions represented directly by `row` and `col`.
2026-05-20 16:23:03 +08:00
Yi Ming
8d1233a144 feat(pos,range)!: remove range.cursor() and range:to_cursor(),
Problem:
- A window can only have one cursor, ranges selected by the cursor are typically
  obtained by marks like ">" and "<", instead of calling get_cursor() twice.
- `vim.Range` is described as end-exclusive,
  but the current `range.cursor()`/`range:to_cursor()` are end-inclusive.
- Conversion between `vim.Range` and mark-indexed range can be done by
  `range.mark()`/`range:to_mark()`

Solution:
Remove `range.cursor()` and `range:to_cursor()`,
2026-05-20 16:23:01 +08:00
Barrett Ruth
5181984db9 fix(api): nvim_exec_autocmds({buf=x}) runs in buffer context #39061
Problem: `nvim_exec_autocmds({ buf = ... })` matches the target buffer, but callbacks and modelines run with the caller buffer current rather than the target buffer.

Solution: Execute the buffered path in prepared target-buffer context and restore the caller afterward.
2026-05-20 03:48:55 -04:00
Olivia Kinnear
ea8f1463dd fix(lua): fields of nvim.spellfile.Opts are optional #39902 2026-05-20 02:47:35 -04:00
zeertzjq
f3bb21e71d vim-patch:9.2.0500: filetype: some html files wrongly recognized as htmlangular (#39880)
Problem:  filetype: some html files are wrongly recognized as htmlangular
Solution: Use the \< atom to anchor ng-template and ng-content to start
          of word (truffle)

Prevent false-positive htmlangular detection on words containing
'ng-template' or 'ng-content' as a substring (e.g. 'song-template',
'sing-content'). Anchor both branches with \< to require a word start,
matching the \<DTD\s\+XHTML\s idiom used five lines below.

related: neovim/neovim#39778.
closes:  vim/vim#20246

354ab1a69e

Co-authored-by: truffle <truffleagent@gmail.com>
2026-05-19 08:42:05 +08:00
Justin M. Keyes
d8ec793379 Merge #39822 from ofseed/pos-mark
feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
2026-05-18 10:45:21 -04:00