9672 Commits

Author SHA1 Message Date
zeertzjq
dd6ed20272 docs: misc (#37280)
Close #36806
Close #36812
Close #37003
Close #37016
Close #37038
Close #37039
Close #37157
Close #37185
Close #37213

Co-authored-by: saroj_r <sarojregmi.official@gmail.com>
Co-authored-by: Olivia Kinnear <git@superatomic.dev>
Co-authored-by: Igor <igorlfs@ufmg.br>
Co-authored-by: Justin Roberts <JustinEdwardLeo@gmail.com>
Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com>
Co-authored-by: Aymen Hafeez <49293546+aymenhafeez@users.noreply.github.com>
Co-authored-by: Peter Cardenas <16930781+PeterCardenas@users.noreply.github.com>
Co-authored-by: DrNayak2306 <dhruvgnk.work@gmail.com>
2026-01-07 08:11:42 +08:00
zeertzjq
a84bf386d2 vim-patch:9.1.2062: filetype: djot files are not recognized
Problem:  filetype: djot files are not recognized
Solution: Detect *.dj and *.djot files as djot filetype
          (Hoang Nguyen).

Reference:
- https://djot.net/

closes: vim/vim#19105

8d0fcff002

Co-authored-by: Hoang Nguyen <folliekazetani@protonmail.com>
2026-01-07 06:20:16 +08:00
zeertzjq
0bbbe236aa vim-patch:9.1.2061: filetype: Koka files are not recognized
Problem:  filetype: Koka files are not recognized
Solution: Detect *.kk files as koka filetype (Hoang Nguyen).

Reference:
- https://koka-lang.github.io/koka/doc/index.html

closes: vim/vim#19104

969a4a0ba5

Co-authored-by: Hoang Nguyen <folliekazetani@protonmail.com>
2026-01-07 06:19:12 +08:00
zeertzjq
a6df0db11f vim-patch:9.1.2060: filetype: Rasi include files are not recognized
Problem:  filetype: Rasi include files are not recognized
Solution: Detect *.rasinc as rasi filetype (Hoang Nguyen)

Reference:
- https://github.com/davatorium/rofi/blob/next/doc/rofi-theme.5.markdown#file-extension

closes: vim/vim#19103

b084b8f1db

Co-authored-by: Hoang Nguyen <folliekazetani@protonmail.com>
2026-01-07 06:18:28 +08:00
zeertzjq
b075656279 vim-patch:9.1.2059: filetype: Nickel files are not recognized
Problem:  filetype: Nickel files are not recognized
Solution: Detect *.ncl files as nickel filetype
          (Hoang Nguyen)

Reference:
- https://nickel-lang.org/getting-started/
- https://github.com/tweag/nickel/tree/master/examples

closes: vim/vim#19102

88f3ac34ea

Co-authored-by: Hoang Nguyen <folliekazetani@protonmail.com>
2026-01-07 06:17:49 +08:00
zeertzjq
218ea9fff7 fix(mappings): always include replace_keycodes in mapping dicts (#37272)
Omitting replace_keycodes when it is false causes some confusion as its
default value is unclear. In nvim_set_keymap() it defaults to false, but
in vim.keymap.set() it defaults to true when it matters.
2026-01-07 06:00:49 +08:00
zeertzjq
661455cc47 vim-patch:9.1.2056: tests: inconsistent indent and line breaking in Test_maparg() (#37269)
Problem:  tests: inconsistent indent and line breaking in Test_maparg().
Solution: Consistently use spaces-only indent. Reorder fields to group
          similar ones together and break lines at consistent positions.
          Remove a mapping when it is no longer used (zeertzjq).

closes: vim/vim#19099

254f844dda
2026-01-06 12:17:48 +00:00
zeertzjq
97bfc0c99b vim-patch:9.1.2055: Division by zero in :file after failing to wipe buffer (#37268)
Problem:  Division by zero in :file after failing to wipe buffer
          (after 8.2.4631).
Solution: Still call buf_clear_file() when failing to wipe buffer
          (zeertzjq).

closes: vim/vim#19088

1aa5ca4ecb
2026-01-06 12:08:24 +00:00
zeertzjq
0dfac68928 vim-patch:9.1.2051: tests: fix Test_cd_completion fails in Appveyor (#37266)
Problem:  Test_cd_completion test fails in Appveyor. In Appveyor, a path
          containing spaces was selected as the test target. But the
          comparison failed because spaces were not taken into account
          (after v9.1.2050)
Solution: Escape spaces in paths for comparison (Muraoka Taro)

closes: vim/vim#19087

679c2c01fa

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2026-01-06 10:43:02 +00:00
zeertzjq
23aa4853b3 fix(buffer): don't reuse 1-line terminal buffer (#37261)
Problem:  :edit and :enew may reuse a 1-line terminal buffer, causing
          the new buffer to still be a terminal buffer.
Solution: Don't reuse a terminal buffer, as it's not reused when it has
          more than 1 line.

After this change close_buffer() is the only place where buf_freeall()
can be called on a terminal buffer, so move the buf_close_terminal()
call into buf_freeall() to save some code. Furthermore, closing the
terminal in buf_freeall() is probably more correct anyway, as it is
"things allocated for a buffer that are related to the file".

Also, remove the useless check for on_detach callbacks deleting buffer.
Even if b_locked fails to prevent that, the crash will happen at the end
of buf_updates_unload() first. On the other hand, many other call sites
of buf_updates_unload() and other buffer_updates_* functions don't set
b_locked, which may be a problem as well...
2026-01-06 16:42:17 +08:00
zeertzjq
ad85871ca1 fix(terminal): crash when TermClose switches back to terminal buffer
Problem:  Crash when deleting terminal buffer and TermClose switches
          back to the terminal buffer.
Solution: Set b_locked_split.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-01-06 06:49:37 +08:00
zeertzjq
7297e9d339 fix(terminal): crash when TermClose deletes other buffers
Problem:  Crash when deleting terminal buffer and TermClose deletes
          other buffers.
Solution: Close the terminal after restoring b_nwindows.
2026-01-06 06:49:37 +08:00
zeertzjq
d42fa1753a test(terminal): fix incorrect TermClose test
The test may wipe the wrong buffer if :bdelete switches to another one.

Also remove the builtin TermClose autocommand. It doesn't affect the
tests for now, but still it's better to avoid its interference.
2026-01-06 06:49:37 +08:00
zeertzjq
366251a5d2 fix(terminal): avoid multiple terminals writing to same buffer (#37219)
Problem:  Calling termopen() or nvim_open_term() on a buffer with an
          existing terminal leads to two terminals writing to the same
          buffer if the terminal job is still running, or memory leak
          if the terminal job has exited.
Solution: Close the terminal if the terminal job has exited, otherwise
          report an error. For nvim_open_term() also don't write a
          closed terminal's buffer content to the PTY.
2026-01-05 13:50:23 +08:00
Jan Edmund Lazo
08d7744e13 vim-patch:9.1.1967: if_python: 64bit numbers truncated (#37245)
Problem:  if_python: 64bit numbers truncated
Solution: cast python result to long long (lsq)

fixes:  vim/vim#18899
closes: vim/vim#18904

a52b11d057

Co-authored-by: lsq <lsqypj@gmail.com>
2026-01-05 13:38:57 +08:00
zeertzjq
df62cb3e69 fix(window): crash closing split if autocmds close other splits (#37233)
Problem:  Crash when closing a split window if autocmds close other
          split windows but there are still floating windows.
Solution: Bail out and give the window back its buffer.
2026-01-05 11:17:00 +08:00
zeertzjq
b67ac8cc6b fix(terminal): crash with race between buffer close and OSC 2 (#37225)
Problem:  Crash when a terminal receives OSC 2 just after closing its
          buffer but before terminal job exits.
Solution: Remove FUNC_ATTR_NONNULL_ALL from buf_set_term_title() and
          check for NULL.
2026-01-05 08:00:50 +08:00
Robert Muir
efa6d91132 fix(diagnostic): display 1-based related information line/col numbers (#37093)
Problem
LSP Related Information line and column numbers are 0-based. Displaying
them this way can confuse the user, since vim line/col numbers are
typically displayed 1-based.

Solution
Display the line and column numbers as 1-based.
2026-01-04 15:07:00 -08:00
zeertzjq
f6ca9262b8 fix(terminal): handle closing terminal with pending TermRequest (#37227)
Problem:  Destroying a terminal with pending TermRequest leads to
          heap-use-after-free when processing TermRequest afterwards.
Solution: Store the buffer handle instead of the Terminal pointer in the
          pending TermRequest event, and don't emit TermRequest if the
          terminal is already closed.
2026-01-04 22:35:40 +08:00
Sean Dewar
c14de47f1a fix(window): crash closing only non-float if autocmds :tabonly (#37218)
Problem: null pointer member access when closing the only non-float in the
current tab page if autocommands after closing all floats also close all other
tab pages. (making it the last window)

Solution: check last_window again after closing the floats.

Also reduce the scope of "wp"; it would be bugprone to use it before it's later
reassigned to the rv of win_free_mem if freed by Buf/WinLeave.
2026-01-04 13:15:08 +00:00
zeertzjq
6c3502d85a vim-patch:9.1.2050: tests: Test_cd_completion may fail
Problem:  tests: Test_cd_completion() may fail depending on the contents
          of the root directory of the current drive on Windows.
          readdir() may return a directory that cannot "cd" to, causing
          this test to fail. An example of such a directory is
          "System Volume Information" which only admin can "cd" to.
Solution: When determining the directory to use for testing, use the
          directory that we actually "cd" to successfully.
          In addition, directories with '$' in their names are also
          excluded, as they are considered environment variables during
          completion and do not work as expected.
          Example: "$RECYCLE.BIN" (Muraoka Taro).

closes: vim/vim#19078

6625ba359e

Co-authored-by: Muraoka Taro <koron.kaoriya@gmail.com>
2026-01-04 19:36:35 +08:00
zeertzjq
3e57c5216f vim-patch:9.1.1648: MS-Windows: some style issues with patch v9.1.1646
Problem:  MS-Windows: some style issues with patch v9.1.1646
Solution: Fix typose and code style issues (zeertzjq).

closes: vim/vim#18036

14afa278c1
2026-01-04 19:36:35 +08:00
zeertzjq
43bf045005 vim-patch:9.1.1646: MS-Windows: completion cannot handle implicit drive letters
Problem:  MS-Windows: completion cannot handle implicit drive letters
Solution: Consider paths like \folder and /folder as absolute
          (Miguel Barro).

closes: vim/vim#17829

a2f13bf782

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2026-01-04 19:36:35 +08:00
zeertzjq
3621af9b97 fix(terminal): inconsistent mode change when switching buffer (#37215)
Problem:  When switching to another terminal buffer in Terminal mode,
          usually Nvim stays in Terminal mode, but leaves Terminal mode
          if the old terminal buffer was deleted.
Solution: Don't always leave Terminal mode when active terminal buffer
          is deleted. Instead let terminal_check_focus() decide that.
2026-01-03 17:55:07 +08:00
zeertzjq
ca731d2e55 vim-patch:9.1.2042: filetype: systemd quadlet files are not recognized (#37208)
Problem:  filetype: systemd quadlet files are not recognized
Solution: Detect additional patterns as systemd filetype
          (Ac5000)

Reference:
- https://docs.podman.io/en/latest/markdown/podman.1.html
- https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
- https://docs.podman.io/en/latest/markdown/podman-quadlet.1.html

fixes:  vim/vim#15078
closes: vim/vim#19057

0f93c988e9

Co-authored-by: Ac5000 <15003210+Ac5000@users.noreply.github.com>
2026-01-03 01:44:56 +00:00
zeertzjq
6deb1c1bf3 vim-patch:9.1.2040: :tlunmenu incorrectly accepts a range (#37206)
Problem:  :tlnumenu incorrectly accepts a range.
Solution: Remove EX_RANGE and EX_ZEROR from the command definition and
          use ADDR_NONE (Doug Kearns).

closes: vim/vim#19055

19442ad118

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-01-03 09:41:38 +08:00
zeertzjq
b7efbbec51 vim-patch:9.1.2041: tests: test_menu.vim leaves swapfiles behind
Problem:  tests: test_menu.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!

7f5c60b31e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-03 07:44:49 +08:00
zeertzjq
01177619bc vim-patch:9.1.2038: tests: test_marks.vim leaves swapfiles behind
Problem:  tests: test_marks.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!

4fe7301df9

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-03 07:44:47 +08:00
Christian Clason
067b5743f5 vim-patch:9.1.2043: filetype: kos files are not reconized
Problem:  filetype: kos files are not reconized
Solution: Detect *.kos files as kos filetype
          (Chris Dragan)

Reference:
- https://github.com/kos-lang/kos

closes: vim/vim#19056

96a1caac6b

Co-authored-by: Chris Dragan <chris@dragan.dev>
2026-01-02 16:31:32 +01:00
Francisco Giordano
612cd99a00 fix(api): buffer overflow in nvim_buf_get_extmarks overlap #37184
With `overlap=true`, more extmarks than the requested limit may be
collected in `extmark_get`. This then leads to an out of bounds write of
`rv` in `nvim_buf_get_extmarks`.
2026-01-02 02:17:57 -05:00
Olivia Kinnear
a03ab03a10 fix(lsp): :lsp restart restarts on client exit #37125
Problem:
`:lsp restart` detects when a client has exited by using the `LspDetach`
autocommand. This works correctly in common cases, but breaks when
restarting a client which is not attached to any buffer. It also breaks
if a client is detached in between `:lsp restart` and the actual
stopping of the client.

Solution:
Move restart logic into `vim/lsp/client.lua`, so it can hook in to
`_on_exit()`. The public `on_exit` callback cannot be used for this, as
`:lsp restart` needs to ensure the restart only happens once, even if
the command is run multiple times on the same client.
2026-01-02 01:58:10 -05:00
Kira Kawai
3ac76977bc fix(diagnostic): check for extmark in get_logical_pos #37127
Problem: The function get_logical_pos did not account for the possibility that a diagnostic might not have an associated extmark, leading to potential errors or incorrect behavior.

Solution: Add a check for diagnostic._extmark_id and return the logical positions directly if it does not exist.
2026-01-02 01:49:28 -05:00
Tristan Knight
ed562c296a fix(lsp): improve dynamic registration handling #37161
Work on #37166 

- Dynamic Registration Tracking via Provider
- Supports_Method
    - Multiple Registrations
    - RegistrationOptions may dictate support for a method
2026-01-02 01:46:13 -05:00
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