Commit Graph

36260 Commits

Author SHA1 Message Date
Justin M. Keyes
a1c8b81672 feat(normal): normal-mode ZR does :restart
Make it a normal-mode command instead of a default mapping.
2026-04-21 15:54:08 +02:00
Mike J. McGuirk
2551c7a8b1 feat(defaults): map ZR to restart
Problem: No default mapping for :restart.

Solution: Map to ZR in defaults.

Closes: https://github.com/neovim/neovim/issues/38942
2026-04-21 15:54:08 +02:00
Justin M. Keyes
4af0c5d8df build: gen_char_blob.lua: "bad argument to format" if path contains "%" #39274
Problem:
Build fails if user cloned the repo to a path with "%" chars:

    src/gen/gen_char_blob.lua:51: bad argument #1 to 'format' (number expected, got string)

Solution:
- Escape "%" chars.
- Also use "%q" in case the path has spaces...
2026-04-21 09:50:46 -04:00
zeertzjq
ac8459a09c fix(substitute): don't crash with very large count (#39272) 2026-04-21 11:38:15 +00:00
zeertzjq
32e249dfa6 vim-patch:9.2.0371: filetype: ghostty config files are not recognized (#39267)
Problem:  filetype: ghostty config files are not recognized
Solution: Detect ghostty configuration files as ghostty filetype,
          include a simple ghostty filetype plugin (Bez Hermoso)

closes: vim/vim#20002

b30803b231

Co-authored-by: Bez Hermoso <bezalelhermoso@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-21 02:24:07 +00:00
zeertzjq
7d3e275b07 vim-patch:1c88aee: runtime: Remove wrong syn oneline keyword from a few syntax files (#39266)
Also:
- drop a few trailing whitespaces
- mark the oneline keyword for :syn keyword as error in the
  Vim syntax script, add tests for it.

closes: vim/vim#20018

1c88aee1fa

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2026-04-21 10:19:17 +08:00
zeertzjq
3f9500e75d vim-patch:9.2.0380: completion: a few issues in completion code (#39264)
Problem: ins_compl_stop() sets compl_best_matches = 0, but that's a
         pointer, should reset compl_num_bests instead,
         find_common_prefix() reads cpt_sources_array[cur_source] without
         checking cur_source != -1 which causes an OOB for -1,
         find_next_completion_match(): second `if` in the pending loop
         should be `else if`. Forward paging only moves one step per call.

Solution: Reset compl_num_bests instead, add a check for cur_source not
          equal -1, change if to else if (glepnir)

closes: vim/vim#20000

b328686d6a

Co-authored-by: glepnir <glephunter@gmail.com>
2026-04-21 01:18:30 +00:00
zeertzjq
c69af05003 vim-patch:9.2.0378: Using int as bool type in win_T struct (#39263)
Problem:  Several win_T fields are declared as "int" or "char" but are
          used strictly as boolean flags with TRUE/FALSE values.  The
          integer types obscure the boolean intent and are wider than
          needed.
Solution: Change the following win_T members to bool (stdbool.h) and
          update their assignments from TRUE/FALSE to true/false
          accordingly.

The following conversions have been done:
- int -> bool (10 members):
  w_set_curswant, w_botfill, w_old_botfill, w_do_win_fix_cursor,
  w_popup_fixed, w_border_highlight_isset, w_cline_folded,
  w_redr_status, w_arg_idx_invalid, w_has_scrollbar
- char -> bool (4 members):
  w_topline_was_set, w_ru_empty, w_fold_manual, w_foldinvalid

No existing code compares these members against TRUE/FALSE explicitly or
uses ++/-- / bitwise ops on them, so only plain assignments are
affected.

Excluded:
- w_locked (recursion counter with ++/--),
- w_want_scrollbar (may hold -1 from dict_get_bool),
- w_winbar_height (used in arithmetic and exposed as number via
  getwininfo()).

related: vim/vim#20005
closes:  vim/vim#20008

146d5da0d1

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 08:56:33 +08:00
zeertzjq
49d63ca548 vim-patch:9.2.0373: Ctrl-R mapping not triggered during completion (#39261)
Problem:  Ctrl-R mapping not triggered during completion.
Solution: Move Ctrl-R check out of vim_is_ctrl_x_key()
          (zeertzjq).

fixes:  vim/vim#20004
closes: vim/vim#20006

49e8630a28
2026-04-21 08:27:26 +08:00
zeertzjq
901b3f0c39 fix(move): avoid integer overflow with large 'scrolloff' (#39251) 2026-04-21 07:22:54 +08:00
github-actions[bot]
2287c37486 docs: update version.c (#38976)
vim-patch:8.2.0900: function list test fails on MS-Windows
vim-patch:8.2.3918: function list test fails
vim-patch:9.2.0347: Vim9: script-local variable not found
vim-patch:f9cb0d14d CI: Separate out ASan tests
vim-patch:9.2.0361: tests: no tests for ch_listen() with IPs
vim-patch:336533b35 CI: Bump the github-actions group across 2 directories with 4 updates
vim-patch:9.2.0363: Vim9: variable shadowed by script-local function

vim-patch:8.2.0150: cannot define python function when using :execute
vim-patch:8.2.0344: ":def" not skipped properly
vim-patch:8.2.0755: Vim9: No error when variable initializer is not a constant
vim-patch:8.2.1732: stuck when win_execute() for a popup causes an error
vim-patch:8.2.2967: Vim9: crash when using two levels of partials
vim-patch:8.2.3023: Vim9: arguments for execute() not checked at compile time
vim-patch:8.2.3816: compiler warning for posible loss of data on MS-Windows

vim-patch:9.0.0028: MS-Windows: tests fail if there is a "runtime" directory
vim-patch:9.0.0571: MS-Windows: CTRL-C can make Vim exit
vim-patch:9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
vim-patch:9.0.0763: MS-Windows: warning for using int for size_t
vim-patch:9.0.0938: MS-Windows: debug executable not found when running test
vim-patch:9.0.1023: MS-Windows: dynamic loading of libsodium doesn't work

vim-patch:c98bfb9f59b8045372e4c0e396d707f55d9d027a
vim-patch:9.1.1207: MS-Windows: build warning in filepath.c
vim-patch:9.1.1499: MS-Windows: no indication of ARM64 architecture
vim-patch:9.1.1706: MS-Windows: Compile error when building with if_ruby
vim-patch:9.1.1813: MS-Windows: title bar is always white
vim-patch:9.1.1830: MS-Windows: Dark mode titlebar is not configurable
vim-patch:9.1.1966: MS-Windows: dark mode in gui is not supported
vim-patch:9.1.2006: MS-Windows: ANSI colors not correct in terminal
vim-patch:9.1.2046: MS-Windows: compile warnings
vim-patch:9.1.2081: MS-Windows: unnecessary "#ifdef FEAT_GUI" in os_win32.c
vim-patch:9.1.2129: MS-Windows: font size calculation slightly wrong, causing line gaps
vim-patch:9.1.2142: MS-Windows: mouse scroll events not handled for popups

vim-patch:9.2.0011: A few double semicolons after statement
vim-patch:9.2.0163: MS-Windows: Compile warning for unused variable
vim-patch:9.2.0179: MS-Windows: Compiler warning for converting from size_t to int
vim-patch:9.2.0215: MS-Windows: several tests fail in the Windows CUI.
vim-patch:9.2.0216: MS-Windows: Rendering artifacts with DirectX
vim-patch:9.2.0321: MS-Windows: No OpenType font support

vim-patch:dc47344: Fix a few typos
vim-patch:9.2.0353: Missing out-of-memory check in register.c
2026-04-20 14:20:41 -04:00
Justin M. Keyes
4ceca862fc refactor(test): drop deprecated exc_exec #39242 2026-04-20 14:16:41 -04:00
luukvbaal
faa7c15b5a fix(ui2): don't dismiss expanded messages for non-typed key #39247
Problem:  Invalid check for non-typed key to dismiss expanded cmdline.
          Unable to delay the timer that removes a message from the msg
          window.
Solution: Check for empty string instead of nil to determine whether a
          key is typed.
          Restart the timer if it expires while the user is in the msg
          window. Allow entering the msg window with a mouse click.
2026-04-20 11:38:47 -04:00
Luuk van Baal
607fcfb37a fix(ui2): ensure msg window is visible after closing tab
Problem:  After closing a tabpage while the msg window is showing a
          message, it is hidden while the msg window still contains a
          message.
Solution: Unhide the msg window after entering a tabpage and it still
          contains a message.

Co-authored-by: Linykq <yukunlin590@gmail.com>
2026-04-20 14:20:20 +02:00
Justin M. Keyes
6bd2f603aa ci(backport): drop needs:backport label #39244
Problem:
When auto-backport fails, it adds a `needs:backport` label. But that
label isn't being used AFAIK, based on the fact there were 30+ old PRs
with that label from last year (I have since cleaned those up). So the
extra step of having to remove the label is unnecessary friction.

In practice, when a manual backport is needed, it's best to either do it
immediately or just remove the `backport-xx` label.

Also, the presence of an unresolved "Failed backport" comment from the
bot is already a kind of marker that indicates a backport is needed.

Solution:
Don't add `needs:backport` label on failed backport.

Reverts https://github.com/neovim/neovim/pull/30363
2026-04-20 08:05:03 -04:00
Justin M. Keyes
2b52acfb8a docs: misc #39207 2026-04-20 07:09:37 -04:00
glepnir
01861c2f95 fix(api): expose fg_indexed/bg_indexed in nvim_get_hl #39210
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.
2026-04-20 05:12:52 -04:00
Justin M. Keyes
c7d4892ce6 Merge #39194 from justinmk/luavimfn 2026-04-20 04:23:54 -04:00
zeertzjq
2e8f285f6c vim-patch:partial:9.2.0368: too many strlen() calls when adding strings to dicts (#39237)
Problem:  too many strlen() calls when adding strings to dicts
Solution: Refactor code to use string_T, use dict_add_string_len()
          instead of dict_add_string() (John Marriott)

Additionally:
- In textprop.c, in function prop_fill_dict() use a string_T to store
  local variable text_align.
- In popupwin.c, use a string_T to store struct member pp_name in struct
  poppos_entry_T.
- In mark.c, refactor function add_mark() to pass in the length of
  argument mname.
- In insexpand.c:
  ->Use a string_T to store the elements of static array
    ctrl_x_mode_names.
  ->Refactor function trigger_complete_done_event():
  ->->change type of argument char_u *word to string_T *word.
  ->->make one access of array ctrl_x_mode_names instead of two.
  ->Refactor function ins_compl_mode() to accept a string_T to return the
    resulting string.
- In fileio.c:
  ->Refactor function getftypewfd() to accept a string_T to return the
    resulting string.
  ->In function create_readdirex_item() use a string_T to store local
    variable q.
- In cmdexpand.c, store global cmdline_orig as a string_T.
- In autocmd.c, in function f_autocmd_get() use a string_T to store local
  variables event_name and group_name. Measure their lengths once when
  they are assigned so they are not remeasured on each call to
  dict_add_string() in the subsequent for loop.
- In channel.c, in function channel_part_info() drop local variable status
  and use s instead. Make s a string_T.

closes: vim/vim#19999

c13232699d

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-04-20 08:14:11 +00:00
Jan Edmund Lazo
61daad3bba vim-patch:8.2.4912: using execute() to define a lambda doesn't work (#39229)
Problem:    Using execute() to define a lambda doesn't work. (Ernie Rael)
Solution:   Put the getline function in evalarg. (closes vim/vim#10375)

a7583c42cd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-20 11:36:47 +08:00
zeertzjq
310cc36fda Merge pull request #39201 from tomtomjhj/textoff-showbreak-crash
fix(smoothscroll): crash when resizing to textoff with showbreak
2026-04-20 09:45:12 +08:00
zeertzjq
2ee25ba41b vim-patch:9.2.0364: tests: test_smoothscroll_textoff_showbreak() fails
Problem:  tests: test_smoothscroll_textoff_showbreak() fails
          (after v9.2.0363)
Solution: Add missing CheckRunVimInTerminal

related: vim/vim#20011

618a327ce6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-04-20 09:31:31 +08:00
Jaehwang Jung
79a7a4abe1 fix(smoothscroll): crash when resizing to textoff with showbreak
vim-patch:9.2.0362: division by zero with smoothscroll and small windows

Problem:  Resizing a smoothscrolled wrapped window to its textoff width
          with 'showbreak' can leave wrapped continuation lines with
          zero text width. win_lbr_chartabsize() still runs the partial max_head_vcol calculation in
          that state and divides by width2, crashing during redraw.
Solution: Skip that partial head calculation when the wrapped
          continuation width is zero, matching the other width2 guards
          in charset.c (Jaehwang Jung)

closes: vim/vim#20012

AI-assisted: Codex

0e31fb024c
2026-04-20 09:30:30 +08:00
zeertzjq
a433f1d0ac vim-patch:9.2.0365: using int as bool (#39232)
Problem:  using int as bool
Solution: refactor: use bool type for internal flags in buf_T
          (Hirohito Higashi)

Change the type of 23 internal state flag fields in buf_T from int
to bool for improved type clarity and code readability.

These fields are pure boolean flags that are never accessed via the
option system's varp (which uses *(int *)varp = value), never compared
with int fields holding non-0/1 values, and never use tristate values.

Converted fields:
- State flags: b_dev_valid, b_saving, b_mod_set, b_new_change,
  b_marks_read, b_modified_was_set, b_did_filetype, b_keep_filetype,
  b_au_did_filetype, b_u_synced, b_scanned, b_p_initialized
- Characteristic flags: b_has_textprop, b_may_swap, b_did_warn,
  b_help, b_spell, b_shortname, b_has_sign_column, b_netbeans_file,
  b_was_netbeans_file, b_write_to_channel, b_diff_failed

All TRUE/FALSE assignments to these fields have been updated to
true/false accordingly. The type of temporary save variables
(e.g. help_save in tag.c) has also been adjusted to bool.

Option value fields (b_p_XXX) are kept as int because they are
accessed via the option system and some use tristate (-1) semantics.
Fields compared with int option values (b_start_eof, b_start_eol,
b_start_bomb) are also kept as int to preserve comparison integrity.

closes: vim/vim#20020

1966a1c896

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 01:08:38 +00:00
luukvbaal
fe986e5dd0 feat(options): add 'winpinned' to pin a window #39157
Problem:
- Unable to "pin" a window to prevent closing without specifically
  being targeted.
- :fclose closes hidden windows (even before visible windows).

Solution:
- Add 'winpinned' window-local option. When set, window is skipped by
  :fclose and :only. Pin the ui2 cmdline window (which should always be
  visible), so that it is not closed by :only/fclose.
- Skip over hidden (and pinned) windows with :fclose.

Co-authored-by: glepnir <glephunter@gmail.com>
2026-04-19 20:36:55 -04:00
Justin M. Keyes
ea45e6f6ba fix(health): workaround nil vim.system():wait() result
Workaround until https://github.com/neovim/neovim/issues/37922 is fixed.
2026-04-20 02:31:09 +02:00
Justin M. Keyes
7542323865 fix(jobstart): use uv_os_environ directly 2026-04-20 02:31:09 +02:00
Justin M. Keyes
a38451be40 fix(excmd): nlua_call_excmd require() failure is a "lua_error"
Although `nlua_call_excmd` is semantically for implementing Ex-commands,
the `require()` should never fail, so that's a "Lua error".

But if the call itself fails (the later `semsg` call), that's an "Ex
cmd" error.
2026-04-20 02:31:09 +02:00
Justin M. Keyes
919a109951 refactor(excmd): migrate ex_terminal to Lua 2026-04-20 02:31:09 +02:00
Justin M. Keyes
b8dcb34839 refactor(excmd): migrate help.c to Lua 2026-04-20 02:12:05 +02:00
Justin M. Keyes
fe7218528d refactor(excmd): migrate ex_checkhealth to Lua 2026-04-20 02:12:05 +02:00
Maria Solano
5f6abd34f5 fix(lsp): notify when maximum created hl groups is reached #39231 2026-04-19 19:05:51 -04:00
Maria Solano
e8b3968774 docs(lsp): description for on_list example #39230 2026-04-19 18:30:45 -04:00
Jaehwang Jung
f2cc0a249d fix(drawline): hang while redrawing diff filler above fold #39219
Problem:
win_line() falls into infinite loop when a diff window has top filler
above its first visible buffer line, that first visible buffer line is a
closed fold, and the folded line uses normal non-empty foldtext.

Solution:
Allow flushing pending diff filler rows even when the underlying buffer
line is folded with foldtext.

AI-assisted: Codex

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-04-19 12:29:31 -04:00
Olivia Kinnear
c6209e5542 feat(excmd): add EXX error codes for :lsp, :log #39135
Also remove the `--add-comments` flag from `xgettext` because
it dumped a bunch of comments from Lua files into the `.pot` files.
2026-04-19 10:40:49 -04:00
Ashley Hauck
4b54bca3df feat(events): trigger MarkSet autocmd in :delmarks #39156
Problem:
`api.nvim_buf_del_mark` already emits a `MarkSet` event with `col` and `line` set to 0. However, `:delmarks` currently emits no events.

Solution:
Change `:delmarks` to emit the same `col==line==0` event.
2026-04-19 07:42:08 -04:00
zeertzjq
d393975b04 Merge pull request #39211 from janlazo/vim-8.2.2245
vim-patch:8.2.{2245,3024}
2026-04-19 10:35:04 +08:00
Jan Edmund Lazo
9ded2fb7c8 vim-patch:8.2.3024: execute() function test fails
Problem:    execute() function test fails.
Solution:   Adjust test for different error.

2fb1b89d72

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-18 22:20:01 -04:00
Jan Edmund Lazo
cb4eb1b33b vim-patch:8.2.2245: Vim9: return value of winrestcmd() cannot be executed
Problem:    Vim9: return value of winrestcmd() cannot be executed.
Solution:   Put colons before each range. (closes vim/vim#7571)

285b15fce1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-18 21:55:03 -04:00
Jaehwang Jung
88dd492996 fix(lsp): stale codelens after external file change (#39203)
Problem:
Codelens virtual lines remain on stale rows after an external file
change and buffer reload.

Solution:
Clear codelens extmarks and cached row/version state in `on_reload`
before requesting fresh code lenses.
2026-04-18 18:27:02 -07:00
glepnir
b351afb1b1 fix(lsp): show CompletionItem.detail in info popup #38904
Problem: completionItem/resolve response's `detail` field is silently
dropped. Only `documentation` is shown in the popup.

Solution: Prepend `detail` as a fenced code block before `documentation`
in the info popup, skipping if documentation already contains it.
2026-04-18 15:43:20 -04:00
Justin M. Keyes
54398c5874 docs: misc #39045 2026-04-18 15:38:59 -04:00
Jaehwang Jung
97caa88972 fix(lsp): skip codelens refresh redraw for deleted buffer #39193
Problem:
After on_refresh() sends a textDocument/codeLens request, the buffer may
be deleted before the response arrives. The response callback then tries
to redraw that deleted buffer and raises Invalid buffer id error.

Solution:
Check buffer validity before redrawing.

AI-assisted: Codex
Co-authored-by: Yi Ming <ofseed@foxmail.com>
2026-04-18 15:38:09 -04:00
phanium
f0329092f7 fix(eval): crash on some NULL ptr deref #39182
Crash on
```
let busy=$FOO
call prompt_setcallback(bufnr('%'), $FOO)
call chanclose(1, $FOO)
```

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-04-18 14:08:10 -04:00
Aditya Malik
2cb240319b 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.
2026-04-18 13:17:45 -04:00
Evgeni Chasnovski
3a4cc5db0b fix(lua): make vim._with() work with buf=0 and win=0 context #39151
Problem: Using `buf=0`/`win=0` context in `vim._with` should be
  equivalent to using explicit buffer/window identifier respectively.

Solution: Explicitly adjust context in case of `buf=0` or `win=0`.
2026-04-18 12:04:28 -04:00
Justin M. Keyes
a306cd7028 Merge #39176 from justinmk/luavimfn 2026-04-18 11:15:01 -04:00
Justin M. Keyes
6701b45331 refactor(vimfn): full-Lua impl of vim.fn.environ() 2026-04-18 16:57:37 +02:00
Justin M. Keyes
3ebfa2a3cb feat(vimfn): use Lua for more excmds/vimfns
Problem:
Too much boilerplate needed to use Lua to impl an excmd or f_xx
function.

Solution:
- Add `nlua_call_vimfn` which takes the args typval, executes
  Lua, and returns a typval.
- refactor(excmd): lua impl for :log, :lsp
2026-04-18 16:57:37 +02:00
zeertzjq
48d11681c2 test(tui_spec): don't run tty-test in a shell (#39186) 2026-04-18 19:53:19 +08:00