9639 Commits

Author SHA1 Message Date
zeertzjq
acc3554439 vim-patch:9.1.2037: undo: cursor position not correctly restored (#37195)
Problem:  undo: cursor position not correctly restored
Solution: Do not override the saved cursor position (altermo)

closes: vim/vim#19052

a722da29c1

Co-authored-by: altermo <107814000+altermo@users.noreply.github.com>
2026-01-02 08:21:55 +08:00
zeertzjq
94f7302e66 vim-patch:9.1.0893: No test that undofile format does not regress (#37193)
Problem:  No test that undofile format does not regress
Solution: include a sample undofile to make sure we are always able to
          read it

This is so, that we don't unintentionally change the undofile format and
make sure we can load an undo file that has been created by an older
Vim.

closes: vim/vim#16127

14382c8bc9

Convert the undo file in samples/ using method from #13973.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-01 23:05:48 +00:00
altermo
170992c8d2 test(tohtml): test syntax, not just treesitter #37181 2025-12-31 18:00:05 -05:00
Christian Clason
f3ee2440c7 build(deps): bump tree-sitter-lua to v0.4.1 2025-12-31 16:49:24 +01:00
zeertzjq
bd10f781b8 vim-patch:9.1.2035: filetype: filetype: Fennel fnlm files are not recognized (#37178)
Problem:  filetype: Fennel fnlm files are not recognized
          (Alexei Mozaidze, after v9.1.2034)
Solution: Detect *.fnlm files as fennel filetype, revert detecting
          *.fnml files

related: vim/vim#19047

ea189a6f4d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-31 20:25:19 +08:00
zeertzjq
8e80e54478 vim-patch:9.1.2034: filetype: Fennel fnml files are not recognized (#37176)
Problem:  filetype: Fennel fnml files are not recognized
          (Alexei Mozaidze)
Solution: Detect *.fnml files as fennel filetype

Reference:
- https://fennel-lang.org/changelog#160--2025-10-13

fixes: vim/vim#19047

9c87af5c3c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-31 10:39:50 +00:00
Justin M. Keyes
b24522e77b Merge #37113 from echasnovski/pack-better-revert 2025-12-30 10:40:19 -05:00
glepnir
9833f0da5f fix(diagnostic): unstable sorting by severity #37154
Problem: random order for same-severity diagnostics, severity_sort reversed.

Solution: add stable comparison with _extmark_id tiebreaker.
2025-12-30 04:28:32 -05:00
Justin M. Keyes
ea3562d739 Merge #37142 from echasnovski/pack-safer-del 2025-12-30 04:20:33 -05:00
Justin M. Keyes
1d70c96e5b build: move shared.lua to _core/ 2025-12-30 01:44:52 -05:00
Justin M. Keyes
20e77c5d88 build: ship "_core/*" as bytecode (built-into Nvim binary)
Problem:
We want to encourage implementing core features in Lua instead of C, but
it's clumsy because:
- Core Lua code (built into `nvim` so it is available even if VIMRUNTIME
  is missing/invalid) requires manually updating CMakeLists.txt, or
  stuffing it into `_editor.lua`.
- Core Lua modules are not organized similar to C modules, `_editor.lua`
  is getting too big.

Solution:
- Introduce `_core/` where core Lua code can live. All Lua modules added
  there will automatically be included as bytecode in the `nvim` binary.
- Move these core modules into `_core/*`:
  ```
  _defaults.lua
  _editor.lua
  _options.lua
  _system.lua
  shared.lua
  ```

TODO:
- Move `_extui/ => _core/ui2/`
2025-12-30 01:44:24 -05:00
Kyle
03377b9552 feat(terminal): include sequence terminator in TermRequest event (#37152)
Problem:
Terminals should respond with the terminator (either BEL or ST) used in
the query so that clients can reliably parse the responses. The
`TermRequest` autocmd used to handle background color requests in the
terminal does not have access to the original sequence terminator, so it
always uses BEL. #37018

Solution:
Update vterm parsing to include the terminator type, then forward this
data into the emitted `TermRequest` events for OSC/DCS/APC sequences.
Update the foreground/background `TermRequest` callback to use the same
terminator as the original request.

Details:
I didn't add the terminator to the `TermResponse` event. However, I
assume the `TermResponse` event doesn't care about the terminator
because the sequence is already parsed. I also didn't update any of the
functions in `src/nvim/vterm/state.c` that write out responses. It
looked like those all pretty much used ST, and it would be a much larger
set of changes. In that same file, there's also logic for 8 bit ST
sequences, but from what I can tell, 8 bit doesn't really work (see `:h
xterm-8bit`), so I didn't use the 8 bit ST at all.
2025-12-29 16:30:23 -06:00
Evgeni Chasnovski
28ba99e026 feat(pack)!: suggest "delete" code action only for not active plugins
Problem: Deleting active plugins can lead to a situation when it is
  reinstalled after restart.

Solution: Suggest "delete" code action only for not active plugins.
  Whether a plugin is not active is visible by a hint in its header.
2025-12-28 18:39:26 +02:00
Evgeni Chasnovski
c339b83a4a feat(pack): hint in confirmation buffer that plugin is not active
Problem: After `vim.pack.update()` it is not clear if plugin is active
  or not. This can be useful to detect cases when plugin was removed
  from 'init.lua' but there was no `vim.pack.del()`.

Solution: Add ` (not active)` suffix with distinctive highlighting to
  header of plugins that are not active.
  It will also be shown in in-process LSP document symbols to have quick
  reference about which plugins are not active.
2025-12-28 18:39:26 +02:00
Evgeni Chasnovski
f5707a9c42 feat(pack)!: make del() only remove non-active plugins by default
Problem: Using `vim.pack.del()` to delete active plugin can lead to
  a situation when this plugin is reinstalled after restart. Removing
  plugin from 'init.lua' is documented, but can be missed.

Solution: Make `del()` only remove non-active plugins by default and
  throw an informative error if there is an active plugin.

  Add a way to force delete any plugin by adding `opts.force`. This also
  makes `del()` signature be the same as other functions, which is nice.
2025-12-28 18:39:26 +02:00
zeertzjq
444e1ffe3e vim-patch:9.1.2028: [security]: Buffer-overflow with incomplete multi-byte chars (#37133)
Problem:  Buffer overflow in buf_write() when converting incomplete
          multi-byte characters (Kevin Goodsell)
Solution: Make the buffer slightly larger

closes: vim/vim#19007

f99de42a9f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-28 00:37:55 +00:00
zeertzjq
7f1d7271d5 vim-patch:9.1.2027: filetype: bicep filetype used for 2 bicep file types (#37130)
Problem:  filetype: bicep filetype used for 2 bicep file types
Solution: Detect *.bicepparam files as bicep-param filetype, include
          new bicep-params and bicep filetype plugin
          (Scott McKendry)

The bicep language server handles parameter files differently than
regular bicep files. Treating them the same at the editor level leads to
false positive diagnostics in the editor.

References:

Bicep Language Constants:
- 51392d32ca/src/Bicep.Core/LanguageConstants.cs (L23)
VS Code Extension definition:
- 51392d32ca/src/vscode-bicep/package.json (L47)

closes: vim/vim#19026

4e722fdfdd

Co-authored-by: Scott McKendry <me@scottmckendry.tech>
2025-12-28 00:16:20 +00:00
zeertzjq
1e44a001ec vim-patch:9.1.2024: 'fsync' option cannot be set per buffer (#37129)
Problem:  'fsync' option cannot be set per buffer
Solution: Make 'fsync' option global-local
          (glepnir)

closes: vim/vim#19019

4d5b303726

Co-authored-by: glepnir <glephunter@gmail.com>
2025-12-28 08:14:45 +08:00
zeertzjq
f4eabcca4f vim-patch:9.1.2026: tests: patch 9.1.2019 not tested properly
Problem:  tests: patch 9.1.2019 not tested properly.
Solution: Add missing :exe (zeertzjq).

closes: vim/vim#19028

78046cc539
2025-12-28 07:02:03 +08:00
zeertzjq
e53accf8ec vim-patch:9.1.2019: inconsistent cursor encoding past EOL with ve=all
Problem:  When virtualedit is set to all, the cursor is supposed to be
          permitted to reside anywhere, including on the virtual space
          beyond the end of the buffer's text. Switching modes triggered
          a routine that "fixed" a cursor that was past the end of the
          line by shifting it back to the last actual character in the
          line and compensating with a virtual column offset. While
          visually identical, this re-encoding changed the underlying
          byte index, causing position-reporting functions to return
          inconsistent values after a mode change.
Solution: Skip this coordinate adjustment when virtual editing is fully
          enabled. By treating the line terminator as a valid, stable
          position, the cursor’s internal representation remains
          unchanged when entering or exiting Visual mode, ensuring
          consistent coordinate reporting. Add a regression test to
          check this functionality.
          (McAuley Penney)

fixes:  vim/vim#16276
closes: vim/vim#19009

491f0fa457

Co-authored-by: McAuley Penney <jacobmpenney@gmail.com>
2025-12-28 07:01:45 +08:00
glepnir
922816877f fix(pum): hide info floating window when insufficient space (#37107)
fix(pum): hide info window when insufficient space

Problem:
1. Info window was displayed even with insufficient space.
2. Tab characters counted as single cells.

Solution:
1. Hide window when space < 10 columns. Will be configurable
   via completepopup width option in the future.
2. Use win_linetabsize over mb_string2cells.
2025-12-27 13:56:34 +00:00
zeertzjq
c11153b320 vim-patch:9.1.2021: filetype: fluent files are not recognized (#37117)
Problem:  filetype: fluent files are not recognized
Solution: Detect *.ftl files as fluent filetype (ners)

References:
- https://projectfluent.org/

closes: vim/vim#19011

b91b30643a

Co-authored-by: ners <ners@gmx.ch>
2025-12-27 01:35:19 +00:00
zeertzjq
7b5276b382 vim-patch:9.1.2020: tests: test_virtualedit.vim leaves swapfiles behind (#37115)
Problem:  tests: test_virtualedit.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!

a8a0ee5004

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-27 00:57:52 +00:00
Evgeni Chasnovski
c9965491d0 feat(pack): allow running update() without Internet connection
Problem: There is now way to run `update()` without Internet connection
  while there are some workflows that do not require it. Like "switch
  plugin version" and "revert latest update".

Solution: Add `opts.offline` to `update()`. This also allows now to
  treat `vim.pack.update(nil, { offline = true })` as a way to
  interactively explore currently installed plugins.
2025-12-26 20:05:12 +02:00
Evgeni Chasnovski
8c28507fcf feat(pack): allow choosing update target in update()
Problem: There are two fairly common workflows that involve lockfile and
  can be made more straightforward in `vim.pack`:

    1. Revert latest update. Like if it introduced unwanted behavior.

    2. Update to a revision in the lockfile. Like if already updated
       on another machine, verified that everything works, `git add` +
       `git commit` + `git push` the config, and want to have the same
       plugin states on current machine.

Solution: Make `update` allow `opts.target`. By default it uses
  `version` from a plugin specification (like a regular "get new changes
  from source" workflow). But it also allows `"lockfile"` value to
  indicate that target revision after update should be taken from the
  current lockfile verbatim.

  With this, the workflows are:

    1. Revert (somehow) to the lockfile before the update, restart, and
       `vim.pack.update({ 'plugin' }, { target = 'lockfile' })`. If Git
       tracked, revert with `git checkout HEAD -- nvim-pack-lock.json`.
       For non-VCS tracked lockfile, the revisions can be taken from the
       log file. It would be nicer if `update()` would backup a lockfile
       before doing an update, but that might require discussions.

    2. `git pull` + `:restart` +
       `vim.pack.update(nil, { target = 'lockfile' })`.
       The only caveats are for new and deleted plugins:
        - New plugins (not present locally but present in the lockfile)
          will be installed at lockfile revision during restart.
        - Deleted plugins (present locally but not present in the
          lockfile) will still be present: both locally *and* in the
          lockfile. They can be located by
          `git diff -- nvim-pack-lock.json` and require manual
          `vim.pack.del({ 'old-plugin1', 'old-plugin2' })`.
2025-12-26 18:32:59 +02:00
Justin M. Keyes
c03d635a12 Merge #37097 feat(pack)!: improve handling of src change 2025-12-25 23:44:08 -05:00
glepnir
ef0386fe9a fix(pum): adjust info window column offset when scrollbar is present (#37069)
Problem:
When the popupmenu has no border but includes a scrollbar, the info window
column is misaligned due to a missing column offset.

Solution:
Apply a one-column offset to the info window when the popup menu has no border
and a scrollbar is present.
2025-12-26 02:15:55 +00:00
zeertzjq
b7adf8081c test(api/server_requests_spec): fix flaky test (again) (#37100) 2025-12-26 01:27:30 +00:00
Evgeni Chasnovski
0353d33b00 feat(pack)!: change src of installed plugin inside update() in place
Problem: Changing `src` of already installed plugin currently takes
  effect immediately inside `vim.pack.add()` and acts as "delete and
  later fresh install". Although more robust, this might lead to
  unintentional data loss (since plugin is deleted) if the plugin was
  manually modified or the new source is not valid.
  Also this introduces unnecessary differentiation between "change
  `version`" and "change `src`" of already installed plugin.

Solution: Require an explicit `vim.pack.update()` to change plugin's
  source. It is done by conditionally changing `origin` remote of the
  Git repo. The effect does not require update confirmation in order to
  have new changes fetched from the new `src` right away.

  If in the future there are more types of plugins supported (i.e. not
  only Git repos), also do extra work (like delete + install) during
  `vim.pack.update()`.
2025-12-25 12:57:59 +02:00
Sean Dewar
1cde71233f fix(autocmd): skip empty comma-separated patterns properly
Problem: empty comma-separated patterns in an aupat aren't skipped correctly.
Solution: skip consecutive commas in an aupat.

Also simplify the logic.
2025-12-25 00:08:57 +00:00
Sean Dewar
6d2330f50d fix(autocmd): parsing of comma-separated buflocal patterns
Problem: patterns after a buffer-local pattern in a comma-separated aupat are
         ignored.
Solution: ensure pat refers to the original buffer after each pattern, not the
          buflocal_pat buffer, and when printing make sure it's normalized for
          each pattern, not just the first.

Also simplify the logic when printing all autocommands for an event, and ensure
headings aren't repeated for each event when printing autocommands.
2025-12-25 00:08:57 +00:00
zeertzjq
d7b882697b vim-patch:9.1.2017: getregionpos() depends on 'linebreak' setting (#37088)
Problem:  getregionpos() depends on 'linebreak' setting
Solution: Reset linebreak setting temporarily (McAuley Penney)

When a line is wrapped on word boundaries, getregionpos() may report a
different end column for a visual block than the cursor position used to
define the selection.

Update the blockwise calculation in getregionpos() to use the same
wrapping assumptions as visual block mode, so the reported region
matches the selection boundaries.

Add a regression test that forces wrapping and checks that the end
position stays consistent under "setlocal wrap" and "setlocal
linebreak".

closes: vim/vim#19006

8ea0e7205c

Co-authored-by: McAuley Penney <jacobmpenney@gmail.com>
2025-12-24 09:48:59 +08:00
zeertzjq
2a2c366a3e vim-patch:9.1.2016: cindent wrong indentation after do-while loop (#37087)
Problem:  At "if(0) do if(0); while(0); else", else should be aligned
          with outer if, but is aligned with inner if.
Solution: In function find_match, ignore "if" and "else" inside a
          do-while loop, when looking for "if". (Anttoni Erkkilä)

closes: vim/vim#19004

9d661b057e

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2025-12-24 09:43:42 +08:00
zeertzjq
c374d78095 test(ui/inccommand_spec): don't check for transient message (#37078)
The check for v:errmsg is enough.
2025-12-23 08:15:32 +08:00
zeertzjq
49b1a6540f vim-patch:9.1.2009: tests: "Xm4" test directory may not be deleted
Problem:  tests: "Xm4" test directory may not be deleted
Solution: Use "R" flag with mkdir() call to have the directory
          recursively deleted at the end of function Test_m4_format()
          (Muraoka Taro)

Test_m4_format in test_filetype.vim creates the "Xm4" directory with the
'D' flag. Then it creates two files in the "Xm4" directory. One of them,
"alocal.m4," was created with the 'D' flag, so it will disappear after
the test is complete. However, the other, "configure.ac," was created
without any flags, so it will remain even after the test is complete.
Because the parent directory "Xm4" was created with the 'D' flag, the
latter "configure.ac" remains and is not empty, so it will not be
deleted.

This forces the directory to be deleted regardless of its contents. As a
result, the two files "alocal.m4" and "configure.ac" created in the
directory are no longer needed, so they have been deleted.

closes: vim/vim#18995

de37e7430a

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2025-12-23 07:20:37 +08:00
zeertzjq
471be48d56 vim-patch:9.1.2008: filetype: hylo files are not recognized
Problem:  filetype: hylo files are not recognized
Solution: Detect *.hylo files as hylo filetype (Ambrus Tóth)

References:
- https://hylo-lang.org/

closes: vim/vim#18994

9c9982240a

Co-authored-by: Ambrus Tóth <ping@ambrus.dev>
2025-12-23 07:20:37 +08:00
zeertzjq
92910a8ab8 vim-patch:9.1.2007: filetype: bpftrace hashbang lines are not recognized
Problem:    bpftrace files are not recognized from the hashbang line.
Solution:   Add a hashbang check (Stanislaw Gruszka)

closes: vim/vim#18992

f2814754c0

Co-authored-by: Stanislaw Gruszka <stf_xl@wp.pl>
2025-12-23 07:20:37 +08:00
Jaehwang Jung
033f1123cd fix(marks): wrong line('w$', win) with conceal_lines (#37047)
Background:
Suppose a window has concealed lines, and sets conceallevel>2,
concealcursor="". The concealed lines are displayed if the window is
curwin and the cursor is on the those lines.

Problem:
line('w$', win) switches curwin to win, and then does validate_botline
for curwin. It computes botline assuming the concealed lines displayed,
resulting in a smaller value than the actual botline that the user sees.

Solution:
Evaluate line('w$', win) without switching curwin.
Apply similar changes to other functions that switches curwin.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-12-22 09:03:50 +00:00
zeertzjq
b95848a8f1 vim-patch:8.2.1756: Vim9: :let will soon be disallowed (#37063)
Problem:    Vim9: :let will soon be disallowed.
Solution:   Add v:disallow_let temporarily.  Fix tests.

cfcd011fcd

The change to use checkforcmd() is already included in the port of patch
9.0.1505. This commit adds the missing :const check.

N/A patches:
vim-patch:8.2.1397: Vim9: return type of maparg() not adjusted for fourth arg
vim-patch:8.2.1623: Vim9: using :call where it is not needed
vim-patch:8.2.1766: Vim9: Some tests are still using :let
vim-patch:8.2.1788: Vim9: still allows :let for declarations
vim-patch:8.2.1882: Vim9: v:disallow_let is no longer needed

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-22 12:31:44 +08:00
Jan Edmund Lazo
398cf6d8d3 vim-patch:8.2.3657: Vim9: debug text misses one line of return statement
Problem:    Vim9: debug text misses one line of return statement.
Solution:   Add a line when not at a debug instruction. (closes vim/vim#9137)

112bed0cbe

Vim9 test "Test_Debugger_break_at_return()" commented out
to avoid unexpected side-effects even if all other tests pass.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:39:34 -05:00
Jan Edmund Lazo
4f71d9ce35 vim-patch:8.2.3383: Vim9: completion for :disassemble adds parenthesis
Problem:    Vim9: completion for :disassemble adds parenthesis.
Solution:   Don't add parenthesis. (Naohiro Ono, closes vim/vim#8802)

9aecf79c45

Co-authored-by: naohiro ono <obcat@icloud.com>
2025-12-21 21:17:34 -05:00
Jan Edmund Lazo
cd25ca5e0c vim-patch:8.2.3377: Vim9: :disass completion does not understand "s:"
Problem:    Vim9: :disass completion does not understand "s:".
Solution:   Expand "s:" to a pattern. (closes vim/vim#8780)

47016f5772

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:17:33 -05:00
Jan Edmund Lazo
525c348c29 vim-patch:8.2.2992: Vim9: completion for :disassemble is incomplete
Problem:    Vim9: completion for :disassemble is incomplete.
Solution:   Recognize the "debug" and "profile" arguments.

4ee9d8e04d

Vim9 ":disassemble" is N/A.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-21 21:17:33 -05:00
Jan Edmund Lazo
e0dcdef181 vim-patch:8.2.3431: completion for :disas sorts local functions first
Problem:    Completion for :disas sorts local functions first.
Solution:   Sort local functions last, like with :delfunc. (Naohiro Ono,
            closes vim/vim#8860)

dfe04dbff5

Vim9 ":disassemble" is N/A
but "commented" test code is a hint for future patches.

Co-authored-by: naohiro ono <obcat@icloud.com>
2025-12-21 21:17:33 -05:00
Sean Dewar
d1189ea508 fix(window): win_move_after UAF from naughty autocmds (#37065)
Problem: use-after-free in win_move_after if win_enter autocommands free win1/2.
Solution: set w_pos_changed before calling win_enter.
2025-12-21 20:31:05 +00:00
Sean Dewar
a2b9720939 fix(api): open_win leak from naughty autocommands
Problem: error set by win_set_buf may leak if autocommands immediately close the
new window.

Solution: free the error set by win_set_buf. (prefer nvim_open_win's error as
it's more important and will cause 0 to be returned)
2025-12-21 15:35:30 +00:00
Sean Dewar
d788864cde fix(api): ignore split_disallowed when opening a float
Problem: split_disallowed seemingly exists to prevent issues from changing
frames to accomodate a split window, which doesn't apply to floats.

Solution: remove the restriction for nvim_open_win, but only for floats.
(continue to check b_locked_split though)

NOTE: like before, the buffer we check b_locked_split for may not actually be
the target buffer "buf", as the later call to win_set_buf can fail to switch to
"buf" due to autocommands. (among other things)

Maybe we could attempt to close the new window in that case (or switch to a
different buffer if that also fails), but this is safer. (and simpler)

Fixes #36857 (and possibly some spurious E242s I've observed from extui)
2025-12-21 15:35:30 +00:00
Justin M. Keyes
0d206da461 Merge #37057 docs 2025-12-21 00:22:36 -05:00
Olivia Kinnear
ad330e99d1 fix(statusline): diagnostics spacing #36897 2025-12-20 23:58:38 -05:00
Justin M. Keyes
060993e438 docs: misc, lsp 2025-12-20 22:07:27 -05:00