Commit Graph

9251 Commits

Author SHA1 Message Date
zeertzjq
b9dd3167f4 test: remove duplicate legacy/{increment,undolevels}_spec.lua
They are almost exact copies of parts of test_{increment,undo}.vim.
2025-09-22 14:03:42 +08:00
zeertzjq
6d280804f7 test: make error clearer for RPC request after crash 2025-09-22 14:03:42 +08:00
zeertzjq
777dafdc46 test: reduce some clear() calls
Use only a single clear() call in some test/functional/vimscript/ test
files whose test cases have very little side effect.

A downside of using a single clear() is that if a crash happens in one
test case, all following test cases in the same file will also fail, but
these functionalities and tests don't change very often.
2025-09-22 14:03:42 +08:00
zeertzjq
c2136e3590 fix(options): increase t_Co buffer size (#35859) 2025-09-21 04:12:37 +00:00
zeertzjq
f60f67c2de test: fix 'autocompletedelay' test flakiness (#35856) 2025-09-21 01:27:44 +00:00
zeertzjq
a70997442e vim-patch:9.1.1779: completion: 'autocomplete' cannot be enabled per buffer (#35853)
Problem:  completion: 'autocomplete' cannot be enabled per buffer
          (Tomasz N)
Solution: Make 'autocomplete' global or local to buffer (Girish Palya)

fixes: vim/vim#18320
closes: vim/vim#18333

0208b3e80a

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-21 00:56:38 +00:00
zeertzjq
f91d416403 vim-patch:9.1.1776: completion: "adding" expansion doesn't work with cfc=keyword (#35850)
Problem:  "adding" expansion doesn't work with cfc=keyword.
Solution: Remove incorrect assignment to compl_cont_status. Don't use
          fuzzy collection in "adding" status (zeertzjq).

related: neovim/neovim#35842
closes: vim/vim#18351

e19a882ffc
2025-09-21 07:35:14 +08:00
zeertzjq
d3bd1fba6a vim-patch:9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars (#35851)
Problem:  Mouse click to open fold doesn't work with utf-8 "foldclose"
          chars (Balki)
Solution: Use ScreenLinesUC[off] if it is set (zeertzjq).

fixes: vim/vim#18344
closes: vim/vim#18349

8b5fe7d090
2025-09-21 07:32:25 +08:00
zeertzjq
a5955e5cc5 vim-patch:9.1.1778: sha256() treats empty blob and null blob differently
Problem:  sha256() treats empty blob and null blob differently
          (after 9.1.1774).
Solution: Handle null blob the same as empty blob (zeertzjq).

closes: vim/vim#18341

2f3b7ea19a
2025-09-21 06:31:27 +08:00
zeertzjq
39a21d749d vim-patch:9.1.1774: cannot calculate sha256 of a Blob
Problem:  cannot calculate sha256() of a Blob
Solution: Change sha256() to accept a Blob or String argument
          (thinca).

closes: vim/vim#18336

4150283b83

Co-authored-by: thinca <thinca@gmail.com>
2025-09-21 06:31:27 +08:00
Shadman
04f476733c test: fix prompt_buffer_spec flakiness (#35838)
Remove incorrect use of source_script().
2025-09-19 11:14:49 +00:00
zeertzjq
e2166661d4 vim-patch:9.1.1772: completion: inconsistent selection of first item with 'autocomplete' (#35835)
Problem:  completion: inconsistent selection of first item with
          'autocomplete' (Tomasz N)
Solution: Check for 'autocomplete' option in ins_compl_new_leader()
          (Girish Palya).

fixes: vim/vim#18326
closes: vim/vim#18329

86e8e909f2

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 10:47:53 +08:00
zeertzjq
95267b664c vim-patch:9.1.1769: completion: "preinsert" insert wrong word with 'smartcase' and 'autocomplete' (#35834)
Problem:  completion: "preinsert" insert wrong word with 'smartcase' and
          'autocomplete'
Solution: Add compare completed item with the leader (Girish Palya)

closes: vim/vim#18313

a8f7957d0b

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 10:47:27 +08:00
zeertzjq
b443a3cb33 Merge pull request #35833 from zeertzjq/vim-9.1.1621
vim-patch:9.1.{1621,1771}
2025-09-19 10:46:36 +08:00
Samuel Huang
e3f15d5424 vim-patch:9.1.1775: filetype: Mamba configuration files are not recognized #35829
Problem:  filetype: Mamba configuration files are not recognized
Solution: Detect .mambarc and mambarc as yaml filetype (Samuel Huang).

References:
- https://mamba.readthedocs.io/en/latest/user_guide/configuration.html

closes: vim/vim#18338

21a21eafec
2025-09-18 19:41:27 -07:00
zeertzjq
0763a85f43 vim-patch:9.1.1771: complete: some redraw issues with 'autocomplete'
Problem:  complete: some redraw issues with 'autocomplete'
Solution: Fix the issues (Girish Palya)

This commit contains the following changes:
* Fix that wildtrigger() might leave opened popupmenu around vim/vim#18298
* Remove blinking message on the command line when a menu item from a loaded
  buffer is selected during 'autocomplete'
* Add a test for PR vim/vim#18265 to demonstrate why the PR is required for correct
  'autocomplete' behavior

fixes: vim/vim#18298
closes: vim/vim#18328

ee9a2f0512

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 09:58:24 +08:00
zeertzjq
dd306bd48a vim-patch:9.1.1621: flicker in popup menu during cmdline autocompletion
Problem:  When the popup menu (PUM) occupies more than half the screen
          height, it flickers whenever a character is typed or erased.
          This happens because the PUM is cleared and the screen is
          redrawn before a new PUM is rendered. The extra redraw between
          menu updates causes visible flicker.
Solution: A complete, non-hacky fix would require removing the
          CmdlineChanged event from the loop and letting autocompletion
          manage the process end-to-end. This is because screen redraws
          after any cmdline change are necessary for other features to
          work.
          This change modifies wildtrigger() so that the next typed
          character defers the screen update instead of redrawing
          immediately. This removes the intermediate redraw, eliminating
          flicker and making cmdline autocompletion feel smooth
          (Girish Palya).

Trade-offs:
This behavior change in wildtrigger() is tailored specifically for
:h cmdline-autocompletion. wildtrigger() now has no general-purpose use
outside this scenario.

closes: vim/vim#17932

da9c966893

Use pum_check_clear() instead of update_screen().
Cherry-pick Test_wildtrigger_update_screen() change from patch 9.1.1682.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-19 09:58:24 +08:00
zeertzjq
c9f6267402 vim-patch:9.1.1773: Crash in BufLeave after BufUnload closes other windows (#35830)
Problem:  Crash in BufLeave/WinLeave/TabLeave when closing window after
          BufUnload closes all other windows in the tab page.
Solution: Avoid duplicate BufLeave/WinLeave events. Trigger TabLeave
          before removing the buffer (zeertzjq).

related: vim/vim#14166
related: neovim/neovim#33603
closes: vim/vim#18330

0c70820015
2025-09-19 07:40:12 +08:00
zeertzjq
61d7d983d6 vim-patch:9.1.1761: 'ruler' is set in defaults.vim
Problem:  'ruler' is set in defaults.vim, but not enabled by default in
          non-compatible mode.
Solution: set the ruler option in non-compatible mode, remove it from
          defaults.vim, update tests

closes: vim/vim#18260

ba36510920

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-18 08:12:44 +08:00
zeertzjq
8964ad45da vim-patch:9.1.1550: defaults: 'showcmd' is not enabled in non-compatible mode on Unix
Problem:  defaults: 'showcmd' is not enabled in non-compatible mode on
          Unix
Solution: Always enable 'showcmd' in non-compatible mode, drop it from
          defaults.vim.

'showcmd' was already always enabled in Vim compatible mode except for
UNIX environments. So let's just enable it always, there is no good
reason why UNIX platforms should be handled differently than other
platforms, especially since `defaults.vim` did enable this option
anyhow.

closes: vim/vim#17739

3f9d2378bd

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-18 08:12:31 +08:00
zeertzjq
b5e6f44c08 test(ui/messages2_spec): close unfinished timers at end of test (#35817)
The vim._extui.messages module uses multiple timers that last 2 or 4
seconds. If these timers aren't finished when a test ends, there will
be a 2-second delay on exit with ASAN or TSAN.
2025-09-18 08:01:21 +08:00
Tomasz N
e69b81ad94 fix(lsp): treat 2-triggers-at-once as "last char wins" #35435
Problem:
If there are 2 language servers with different trigger chars (`-` and
`>`), and a keymap inputs both simultaneously (`->`), then `>` doesn't
trigger. We get completion items from server1 only.

This happens because the `completion_timer` for the `-` trigger is still
pending.

Solution:
If the next character arrived enough quickly (< 25 ms), replace the
existing deferred autotrigger with a new one that matches this later
character.
2025-09-17 09:07:45 -07:00
zeertzjq
63ece2b151 fix(swapfile): don't use uninitialized memory (#35813)
Also add a test for #35802.
2025-09-17 11:36:27 +08:00
zeertzjq
114336ac1d vim-patch:9.1.1763: filetype: kitty config files are not recognized
Problem:  filetype: kitty config files are not recognized
Solution: Detect */kitty/*.conf as kitty filetype, include a syntax
          script (Shawon).

closes: vim/vim#18280

a946ccf5ff

Co-authored-by: Shawon <mdmoinulhossainshawon@gmail.com>
2025-09-17 09:08:27 +08:00
zeertzjq
8d5476691c test(lsp): make async format test work properly (#35794)
Overriding vim.lsp.handlers['textDocument/formatting'] doesn't work here
because fake_lsp_server_setup() uses a table with __index to specify
client handlers, which takes priority over vim.lsp.handlers[], and as a
result the overridden handler is never called, and the test ends before
the vim.wait() even finishes.

Instead, set a global variable from the handler that is actually reached
(by vim.rpcrequest() from client handler), and avoid stopping the event
loop too early.
2025-09-17 08:21:11 +08:00
zeertzjq
051b8b88c8 vim-patch:9.1.1762: completion: selected item not cleared on <BS> with 'ac'
Problem:  completion: selected item not cleared on backspace when
          'autocomplete' is set
Solution: Clear the selected item (Girish Palya)

closes: vim/vim#18260

5c9b71d63c

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-16 20:58:27 +08:00
zeertzjq
ff777f9a85 docs: small fixes (#35791)
Close #34938
Close #35030
Close #35233
Close #35259
Close #35290
Close #35433
Close #35541
Close #35766
Close #35792

Co-authored-by: huylg <45591413+huylg@users.noreply.github.com>
Co-authored-by: Jason Del Ponte <961963+jasdel@users.noreply.github.com>
Co-authored-by: sooriya <74165167+thuvasooriya@users.noreply.github.com>
Co-authored-by: Andrew Braxton <andrewcbraxton@gmail.com>
Co-authored-by: Enric Calabuig <enric.calabuig@gmail.com>
Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com>
Co-authored-by: David Sierra DiazGranados <davidsierradz@gmail.com>
Co-authored-by: Stepan Nikitin <90522882+vectravox@users.noreply.github.com>
Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-09-16 11:41:36 +08:00
zeertzjq
e7ff132708 vim-patch:9.1.1764: filetype: CODEOWNERS file not recognized (#35789)
Problem:  filetype: CODEOWNERS file not recognized
Solution: Detect CODEOWNERS file as codeowners filetype, include a
          syntax and filetype plugin (Jon Parise).

CODEOWNERS files define code ownership rules for GitHub-hosted (and
other) repositories. The syntax is similar to 'gitignore' files but
differs in enough ways to warrant its own filetype.

References:
- https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

closes: vim/vim#18299

817e4d3ee6

Co-authored-by: Jon Parise <jon@indelible.org>
2025-09-16 01:58:34 +00:00
zeertzjq
8605b0b7a9 vim-patch:9.1.{1755,1759} (#35787)
vim-patch:9.1.1755: filetype: generic log files are not recognized

Problem:  filetype: generic log files are not recognized
Solution: Detect *.log files as log filetype, include simple log syntax
          script (Mao-Yining).

closes: vim/vim#18285

b8970b43cd

vim-patch:9.1.1759: filetype: generic log detection is too disturbing

Problem:  filetype: generic log detection is too disturbing
          (after v9.1.1755)
Solution: Revert setting log filetype

48f1d6442d

Co-authored-by: Mao-Yining <mao.yining@outlook.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-09-16 01:35:44 +00:00
zeertzjq
1bafba31f6 test(swapfile_preserve_recover_spec): fix flaky test (#35782)
Invoke nvim_get_mode() to ensure that pending input is processed.
2025-09-16 07:30:43 +08:00
Yochem van Rosmalen
47b0a718c3 feat(help): gx opens help tag in web browser #35778
Problem:
`gx` does not work on tags in help buffers to open the documentation of that tag in the browser.

Solution:
Get the `optionlink`, `taglink` and `tag` TS nodes and set extmark "url" property.
`gx` then discovers the extmark "url" and opens it.
2025-09-15 15:38:49 -07:00
bfredl
0458a1e694 build(ci): bump zig to 0.15.1 and add more platforms
- Bump zig version to 0.15.1 and workaround zig fetch hang (ziglang/zig#24916)
- add mac os zig build (currently without luajit, linker failure)
- Add windows zig build, currently with very limited testing
2025-09-15 12:10:23 +02:00
zeertzjq
2debe2f30a fix(lsp): avoid automatic request after leaving insert mode (#35767)
This also fixes the following warning in tests with ASAN or TSAN:

    -------- Running tests from test/functional/plugin/lsp/inline_completion_spec.lua
    RUN      T4604 vim.lsp.inline_completion enable() requests or abort when entered/left insert mode: 225.00 ms OK
    RUN      T4605 vim.lsp.inline_completion get() applies the current candidate: 212.00 ms OK
    nvim took 2013 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!

    RUN      T4606 vim.lsp.inline_completion get() accepts on_accept callback: 212.00 ms OK
    RUN      T4607 vim.lsp.inline_completion select() selects the next candidate: 220.00 ms OK
    -------- 4 tests from test/functional/plugin/lsp/inline_completion_spec.lua (3437.00 ms total)

    -------- Running tests from test/functional/plugin/lsp/linked_editing_range_spec.lua
    nvim took 2011 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!
2025-09-15 14:41:29 +08:00
zeertzjq
1264d1156c fix(lua): don't leak timer when vim._watch.watch() fails (#35768)
This fixes the following warning in tests with ASAN or TSAN:

    -------- Running tests from test/functional/lua/watch_spec.lua
    RUN      T4253 vim._watch watch() ignores nonexistent paths: 29.00 ms OK
    nvim took 2006 milliseconds to exit after last test
    This indicates a likely problem with the test even if it passed!
2025-09-15 11:15:25 +08:00
zeertzjq
7b8b9d270f vim-patch:9.1.1758: Diff mode crashes when adding text property in autocommand (#35760)
Problem:  Diff mode crashes when adding text property in autocommand
          (after 9.1.1557).
Solution: Only restore ML_EMPTY memline flag, ignore the others
          (zeertzjq).

fixes: vim/vim#18288
closes: vim/vim#18291

46e22fd2f7
2025-09-15 07:17:37 +08:00
skewb1k
a897cc17a5 feat(json): vim.json.encode() sort_keys #35574
Problem: There is no way to ensure a stable key order when encoding a JSON string,
which can be useful for comparisons and producing cleaner diffs.

Solution: Introduce a `sort_keys` option for `vim.json.encode()`,which
is disabled by default. When enabled, object keys are sorted in
alphabetical order.
2025-09-13 21:17:07 -07:00
Justin M. Keyes
2f78ff816b fix(lsp): misleading logs in non-applicable filetypes #35749
Problem:
LSP logs show misleading "cannot start" messages when editing a filetype
NOT listed in the `config.filetypes` field.

    [ERROR][2025-09-13 18:55:56] …/runtime//lua/vim/lsp/log.lua:151
    "cannot start cssls due to config error: …/runtime//lua/vim/lsp.lua:423:
    cmd: expected expected function or table with executable command,
    got table: 0x0104701b18. Info: vscode-css-language-server is not executable"

Solution:
- `can_start`: check `config.filetypes` before checking the rest of the
  config.
2025-09-13 18:51:06 -07:00
fredizzimo
8ae9a44d38 feat(ui): support grid=0 in nvim_input_mouse #32535
Problem:
Multigrid UIs have to find out which window to send the input by using
the Nvim focus rules, which are not fully documented.

Furthermore,`getmousepos()` has several problems when multigrid is
enabled, with the main one being that screenrow and screencol are window
relative instead of screen relative, due to the fact that the UI don't
send any absolute coordinates.

Solution:
Allow passing 0 as grid to `nvim_input_mouse`, with absolute
coordinates, which lets nvim determine the actual window to send the
mouse input to. This works as long as nvim is in charge of the window
positioning. If the UI repositions or resizes the windows, it can still
pass the grid it determines like before.
2025-09-13 14:57:04 -07:00
luukvbaal
c1648cf820 fix(ui): forward 'rulerformat' to msg_ruler event #35707
Problem:  A 'rulerformat' not part of the statusline is not emitted through
          msg_ruler events.
Solution: Build the message chunks to emit as a msg_ruler event.
2025-09-13 13:34:58 -07:00
Evgeni Chasnovski
a41703d107 feat(pack): confirm "Always" to install all plugins #35733
Problem: First clean start with config containing multiple
  `vim.pack.add()` calls requires to explicitly confirm each one.
  Although usually a rare occurrence, it still might be tedious.

Solution: Add a third choice during installation confirmation that
  approves current and all next installs within current session. It is
  reset after session restart.
2025-09-13 13:32:09 -07:00
zeertzjq
4a69847df4 fix(tui): don't wait for DA1 response when stdin is closed (#35745) 2025-09-13 20:53:17 +08:00
zeertzjq
cf9b7a37cc vim-patch:9.1.1753: defaults: 'diffopt' option value can be improved (#35727)
Problem:  defaults: 'diffopt' option value can be improved
Solution: Update diffopt defaults to include "indent-heuristic" and
          "inline:char" (Yee Cheng Chin)

The default diff options have not been updated much despite new
functionality having been added to Vim.

- indent-heurstic: This has been enabled by default in Git since
  33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense
  to track the default configuration from Git.

- inline:char: This turns on character-wise inline highlighting which is
  generally much better than the default inline:simple. It has been
  implemented since vim/vim#16881 and we have not seen reports of any issues
  with it, and it has received good feedbacks.

closes: vim/vim#18255

976b365305

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-09-12 03:57:05 +00:00
zeertzjq
4f10e56cc5 test(old): reorder test_diffmode.vim to match upstream (#35726) 2025-09-12 10:43:11 +08:00
zeertzjq
ae588c183f vim-patch:9.1.1754: :helptags doesn't skip examples with syntax
Problem:  :helptags doesn't skip examples with syntax
          (Evgeni Chasnovski)
Solution: Check for examples with syntax (zeertzjq).

fixes: vim/vim#18273
closes: vim/vim#18277

6f020cde56
2025-09-12 07:32:42 +08:00
zeertzjq
50efe61c3c vim-patch:partial:9.0.0323: using common name in tests leads to flaky tests
Problem:    Using common name in tests leads to flaky tests.
Solution:   Rename files and directories to be more specific.

3b0d70f4ff

This includes only test_help.vim changes.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-12 07:26:37 +08:00
Cameron Ring
0f64f0f5b6 fix(startup): crash in read_stdin #35699
Problem:
Crash on startup in some situations due to call to `set_curbuf`
with the current value of `cur_buf`.

Solution:
Switch buffers before doing the wipeout of the stdin buffer.
Use cmdline cmds instead of raw buffer pointers to avoid lifetime issues.
2025-09-10 21:37:42 -07:00
zeertzjq
aa33ea86e1 vim-patch:9.1.1752: tests: need another test for v9.1.1750 behaviour
Problem:  tests: No test when deleting text after autocompletion with preinsert
          did complete an entry
Solution: Verify, that after deletion autocompletion does not reinsert
          the deleted text. Note: the actual issue was fixed with v9.1.1750.
          (Girish Palya)

Pre v9.1.1750 behaviour:
When autocomplete is enabled with *preinsert*, deleting text after selecting a
longer match could cause unintended reinsertion, e.g.:

- Matches available: "foo" and "foobar".
- User selects "foobar" with Ctrl-N
- User deletes characters back to "foo".
- Autocomplete then incorrectly re-inserts "bar", preventing deletion past "foo".

v9.1.1750 removes the unwanted reinsertion so text can be deleted correctly.

closes: vim/vim#18259

fe0061c609

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-11 07:23:29 +08:00
zeertzjq
5a7586a109 vim-patch:9.1.1750: completion: preinserted text highlighed using ComplMatchIns
Problem:  completion: preinserted text highlighed using ComplMatchIns
Solution: Use highlighting group PreInsert and update the documentation
          (Girish Palya).

When "preinsert" is included in 'completeopt', only the PreInsert
highlight group should be applied, whether autocompletion is active or not.
Previously, ComplMatchIns was used when autocompletion was not enabled.

Related to https://github.com/vim/vim/pull/18213.

closes: vim/vim#18254

2525c56e42

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-11 07:23:28 +08:00
zeertzjq
9076fdc123 fix(runtime): add "Added", "Changed", "Removed" to "vim" colorscheme (#35704)
These were added to syncolor.vim in Vim patch 9.1.0016.
2025-09-11 06:55:43 +08:00
zeertzjq
f6ed46c2a7 vim-patch:9.1.1747: completion: redo (.) broken with preinsert and autocompletion (#35698)
Problem:  completion: redo (.) broken with preinsert and autocompletion
Solution: Make redo (.) work with preinsert and autocompletion
          (Girish Palya)

closes: vim/vim#18253

306a138172

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 23:53:33 +00:00