Commit Graph

11029 Commits

Author SHA1 Message Date
Jan Edmund Lazo
0df53062df vim-patch:8.2.0232: the :compiler command causes a crash (#41087)
Problem:    The :compiler command causes a crash. (Daniel Steinberg)
Solution:   Do not use the script index if it isn't set.

----

ex_vim9script() is N/A.

----

165315584d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-08-01 17:45:41 +08:00
zeertzjq
86bbe41459 vim-patch:9.2.0885: scroll: 'smoothscroll' position is lost when the window is squeezed
Problem:  With 'smoothscroll' the scroll position in a long line is lost when
          a window is temporarily squeezed to a couple of lines, for example
          when opening and closing a help window.
Solution: When the cursor ends up in the skipped columns, skip up to the
          screen line the cursor is in instead of showing the start of the
          line.

closes: vim/vim#20892

15f8ba5cec

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 08:30:39 +08:00
zeertzjq
d9525e23f3 vim-patch:9.2.0883: scroll: 'smoothscroll' position is lost when using "|"
Problem:  With 'smoothscroll' the scroll position in a long line is lost when
          moving to a column with "|".
Solution: Adjust the skipped columns for the column the cursor ends up in,
          not for column zero.

related: vim/vim#20885
closes:  vim/vim#20890

5ed8fc10fa

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 08:27:52 +08:00
zeertzjq
f8872bccbe vim-patch:9.2.0882: :bwipe crashes if WinLeave wipes all other buffers (#41082)
Problem:  :bwipe crashes if WinLeave wipes all other buffers
          (after 9.1.2068).
Solution: Check for NULL pointer.

related: neovim/neovim#41066
closes: vim/vim#20888

3e4019a082
2026-07-31 23:25:28 +00:00
Justin M. Keyes
3e01dcddbe refactor(options): memory management
Problem:
Numerous callers have to manually check optval ownership (i.e. whether,
and how, to release) via `is_callback_option`, `option_is_global_local`,
etc. This is fragile, hard to use correctly; and if we introduce another
optval variant in the future, we'll have to redo all of these careful
checks and boilerplate again.

Solution:
Provide a unified system and use it everywhere:

    optval_free_owned
    optval_is_owned
    optval_own
2026-07-31 21:50:04 +02:00
Justin M. Keyes
726d1a92d2 feat(options): lua closure/function options
Problem:
Cannot assign Lua functions/closures to "func" ('completefunc',
'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options.

Solution:
- Store "func"/"expr" options as `Callback` instead of string.
- Delete oceans of copy-pasted code.
- BREAKING: LuaRef returned via RPC/Vimscript is now represented as
  `"<Lua N: file:line>"` (like what `:map` shows) instead of `nil`.
- Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin.

Helped-by: Lewis Russell <lewis6991@gmail.com>
2026-07-31 21:50:04 +02:00
Justin M. Keyes
917232b508 Merge #40953 from barrettruth/feat/zip-extract
feat(zip): extract archive entries
2026-07-31 15:45:14 -04:00
zeertzjq
f7cc79edf4 vim-patch:9.2.0881: 'smoothscroll' position is lost when the window height changes
Problem:  With 'smoothscroll' the scroll position of a window is lost when
          its height changes.
Solution: Only reset the skipped columns when 'smoothscroll' is off, where
          they just serve to keep the cursor visible.

closes: vim/vim#20885

17f3923b8c

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 11:22:27 +08:00
zeertzjq
f9040dbe03 vim-patch:9.2.0880: scroll: window scrolls when using the autocommand window
Problem:  The window scrolls when an autocommand window is used while the
          cursor is behind multi-byte characters.
Solution: Use the byte column instead of the character count when computing
          how many screen lines the text up to the cursor takes.

fixes:  vim/vim#12085
closes: vim/vim#20884

7fe3ea7658

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 11:22:26 +08:00
zeertzjq
41378d4610 vim-patch:e241ac0: runtime(zip): fix failure on Windows CI
Problem:  The zip autoload script aborts loading when the "zip"
          command is not available, so even read-only browsing of an
          archive fails with E117 (zip#Browse undefined) on systems
          that have "unzip" but not "zip" (e.g. the Windows CI
          runner).  Regressed in b0e0b22.
Solution: Drop the load-time executable gate and check each command
          per operation instead, so a missing "zip" only affects
          writing.  Update the test to match the reworded message.

e241ac0a62

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-31 09:32:40 +08:00
zeertzjq
d93684023f vim-patch:9.2.0871: screen line is lost when splitting a 'winfixheight' window (#41054)
Problem:  When the only window has 'winfixheight' set and 'laststatus'
          is one, splitting it leaves one screen line unused.  This
          happens for example when jumping to an item from a maximized
          quickfix window (rendcrx)
Solution: Do not subtract the height of the status line twice
          (Hirohito Higashi)

fixes:  vim/vim#20495
closes: vim/vim#20871

ab36bcc870

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 23:12:10 +00:00
zeertzjq
9a4b38584c vim-patch:9.2.0874: fold size is compared against 'foldminlines' of the wrong window (#41051)
Problem:  checkSmall() compares the fold size of window "wp" against
          the current window's 'foldminlines'.  A fold of another
          window, e.g. measured while it is redrawn, is judged by an
          unrelated option value.
Solution: Use 'foldminlines' of the window containing the fold
          (Igor Mikushkin).

closes: vim/vim#20864

773dc19f14

Co-authored-by: Igor Mikushkin <igor.mikushkin@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-07-29 22:19:12 +00:00
Barrett Ruth
1bba96f259 fix(test): group zip tests and drop repeated setup 2026-07-29 14:32:37 -05:00
Barrett Ruth
1ffbd3598a test(zip): cover difficult member names 2026-07-29 14:32:37 -05:00
Barrett Ruth
36204b4323 feat(zip): extract archive members 2026-07-29 14:32:37 -05:00
Barrett Ruth
f82cf8fd59 fix(zip): list a valid empty archive as empty 2026-07-29 14:32:36 -05:00
Barrett Ruth
e63cf57106 fix(zip): keep a leading dash from becoming a backend option 2026-07-29 14:32:36 -05:00
Barrett Ruth
e29af9c32f refactor(zip)!: builtin zip.lua plugin #40846
Problem:
The bundled `zip` plugin is implemented in Vimscript, making it harder to
maintain and build on with Nvim's Lua runtime infrastructure.

Solution:
Add an opt-out `zip.lua` browser backed by `nvim.dir`, and disable the legacy
Vimscript implementation by moving it to `pack/dist/opt/zip/`. Load it with
`:packadd zip`.
2026-07-29 12:54:43 -04:00
Nathan Zeng
1dbc766fa7 fix(ui2): clear empty cmdline after backspace #41043
Problem:
Cmdline area shows stale ":" after backspacing out of the command line.

Solution:
Clear the command line for empty commands. Note that `:<CR>` will now
clear the command line too.
2026-07-29 12:40:08 -04:00
zeertzjq
7b7a21bd2a vim-patch:9.2.0869: buf_copy_options() can lose the P_INSECURE flag (#41040)
Problem:  An insecurely-set 'indentexpr', 'formatexpr', 'includeexpr'
          or 'complete' value can end up evaluated outside the
          sandbox after buf_copy_options() and clears the flag.
Solution: Copy the insecure flag alongside the value in
          buf_copy_options(), and make 'complete' a per-buffer
          insecure-flags field

Supported by AI.

closes: vim/vim#20861

35f7fdfdfb

I'm a bit hesitant to port this, but it's a follow-up to #39452.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-07-29 17:44:51 +08:00
zeertzjq
1eba3a75da vim-patch:9.2.0870: filetype: marko files are not recognized (#41038)
Problem:  filetype: marko files are not recognized
Solution: Detect *.marko files as marko filetype, include a syntax
          plugin and add syntax tests (Brian Carbone)

References:
https://markojs.com
https://github.com/marko-js/tree-sitter
https://github.com/marko-js/language-server
https://v5.markojs.com/docs/editor-plugins/

closes: vim/vim#20863

95da62a910

Co-authored-by: Brian Carbone <brian@briancarbone.com>
2026-07-29 09:14:48 +08:00
Barrett Ruth
635acc7dc8 fix(terminal): cursor moves on resize when line above is full width #40996 2026-07-28 14:59:18 -04:00
Barrett Ruth
0d36e61d70 fix(dir): "-" on a non-file buffer opens a bogus path #41034 2026-07-28 13:37:06 -04:00
Evgeni Chasnovski
4bba83b4b7 fix(pack): do not write the lockfile when installing from it #41031
Problem: Installing plugins during lockfile synchronization always
  writes the lockfile, even though its content is used during install.
  This might be a problem if the lockfile (itself or its parent
  directory) is not writeable (can only be read).

Solution: Do not write the lockfile when installing directly from it.
  This is okay since the `src` and `rev` are used directly from the
  lockfile and don't change at this step. While potential change in
  `version` (that must be written to the lockfile) is handled in other
  code path.
2026-07-28 09:46:13 -04:00
glepnir
3fa5904cf2 fix(lsp): multibyte fragment treated as commit char #41019
Problem:
commit_chars_str() reads a 0x80-0xBF byte as a 2-byte lead, so
"\xA9x" makes "x" a commit character. nvim_get_hl() returns
a dict, so `#` on it is 0 whether or not the group exists

Solution:
use vim.str_utf_end() and drop entries that are not one whole
character. use next check dict length.
2026-07-28 08:39:03 -04:00
tianrking
089c415cb2 fix(floatwin): relative='cursor' may use outdated cursor position #40768
Problem:
Cursor-relative floats can use stale screen coordinates after a cursor move is restored without a redraw.

Solution:
Validate the current cursor before converting cursor-relative coordinates.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-07-28 07:32:35 -04:00
glepnir
916a6e9546 fix(eval): complete_info() equal, preselect, commit_chars #41022
Problem:  complete_info() does not report "equal", "preselect" or "commit_chars".

Solution: Report them for the items that set them.
2026-07-28 07:24:58 -04:00
Olivia Kinnear
5226e26e99 feat(pos): vim.pos.cursor() without args returns curwin pos #40975 2026-07-28 07:21:45 -04:00
zeertzjq
205a1ce4c7 test(old): map gQ to 1q: (#41025) 2026-07-28 18:11:42 +08:00
zeertzjq
5745ea93f1 vim-patch:9.2.0860: filetype: xilinx design constraint files are not recognized (#41024)
Problem:  filetype: xilinx design constraint files are not recognized
Solution: Detect *.xdc files as tcl filetype (Wu, Zhenyu)

Reference:
https://docs.amd.com/r/en-US/ug903-vivado-using-constraints/About-XDC-Constraints

closes: vim/vim#20853

247a4cb45e

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2026-07-28 18:11:29 +08:00
Milad Rashidikhah
20ff82d9fc fix(treesitter): clamp unbounded fold ranges
Problem:
Tree-sitter uses UINT32_MAX for full-document ranges, which becomes -1 on 32-bit platforms and reaches _foldupdate as an invalid end row.

Solution:
Treat negative changed-range end rows as unbounded and clamp them to the buffer line count. Add a regression test that simulates the 32-bit sentinel.

AI-assisted: Codex
2026-07-28 11:00:30 +02:00
Barrett Ruth
e3c5974adf feat(dir): open cwd with 1- #40948 2026-07-27 18:30:54 -04:00
Justin M. Keyes
fbcb7a056c feat(exmode): "1q:", :exmode #41010
Problem:
Want `gQ` for _le multicursor_.

Solution:
- Don't use `gQ` for exmode.
- Introduce `:exmode`.
- Introduce `[count]q:` as an alias to `:exmode`.
2026-07-27 11:12:47 -04:00
Josh Hirschkorn
97a71ab484 fix(man): use direct lookup without manpath #40421
Problem:
On NetBSD, `man -w open` can return the exact manpage path, but `:Man`
may still fail when man directories cannot be discovered from `manpath
-q`, bare `man -w`, or `$MANPATH`.

Solution:
Fall back to the direct manpage lookup when directory discovery fails.
Add a test for resolving `open(2)` through `goto_tag()` without manpath
data.
2026-07-27 13:20:46 +00:00
glepnir
0b3b12da8d fix(completion): "preselect" ignores "noinsert", menu order #41007
Problem:  A preselected item is inserted even with "noinsert", and the
          first added preselected item wins over the first one shown
          in the menu.
Solution: Use K_DOWN when "noinsert" is set; pick the first preselected
          item that made it into the menu.
2026-07-27 08:49:12 -04:00
Justin M. Keyes
80cd482577 fix(lua): vim.regex():match_str abort in Luv callback #41008 2026-07-27 11:01:54 +00:00
Justin M. Keyes
359459dec6 refactor(exmode): Ex-mode as cmdwin + Lua #40991
Problem:
POSIX-compatible Ex-mode requires special-cases all over the codebase to
match various quirks that don't actually matter to users.
- The main utility of *interactive* Ex-mode is its REPL behavior, and
  that can be achieved with `cmdwin`, which also gains extra UX
  benefits.
- The main utility of *non-interactive* `nvim -es` is for shell
  scripting, where Ex-mode quirks are mostly unhelpful (e.g. the
  "Entering Ex mode" message).

Solution:
- Reimplement *interactive* Ex-mode as a "persistent, insert-mode
  cmdwin" in Lua.
  - "nvim -e/-E" is simply an alias to "gQ".
- Reframe *non-interactive* Ex-mode (`nvim -es`) as "script mode".
  - Drop POSIX Ex-mode quirks.

Improvements:
- "nvim -V1 -es" output ends with a final newline!
- "nvim -V1 -es" no longer shows the "Entering Ex mode" msg. (This was
  pointless noise, unwanted for scripting purposes.)
- stdin is no longer typeahead. Scripts (":lua io.read()") can read
  stdin as data.
- Empty line is a no-op: a stray blank line no longer moves the cursor
  (deviates from POSIX ex "+1"), no longer exits 1 at EOF (E501).

Preserved behavior:
- cursor starts at "$"
- mode()=="cv" (for non-interactive)
- multiline commands (:append/:function/heredoc pull continuation lines)
- bare-range print
- :print=>stdout
- -V1=>stderr
- CRLF input
- continue-after-error and exit codes

Dropped (regressed) POSIX behavior (non-interactive):
- Event loop only ticks while/between commands, not while blocked
  waiting for a stdin line.
- ":g/pat/visual...Q"
- input()/getchar()/":s/x/y/c" no longer consume stdin lines as
  answers: Nvim stops at end-of-input, skipping the rest of the script,
  exit 0. Use ":lua io.read()" instead.
  - If users care about this they should use interactive Ex-mode (`gQ`).
- ":@r" stops at end of the register instead of continuing to read
  cmdline input from stdin.
2026-07-27 06:25:21 -04:00
Barrett Ruth
faaa4d57f1 test: start plugin specs with --clean #40995 2026-07-27 04:26:11 -04:00
Dominic Della Valle
4a5062cda6 fix(path): DOS device path check #40976
Problem:
The current check is intended to match DOS device paths starting with
`\\?` or `\\.` but will match any path starting with `?` or `.`,
including relative paths such as `.\`.
This is because the leading slashes are removed before the comparison.

Solution:
Changes the check to include the path's prefix, assuring the path has
the correct amount of separators for a DOS device path.
2026-07-26 07:18:57 -04:00
Artem Krinitsyn
dec3d8215d fix(text): indent() ignores expandtab when indent unchanged #40932
Problem:
After expanding tabs with the `expandtab` option, if the old indent
matches the requested one, `vim.text.indent()` returns the input
unchanged.
The optimization path assumes that if old_indent == size, the input
wouldn't be changed, which is not correct when old_indent is formed by
expanded tabs.

Solution:
Apply the optimization only when `expandtab` is not set.
2026-07-26 06:24:39 -04:00
Justin M. Keyes
6539bd6602 Merge #40910 from barrettruth/fix/dir-literal-env-paths 2026-07-26 06:11:01 -04:00
Barrett Ruth
3d5de7fd11 fix(buffer): name becomes empty when it is the cwd #40980
Problem: Shortening the name of a buffer whose full name is the current
directory + path sep yields empty string -> buf unnamed.
This doesn't interact well with things like `:mksession`, which
for example could `:badd` with no arg -> E471.

Solution: Keep the full path when shortening yields an empty name, as
`path_try_shorten_fname()` already does.
2026-07-26 05:36:03 -04:00
zeertzjq
7ee1bf91ad vim-patch:9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout
Problem:  'showcmd' not redrawn with empty mapping triggered on timeout.
Solution: Don't postpone redraw when inside vgetorpeek(). Also move test
          for tabline 'showcmd' to test_tabline.vim.

fixes:  vim/vim#20839
closes: vim/vim#20840

2e9687647a
2026-07-26 07:07:38 +08:00
zeertzjq
a56f4d221e vim-patch:partial:9.2.0806: 'showcmd' may show internal command keys
Problem:  The `showcmd` statusline item may show internal command keys when a
          `<Cmd>` or `<ScriptCmd>` mapping redraws the statusline, and may
          leave stale text behind when `%S` is rendered directly.
Solution: Do not add these internal mapping dispatch keys to the `showcmd`
          buffer, and keep the clear state in sync when `%S` renders it
          (Barrett Ruth)

closes: vim/vim#20769

bd730293dc

Co-authored-by: Barrett Ruth <br@barrettruth.com>
2026-07-26 07:07:35 +08:00
Barrett Ruth
1594ca2368 fix(dir): preserve environment variables in paths 2026-07-25 18:02:55 -05:00
Barrett Ruth
ac4e5460b1 feat(vim.fs): dir(opts.normalize) 2026-07-25 18:02:55 -05:00
Justin M. Keyes
256a88d0ac Merge #40579 from barrettruth/fix/del-keymap-lhs-only-30258 2026-07-25 16:00:25 -04:00
mityu
26fed075ae fix(cmdwin): q: in visual-mode does not insert visual range #40973
Problem: `q:` in visual mode does not insert `'<,'>` automatically in
the current line on cmdwin.

Solution: Insert `'<,'>` in the current line on cmdwin when `q:` is used
in visual mode.
2026-07-25 15:50:31 -04:00
Barrett Ruth
22d44ef875 fix(api): add lhs option for keymap deletion 2026-07-25 10:36:56 -07:00
Barrett Ruth
6ffbb2962c test(api): allow added optional params 2026-07-25 10:01:08 -07:00