Commit Graph

5623 Commits

Author SHA1 Message Date
Owen
26f77f8fcd feat(provider): support bun as node.js provider #38517
Problem:
Neovim's Node.js provider does not support the Bun package manager.
PR #26829 attempted to add this but used a hardcoded path and was abandoned.

Solution:
- Use `bun pm bin -g` to dynamically locate the global binary directory.
- Update `health.lua` to recognize bun installations.
2026-04-12 15:01:32 -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
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
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
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
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
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
Olivia Kinnear
6bea0cdbdc feat(logs)!: move logs to stdpath("state")/logs 2026-04-09 21:54:33 -05: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
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
Sean Dewar
1ff1973269 fix(api)!: nvim_clear_autocmds() "event" handling
Problem: nvim_clear_autocmds() does not type check "event" correctly, and also
treats an empty array "event" like nil.

Solution: fix type checking. Treat empty array "event" as a no-op, like
nvim_exec_autocmds(). Add some extra tests.

Likewise the nil handling change may be considered breaking if anyone
(unintentionally) relied on that. It was also true that integer, function, etc.
"event"s would also be treated like nil!

Note that an empty string "event" is still an error, as that's must be an exact
match on an event name.
2026-04-08 21:48:38 +01:00
Sean Dewar
eaea0c0f9d docs(api): nvim_exec_autocmds() default "pattern"
Problem: nvim_exec_autocmds() documentation incorrectly describes the default
for "pattern" as *, when it's actually the current file name (like :doautocmd).

Solution: correct it. Add a test.
2026-04-08 21:48:38 +01:00
Sean Dewar
446e794a9c fix(api)!: empty non-nil autocmd "pattern" handling
Problem: in autocmd APIs, a non-nil "pattern" containing only empty
'sub'-patterns is silently treated as nil, causing the fallback value to be
unexpectedly used instead.

Solution: for nvim_create_autocmd(), raise a validation error (as no autocmds
would be created). For nvim_{exec,clear}_autocmds(), make it a no-op (as
matching no autocmds is not an error).
2026-04-08 21:48:38 +01:00
Maria Solano
665ebce569 fix(diagnostics)!: restore is_pull namespace argument #38698
Problem:
The current LSP diagnostic implementation can't differ between a pull
diagnostic with no identifier and a set of diagnostics provided via push
diagnostics.

"Anonymous pull providers" are expected by the protocol https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticOptions
, depending on how the capability was registered:
- Dynamic registrations have an identifier.
- Static registrations will not.

Solution:
Restore the `is_pull` argument removed in
https://github.com/neovim/neovim/pull/37938, keeping the identifier of
pull diagnostic collections.
2026-04-08 16:11:01 -04:00
ngicks
a165eee64f feat(vim.version): add __eq to vim.VersionRange #38881
Problem: vim.VersionRange had no __eq metamethod, so comparing 2 distinct
but same value instances always returned false. In vim.pack.add this caused
redundant lockfile rewrites, even when the resulting lockfile content was
unchanged.

Solution: Add __eq metamethod on vim.VersionRange
2026-04-08 13:33:00 -04:00
Luis Calle
c530fd8e75 docs: vim.range, vim.pos #38869
Problem:
`vim.Range` and `vim.Pos` have signature mismatches on the docs of some functions.

