Commit Graph

780 Commits

Author SHA1 Message Date
Puneet Dixit
98098d8466 fix(startup): emitting useless OptionSet
Problem:
During startup, we manually trigger a useless and misleading `OptionSet`
event, which doesn't set `v:option_*` values (this is a limitation of
`nvim_exec_autocmds`).
ad4bc2d90c/runtime/lua/vim/_core/defaults.lua (L939).

Solution:
The `nvim_exec_autocmds('OptionSet',…)` call does not serve any purpose
since 5cbb9d613b, so just drop it.
2026-05-17 18:24:50 +02:00
Justin M. Keyes
25b522a75d backport: docs: misc, window (#39722)
- formalize `window-number` similar to `tabpage-number`.
- reference it from docs.
2026-05-11 21:06:59 +00:00
zeertzjq
2902ec0541 vim-patch:9.2.0458: Crash with invalid shellredir/shellpipe value (#39691)
Problem:  Crash with invalid shellredir/shellpipe value
          (bfredl)
Solution: Validate the option and allow only a single "%s".

fixes:  vim/vim#20157
closes: vim/vim#20159

84ae09dd79

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit ffe87d91f7)
2026-05-09 01:38:36 +00:00
Justin M. Keyes
b3cd33d029 backport feat(tui): restore 'ttyfast' to control tty requests (#39667)
feat(tui): restore 'ttyfast' to control tty requests

Problem:
When running nvim on a remote machine over SSH, if there is high ping,
then bg detection may not complete in time. This results in a warning
every time nvim is started. #38648

Solution:
Restore 'ttyfast' option and allow it to control whether or not bg
detection is performed. Because this is during startup and before any
user config or commands, we use the environment variable
`NVIM_NOTTYFAST` to allow disabling `ttyfast` during initialization.

Co-authored-by: Kyle <50718101+kylesower@users.noreply.github.com>
2026-05-08 06:49:34 +00:00
Justin M. Keyes
cae8fd7a94 refactor: _meta/builtin_types.lua => vimfn_types.lua #39658
Problem:
`builtin_types.lua` seems to be about vimfn (aka "eval", aka
"vimscript", …) specifically, whereas `builtin.lua` is about the Lua
stdlib.

Solution:
Rename it to `vimfn_types.lua`, to align with `vimfn.gen.lua`.

(cherry picked from commit aea9aeee78)
2026-05-07 21:47:57 +00:00
Justin M. Keyes
1999c09953 backport build(docs): lint more quasi-keysets (#39656)
Problem:
Linter missed backtick and double-quote keynames in the quasi-keyset of
the `nvim_create_user_command` docstring.

Solution:
Update the linter to check backtick-surrounded and quote-surrounded key
names.
2026-05-07 17:32:50 +00:00
Quentin
94b0229fa5 docs: expand nvim_create_user_command docs #39540
(cherry picked from commit 97a557bd1e)
2026-05-07 13:57:57 +00:00
Justin M. Keyes
33c6d51167 docs: rename "tabpage" 2026-05-07 12:03:02 +02:00
Justin M. Keyes
b982adfe10 docs: misc, rename "tabpage" 2026-05-07 12:03:02 +02:00
Justin M. Keyes
4b424a06c5 backport fix(lsp): send didClose, didOpen when languageId changes (#39519)
fix(lsp): send didClose, didOpen when languageId changes

Problem:
If a buffer's filetype changes after the LSP client has already
attached (e.g. from json to jsonc via a modeline), but the client
supports both filetypes, it stays attached. It does not notify the
server of the new languageId, causing the server to incorrectly process
the file using the old languageId.

Solution:
Save the languageId used during textDocument/didOpen, and send
textDocument/didClose + textDocument/didOpen when buffer's languageId
changed.

Lsp spec:
0003fb53f1/_specifications/lsp/3.18/textDocument/didOpen.md (L5)
> If the language id of a document changes, the client
> needs to send a textDocument/didClose to the server followed by a
> textDocument/didOpen with the new language id if the server handles
> the new language id as well.

AI-assisted: Gemini 3.1 Pro

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2026-04-30 13:09:55 +00:00
Justin M. Keyes
4ee47a56ec docs: misc 2026-04-30 02:08:19 +02:00
Till Bungert
822778f7e5 fix(excmd): use realtime for v:starttime, :uptime #39425
Problem:
`v:starttime`, `:uptime` use a monotonic high-resolution timer. This
only works as long as the timer keeps running (if the computer is
suspended the timer is paused). This is somewhat unintuitive, and
doesn't match the behavior of the `uptime` shell command.

Solution:
Implement `os_realtime` to get the real time since the
epoch in nanoseconds.
2026-04-29 23:41:41 +02:00
Justin M. Keyes
d735ce36ec docs: sort quasi-keysets 2026-04-26 22:02:34 +02:00
Justin M. Keyes
534b1a8e7e docs: vim.ui.select, misc
(cherry picked from commit d960ae6760)
2026-04-26 19:45:57 +00:00
Justin M. Keyes
26678ebbd8 backport: docs: misc (#39395) 2026-04-25 13:51:22 -04:00
Justin M. Keyes
fd1b193d51 feat(:restart): v:starttime, v:exitreason #39319 2026-04-22 18:58:47 +00:00
Nick Krichevsky
4d4e196447 fix(options): default 'titlestring' shows CWD #39233
Problem:
In the default 'titlestring', if the containing directory is the CWD, it renders as "."

Solution:
Add `:p` to the titlestring.

(cherry picked from commit e68e769352)
2026-04-22 11:52:02 +00:00
Justin M. Keyes
5ad64af44f docs: misc #39243 2026-04-20 11:46:26 +00:00
Justin M. Keyes
eaa8cff0bd fix(api): expose fg_indexed/bg_indexed in nvim_get_hl (#39240)
Problem: fg_indexed/bg_indexed were dropped from nvim_get_hl output due
to a wrong short_keys guard. HL_FG_INDEXED also wasn't cleared in
hl_blend_attrs, and HLATTRS_DICT_SIZE was too small.

Solution: Remove the short_keys guard, clear HL_FG_INDEXED in
hl_blend_attrs, bump HLATTRS_DICT_SIZE to 24, and clarify docs that
these flags mean rgb is an approximation of the cterm palette index.

(cherry picked from commit 01861c2f95)

Co-authored-by: glepnir <glephunter@gmail.com>
2026-04-20 09:46:55 +00:00
Justin M. Keyes
43398547ec backport docs: misc (#39206)
docs: misc


(cherry picked from commit 54398c5874)
2026-04-19 12:36:19 +00:00
Aditya Malik
326a7d5afb docs(events): Lua types for autocmd event-data #38518
Problem:
  No LuaLS types for event-data fields (ev.data). Types are only
  documented ad hoc in scattered locations.

Solution:
  Add runtime/lua/vim/_meta/events.lua defining vim.event.<name>.data
  classes for events that provide ev.data. Reference the types from
  each event's help in autocmd.txt, lsp.txt, and pack.txt.
(cherry picked from commit 2cb240319b)
2026-04-18 20:35:15 +00:00
zeertzjq
891c6c9150 vim-patch:8.2.2440: documentation based on patches is outdated (#39144)
Problem:    Documentation based on patches is outdated.
Solution:   Add changes to documentation in a patch.

853886722c

Trailing space was removed in later patches.
Also fix a few more misplaced error numbers from #8155.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 39410ef42b)
2026-04-17 02:10:01 +00:00
Justin M. Keyes
a1712503d8 backport test: lint naming conventions (#39124)
test: lint naming conventions

Problem:
Naming conventions are not automatically checked.

Solution:
Add a check to the doc generator. Eventually we should extract this
somehow, but that will require refactoring the doc generator...

Note: this also checks non-public functions, basically anything that
passes through `gen_eval_files.lua` and `gen_vimdoc.lua`. And that's
a good thing.
2026-04-16 14:29:50 +00:00
Justin M. Keyes
df0f88a5a9 refactor(api): rename "window" to "win" (positional parameters) #39083
continues d0af4cd909.

This commit renames positional parameters. This is only "cosmetic", but
is intended to make it extra clear which name is preferred, since people
often copy existing code despite the guidelines in `:help dev-naming`.

(cherry picked from commit 71ac4db335)
2026-04-15 18:12:34 +00:00
Justin M. Keyes
373a248b0f refactor(api): rename buffer to buf (positional parameters) #39013
In 3a4a66017b, 4d3a67cd62, df8d98173c we renamed "buffer" to "buf"
in dict parameters and return-values.

This commit renames positional parameters. This is only "cosmetic", but
is intended to make it extra clear which name is preferred, since people
often copy existing code despite the guidelines in `:help dev-naming`.

(cherry picked from commit d0af4cd909)
2026-04-15 14:09:12 +00:00
Justin M. Keyes
ccba8a8f2d docs: lsp, options, api
- revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b

Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-14 13:27:29 +02:00
Justin M. Keyes
53038d2c38 fix(lua): not obvious which _meta/ files are generated #39035
Problem:
- Not obvious which _meta/ are generated and which should be edited
  manually.
- The require guard (`error('Cannot require a meta file')`) is not
  consistently present in all meta files.

Solution:
- Update headers.
- Add require() guard to all meta files.
- Rename generated meta files with `.gen.lua`.

(cherry picked from commit 65b40e69ac)
2026-04-14 10:04:52 +00:00
neovim-backports[bot]
c630ca7459 refactor(options): generate "modeline disallowed" doc text (#39034)
Problem:
- Lots of redundant text in options docs for "not allowed in
  a modeline", even though we already have a flag that indicates that.
- `deny_in_modelines` is an old vestigial flag only used by 'encoding'
  (which never changes).

Solution:
- Generate docs based on the `secure` flag.
- Remove the `deny_in_modelines` flag (`kOptFlagNoML`).

(cherry picked from commit 829e9ec65e)

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-14 04:43:09 -04:00
Justin M. Keyes
570d8fd128 backport: feat(api): rename buffer to buf in retval #39015
In 3a4a66017b, 4d3a67cd62
we renamed "buffer" to "buf" in dict parameters.

This commit also renames such keys in dict return-values.
2026-04-13 18:38:44 -04:00
Justin M. Keyes
b28f00bf9c docs: misc 2026-04-12 15:56:12 +02:00
glepnir
4053141cb3 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.

(cherry picked from commit 49086862fc)
2026-04-12 13:50:40 +00:00
Barrett Ruth
452a9b895c 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'`.

(cherry picked from commit 6e95d1ad13)
2026-04-12 13:12:00 +00:00
zeertzjq
1b36b75832 fix(messages): truncate warning messages only in display (#38901)
For now, add a private "_truncate" flag to nvim_echo, using a truncation
method similar to showmode().

(cherry picked from commit 9c5fba5df0)
2026-04-09 04:31:49 +00:00
Justin M. Keyes
ed47b27ad4 backport: feat(api): rename buffer to buf (#38899)
feat(api): rename buffer to buf

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: Jordan <46637683+JordanllHarper@users.noreply.github.com>
2026-04-09 01:23:13 +00:00
Sean Dewar
b28e5e4898 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 23:19:13 +01:00
Justin M. Keyes
f92a68d4bc docs: statusline
fix https://github.com/neovim/neovim/issues/38670

(cherry picked from commit 6b796696c3)
2026-04-06 01:24:32 +00:00
zeertzjq
04fabbf32d 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
(cherry picked from commit 65e2218585)
2026-04-01 10:21:24 +00:00
Justin M. Keyes
64d55b74d8 docs: news #38464 2026-03-28 09:59:54 -04:00
Shadman
a940b77cb2 feat(prompt): prompt_appendbuf() appends to prompt buffer #37763
Problem:
Currently, we recommend always inserting text above prompt-line in
prompt-buffer. This can be done using the `:` mark. However, although
we recommend it this way it can sometimes get confusing how to do it
best.

Solution:
Provide an api to append text to prompt buffer. This is a common
use-case for things using prompt-buffer.
2026-03-27 07:39:09 -04:00
Shadman
4b643d7068 feat(progress): set Progress-event pattern to "source" #38495
Problem:
Currently, there's no way to distinguish progress messages coming from
different sources. Nor can Progress event be easily filtered based on
source.

Solution:
- Add "source" field to nvim_echo-opts.
- The Progress event pattern is now defined by the "source" field.
- Include the "title" as ev.data.
- Unrelated change: set force=false to disable nesting.
2026-03-27 06:24:14 -04:00
glepnir
4d04d0123d feat(api): nvim_set_hl{update:boolean} #37546
Problem: nvim_set_hl always replaces all attributes.

Solution: Add update field. When true, merge with existing
attributes instead of replacing. Unspecified attributes are preserved.
If highlight group doesn't exist, falls back to reset mode.
2026-03-25 06:01:50 -04:00
Shadman
0af01948f3 fix(progress): show progress-status only in curwin #38458
Problem:
Currently same progress stat get's displayed on statusline of all
windows. This is repeatitive and noisy.

Solultion:
Only display progress-status on the focused window

Problem:
Currently, when multiple progress are on going we show it as Progress:
{N} items {percent}% format. It can be simplified sinnce items doesn't
really add enough value for the valuable space it takes in statusline

Solution:
Change format to Progress: {percent}%({N})
2026-03-24 08:28:44 -04:00
Justin M. Keyes
a3b48b1054 docs: api, plugins, ui2 2026-03-24 00:14:55 +01:00
skewb1k
9a5641b4b5 fix(lua): drop support for boolean buf in vim.keymap #38432
Problem:
`vim.keymap.*.Opts.buf` allows `boolean` aliases for more widely
used `integer?` values, `true` -> `0` and `false` -> `nil`. This
conversion is unnecessary and can be handled at call sites.

Solution:
As a follow-up to deprecating the `buffer` option, drop support for
boolean values for the new `buf` option. The deprecated `buffer`
continues to support booleans for backward compatibility.
2026-03-23 08:00:53 -04:00
skewb1k
4d3a67cd62 feat(lua): replace buffer with buf in vim.keymap.set/del #38360
The `buffer` option remains functional but is now undocumented.
Providing both will raise an error. Since providing `buf` was disallowed
before, there is no code that will break due to using `buffer` alongside
`buf`.
2026-03-21 12:00:06 -04:00
Justin M. Keyes
e3a1e47bb2 docs: misc 2026-03-20 23:30:09 +01:00
Shadman
24684f90ea feat(progress): status api, 'statusline' integration #35428
Problem:
Default statusline doesn't show progress status.

Solution:
- Provide `vim.ui.progress_status()`.
- Include it in the default 'statusline'.

How it works:
Status text summarizes "running" progress messages.
 - If none: returns empty string
 - If one running item: "title:  percent%"
 - If multiple running items: "Progress: N items avg-percent%"
2026-03-20 07:18:20 -04:00
glepnir
531442ddd8 fix(ui): apply 'pumborder' to mouse menu, fix overflow #36193
Problem:
Mouse popup menus (right-click context menus) do not respect the
'pumborder' option and could overflow screen boundaries when borders
were enabled near the edge.

Solution:
- Remove the mouse menu exclusion from border rendering.
- Add boundary check to shift menu left when border would exceed screen
  width, ensuring complete visibility of menu content and borders.
2026-03-19 13:11:35 -04:00
Justin M. Keyes
02ce446510 docs: api, lsp, messages, intro #38327 2026-03-17 17:02:15 -04:00
Harsh Kapse
a5b8cf145d feat(diff): merge adjacent blocks using inline:word (#37085)
vim-patch:9.2.0174: diff: inline word-diffs can be fragmented

Problem:  When using 'diffopt=inline:word', lines were excessively
          fragmented with punctuation creating separate highlight
          blocks, making it harder to read the diffs.
Solution: Added 'diff_refine_inline_word_highlight()' to merge
          adjacent diff blocks that are separated by small gaps of
          non-word characters (up to 5 bytes by default) (HarshK97).

When using inline:word diff mode, adjacent changed words separated by
punctuation or whitespace are now merged into a single highlight block
if the gap between them contains fewer than 5 non-word characters.

This creates more readable diffs and closely matches GitHub's own diff
display.

closes: vim/vim#19098

42c6686c78
2026-03-17 12:11:55 +00:00