Solution:
Split the "module" functions from the "class" functions (just like it's done in other modules like `vim.version`) and regenerate the docs.
2026-04-08 11:38:27 -04:00
zeertzjq
399fe4a11f vim-patch:f3cba4a: runtime(doc): document gitcommit_summary_length
related: vim/vim#19905

f3cba4a205

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-08 07:23:20 +08:00
zeertzjq
b36eafd5da vim-patch:794c304: runtime(doc): clarify incsearch feature and typed chars (#38830)
fixes: vim/vim#19886

794c304479

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-07 06:22:45 +08:00
Christian Clason
bdc72a0843 feat(filetype): vim.filetype.inspect() returns copy of registry #38831
Problem: No way of inspecting the (user-added) filetype detection rules.

Solution: Add `vim.filetype.inspect()` returning copies of the internal
`extension`, `filename`, `pattern` tables. Due to the dynamic nature of
filetype detection, this will in general not allow getting the list of
known filetypes, but at least one can see if a given extension is known.
2026-04-06 12:48:42 -04:00
Josh Triplett
889572a358 fix(tui): check background color on resume #38726
Problem:
We normally get the background color via continuous reporting. However,
if we were backgrounded while the light/dark mode changed, we won't have
received the report, and we'll have the wrong background color.

Without this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will not match the current state.

Solution:
Query it on resume as well. (This requires separating the query from the
flush, to just do the query along with all the others, while waiting to
flush until we've set up uv.)

With this change, if you background nvim, toggle the light/dark mode,
resume, and check `:set bg`, it will have updated.
2026-04-06 12:44:03 -04:00
Luis Calle
01be30f638 feat(vim.pos)!: require buf param on vim.pos, vim.range #38665
Problem: `buf` is optional even though its needed to perform conversions
and the ordering of `(buf, row, col)` is not consistent.

Solution: make `buf` mandatory on `vim.range` and `vim.pos` and enforce
the `buf, row, col` ordering
2026-04-06 11:51:36 -04:00
zeertzjq
4aa8969d29 vim-patch:9.2.0299: runtime(zip): may write using absolute paths (#38810)
Problem:  runtime(zip): may write using absolute paths
          (syndicate)
Solution: Detect this case and abort on Unix, warn in the documentation
          about possible issues

46f530e517

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-06 10:15:19 +08:00
Justin M. Keyes
42f6c55139 Merge #38796 from justinmk/doc2 2026-04-05 20:36:45 -04:00
Justin M. Keyes
6b796696c3 docs: statusline
fix https://github.com/neovim/neovim/issues/38670
2026-04-06 02:29:29 +02:00
Olivia Kinnear
13faa0ef84 feat(defaults): :Open without args opens current file #38776
Problem:
Running `:Open` on an open buffer does not run `vim.ui.open()` on that file, requiring the user to type `:Open %`. This is inconsistent with most other vim commands which accept files, which default to the current buffer's file.

Solution:
Default to the current file when `:Open` is used without arguments.
2026-04-05 19:46:45 -04:00
Justin M. Keyes
57457f227d docs: bump minimum required Win 10 to version 2004
see https://github.com/neovim/neovim/issues/32367#issuecomment-4188641644
2026-04-05 18:22:59 +02:00
zeertzjq
20e46cb38d vim-patch:af58a9f: runtime(doc): adjust :h 'autowrite' and :h 'autowriteall'
- Don't go over 78 columns.
- Change the first "and" to "or", as "or" is used below.
- Change "takes one" to "switches", as "one" may be mistaken as
  referring to the command instead of the user.
- Use backticks in :h 'autowriteall' like in :h 'autowrite'.

closes: vim/vim#19859

af58a9f5e9
2026-04-04 06:04:28 +08:00
zeertzjq
76a917a81e vim-patch:9.2.0267: 'autowrite' not triggered for :term
Problem:  'autowrite' not triggered for :term
Solution: Trigger autowrite for :term command
          (rendcrx)

closes: vim/vim#19855

466b5f531a

Co-authored-by: rendcrx <974449413@qq.com>
2026-04-04 06:04:25 +08:00
zeertzjq
33b9a9dcf1 vim-patch:880cf88: runtime(doc): Various fixes for ft_rust.txt (tw78, grammar, spaces) (#38730)
closes: vim/vim#19887

880cf88ea6

Co-authored-by: Peter Kenny <github.com@k1w1.cyou>
2026-04-03 21:38:44 +08:00
zeertzjq
fb9c843ab0 feat(:restart): reattach all UIs (#38683)
This is quite easy since [command] is now only executed once on UIEnter.
2026-04-02 20:57:02 +08:00
Yi Ming
0eb2eb4106 refactor(lsp): remove implicit rpc error tostring #38707
Problem:
LSP error responses implicitly rely on a custom `__tostring` function
(`vim.lsp.rpc.format_rpc_error`) for formatting. This causes errors that are not
created via `vim.lsp.rpc.error` to behave inconsistently with those that are.

Furthermore, we usually use `log.error` to print these errors, which uses
`vim.inspect` under the hood, so the custom `__tostring`  provides little
benefit.

This increases the difficulty of refactoring the code, as it tightly couples RPC
error handling with the LSP.

Solution:
Convert every potential `__tostring` call to an explicit one. Since we don't
describe this behavior in the documentation, this should not be a breaking
change.
2026-04-02 08:53:29 -04:00
Justin M. Keyes
68c26b344b docs: misc #38584 2026-04-01 17:04:41 -04:00
Justin M. Keyes
202f67dce3 Merge #38560 refactor vim.lsp.rpc 2026-04-01 16:46:59 -04: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
zeertzjq
a89d7dcb91 docs: misc (#38578) 2026-04-01 07:59:51 +08:00
skewb1k
2dce2af768 docs: fix syntax errors in examples #38606 2026-03-30 11:49:30 -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
Yi Ming
4784f96e59 refactor(lsp): merge vim.lsp.rpc.Client and vim.lsp.rpc.PublicClient 2026-03-30 10:59:51 +08:00
Justin M. Keyes
b6006679e7 docs: news #38583 2026-03-29 20:53:24 -04:00
Justin M. Keyes
d9d3822a7b docs: misc #38532
Close #38431
Close #38521
Close #38530

Co-authored-by: tayheau <thopsore@pasteur.fr>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Olivia Kinnear <git@superatomic.dev>
2026-03-29 11:56:37 -04:00
Luis Calle
f3c2eb49ba feat: extend vim.Pos, vim.Range #36397
Problem:
Using nested `vim.Pos` objects to represent each `vim.Range` object
requires 3 tables for each `vim.Range`, which may be undesirable in
performance critical code. Using key-value tables performs worse than
using array-like tables (lists).

Solution:
Use array-like indices for the internal fields of both `vim.Pos` and
`vim.Range` objects. Use a metatable to allow users to access them like
if they were key-value tables.

---

Problem:
The `vim.Pos` conversion interface for `extmark` indexing does not take
into account the difference in how a position on top of a newline is
represented in `vim.Pos` and `extmark`.
- `vim.Pos`: for a newline at the end of row `n`, `row` takes the value
  `n + 1` and `col` takes the value `0`.
- `extmark`: for a newline at the end of for `n`, `row` takes the value
  `n` and `col` takes the value `#row_text`.

Solution:
Handle this in the `extmark` interface.

---

Problem:
Not all `to_xxx` interfaces have wrapping objects like `to_lsp`.

Solution:
Return unwrapped values in `to_xxx` interfaces where it makes sense.
Accept unwrapped values in "from" interfaces where it makes sense.

---

Problem:
`start` and `end` positions have different semantics, so they can't be
compared. `vim.Range` relies on comparing the `end` and `start` of two
ranges to decide which one is greater, which doesn't work as expected
because this of the different semantics.

For example, for the ranges:

    local a = {
      start = { row = 0, col = 22, },
      end_ = { row = 0, col = 24, },
    }
    local b = {
      start = { row = 0, col = 17, },
      end_ = { row = 0, col = 22, },
    }

in this code:

    local foo, bar = "foo",  "bar"
    --               |---||-|
    --                 b  a

The range `b` is smaller than the range `a`, but the current
implementation compares `b._end` (`col = 22`) and `a.start` (`col = 22`)
and concludes that, since `b.col` is not smaller than `a.col`, `b`
should be greater than `a`.

Solution:
- Use a `to_inclusive_pos` to normalize end positions inside of
  `vim.Range` whenever a comparison between a start and an end position
  is necessary.
2026-03-29 11:22:40 -04:00
Justin M. Keyes
7cd22e916b fix(:connect): formalize connect event #38543
Also document it.
2026-03-29 06:59:34 -04:00
zeertzjq
ad4bc2d90c refactor(:restart): execute [command] on UIEnter (#38541)
This avoids having to pass it in the UI event.
2026-03-29 08:12:32 +08:00
Sathya Pramodh
d5516daf12 fix(:restart): formalize restart event #35223
Problem:
The "restart" event has some problems:
- all UI clients must implement a somewhat complex set of setups
- UI must be on the same machine as the server
- only works for the "current" UI
- race/edge case: If the user config has errors / waiting for input, are
  all UIs able to attach while Nvim is waiting for input?

Solution:
- Perform the restart on the server, not the client.
- Pass listen address (instead of CLI args) in the UI event.
- Simplifies UI logic: they only need to attach to new address.
- Opens the door for more enhancements in the future, such as allowing
  all UIs to reattach instead of only the "current" UI.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-28 15:25:09 -04:00