Commit Graph

9226 Commits

Author SHA1 Message Date
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
zeertzjq
eb19206e03 vim-patch:9.1.1742: complete: preinsert does not work well with 'autocomplete' (#35692)
Problem:  complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
          (Girish Palya)

This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.

Try: `:set ac cot=preinsert`

See `:help 'cot'` for more details.

closes: vim/vim#18213

fa6fd41a94

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 03:35:41 +00:00
glepnir
c553008e74 fix(api): crash when moving curwin to other tabpage #35679
Problem: nvim_win_set_config may crash when attempting to move curwin to a
different tabpage if there is no other non-float available to switch to.

Solution: fix the crash. Fix ONE_WINDOW checks in winframe_find_altwin and
win_altframe to consider floating windows by instead using one_window. Allow
one_window to consider non-current tabpages. We can use one_window in
win_close_othertab now to also better reflect its use in win_close.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-09-08 18:30:20 -07:00
zeertzjq
223f9622df vim-patch:9.1.1744: tests: Test_skip_wildtrigger_hist_navigation() may fail
Problem:  tests: Test_skip_wildtrigger_hist_navigation() may fail
          (zeertzjq).
Solution: Correct test to validate intended behavior (Girish Palya).

See https://github.com/vim/vim/pull/18219#issuecomment-3265183318

closes: vim/vim#18243

3980c86525

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:25:58 +08:00
zeertzjq
b51eba9273 vim-patch:9.1.1738: cmdline-autocompletion breaks history navigation
Problem:  cmdline-autocompletion breaks history navigation (ddad431)
Solution: Support history navigation in cmdline autocompletion (Girish
          Palya)

Up/Down arrows support history navigation when using wildtrigger()

fixes: vim/vim#18207
closes: vim/vim#18219

708ab7f5fb

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-09 08:25:19 +08:00
James McCoy
a7b8102f20 Merge pull request #35659 from jamessan/enable-arm-unittests
Fix unittests on aarch64 / arm64
2025-09-08 20:13:16 -04:00
zeertzjq
7f2298ad32 fix(cmdline): fix inconsistent behavior with ext_popupmenu (#35688) 2025-09-09 00:11:13 +00:00
Shadman
acb99b8a65 fix(prompt_buffer): plugins can't set ': mark #35624
Problem:
Currently, prompt_buffer manages `:` mark by itself and exposes it
read-only mark. However when it fails there can be no mitigation made
by plugins. The `:` mark should act like a regular marks and be
modifiable.

Solution:
Allow plugins to set `:` mark.
2025-09-08 15:09:48 -07:00
zeertzjq
29f30ad91c vim-patch:9.1.1679: unclear what key causes CmdlineLeave autocommand (#35677)
Problem:  unclear what key causes CmdlineLeave autocommand
Solution: Set |v:char| to the key (Girish Palya).

related: vim/vim#17806
closes: vim/vim#18063

ba9551d131

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 11:40:12 +08:00
zeertzjq
da78772328 test(lsp): fix flakiness in inline completion test (#35676)
The flakiness happens because get() uses vim.schedule(), and a following
key may be processed before the scheduled event. Use poke_eventloop() to
ensure that the scheduled event is processed.
2025-09-08 02:54:57 +00:00
zeertzjq
bea87b4a9e test: add tests for #20348 2025-09-08 09:24:13 +08:00
zeertzjq
18f24b85c3 vim-patch:9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pum
Problem:  Memory leak with wildmode=longest,full and wildoptions=pum
          (after 9.1.1737).
Solution: Avoid using showmatches() and WILD_NEXT together.  Also fix
          wildmode=longest,noselect:full selecting wrong item
          (zeertzjq).

fixes: vim/vim#18228
closes: vim/vim#18229

c7f235bd43
2025-09-08 09:02:37 +08:00
zeertzjq
d784ed7013 vim-patch:9.1.1739: Matches may be listed twice with wildmode=longest,list
Problem:  Matches may be listed twice with wildmode=longest,list when
          "longest" doesn't change command line (after 9.1.1737).
Solution: Set did_wild_list when trying "list" after "longest"
          (zeertzjq).

closes: vim/vim#18227

a28a2eb9d9
2025-09-08 09:02:37 +08:00
zeertzjq
f2bda1effc vim-patch:9.1.1737: Patch v9.1.1714 introduce a regression for wildmenu
Problem:  Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq)
Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya)

- Fixed a regression caused by PR vim/vim#18125 selecting wrong item
- Fixed another regression where the first pasted text did not appear on
  the command-line after starting Vim.

closes: vim/vim#18212

8fec92d631

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
zeertzjq
1359578abb vim-patch:9.1.1714: completion: wildmode=longest:full selects wrong item
Problem:  completion: wildmode=longest:full selects wrong item
          (zeertzjq)
Solution: Fix issue, refactor ex_getln.c slightly
          (Girish Palya)

fixes: vim/vim#18102
closes: vim/vim#18125

2eccb4d0be

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
zeertzjq
3b5337ab6c vim-patch:9.1.1676: completion: long line shown twice
Problem:  completion: long line shown twice
          (Maxim Kim)
Solution: Fix the issue, disable an incorrect test.
          (Girish Palya)

fixes: vim/vim#18035
closes: vim/vim#18088

57379302aa

Omit removal of blank line in Test_noselect_expand_env_var() as it's
added again in patch 9.1.1682.
Cherry-pick two blank lines in Test_long_line_noselect() from patch
9.1.1682.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-08 09:02:37 +08:00
Evgeni Chasnovski
fa3920282d fix(pack): handle Git environment variables #35626
Problem: Some environment variables which are useful when working inside
  a bare repository can affect any Git operation.

Solution: Explicitly unset problematic environment variables.
2025-09-07 14:42:09 -07:00
skewb1k
448f15ca39 feat(json): pretty-format (indent) with vim.json.encode() #35424
Problem:
There is no straightforward way to pretty-print objects as JSON.
The existing `vim.inspect` outputs LON.

Solution:
Introduce an `indent` option for `vim.json.encode()` which enables
human-readable output with configurable indentation.

Adapts PR to upstream: openresty/lua-cjson#114
2025-09-07 14:38:27 -07:00
Evgeni Chasnovski
7853cde29a feat(pack): vim.pack.get() gets VCS info #35631
Problem:
Force resolve `spec.version` overrides the information about whether
a user supplied `version` or not. Knowing it might be useful in some use
cases (like comparing to previously set `spec` to detect if it has
changed).

Solution:
Do not resolve `spec.version`. This also improves speed when triggering
events and calling `get()`.
- Place default branch first when listing all branches.
- Use correct terminology in `get_hash` helper.
- Do not return `{ '' }` if there are no tags.

Problem:
There is no way to get more information about installed plugins, like
current revision or default branch (necessary if resolving default
`spec.version` manually). As computing Git data migth take some time,
also allow `get()` to limit output to only necessary set of plugins.

Solution:
- introduce arguments to `get(names, opts)`, which follows other
  `vim.pack` functions. Plugin extra info is returned by default and
  should be opt-out via `opts.info = false`.
  - Examples:
    - Get current revision: `get({ 'plug-name' })[1].rev`
    - Get default branch: `get({ 'plug_name' })[1].branches[1]`
- `update()` and `del()` act on plugins in the same order their names
  are supplied. This is less surprising.
- default `opts.info` to `true` since this simplifies logic for the
  common user, while still leaving the door open for a faster `get()` if
  needed.
2025-09-07 09:59:31 -07:00
James McCoy
e702f97518 fix(tests): ignore vector math types
As noted in #34908, the arm unittests fail due to unrecognized types:

    ERROR    test/unit/testutil.lua @ 802: Expressions parser works with &opt
    test/unit/testutil.lua:774: test/unit/testutil.lua:758: (string) '
    test/unit/testutil.lua:288: declaration specifier expected near '__SVFloat32_t''
    exit code: 256

After testing on Debian's arm64 porterbox, the unittests cleanly pass
when ignoring various types defined in
/usr/include/aarch64-linux-gnu/bits/math-vector.h
2025-09-06 20:15:35 -04:00
Sean Dewar
da39966a3a fix(api): win_set_config error message for splitting from a float #35650
Problem: after #34287 nvim_win_set_config no longer errors when attempting to
split from a floating window only if "win" is 0.

Solution: fix the regression, reduce the scope of "parent" and similar checks to
only where it's currently used and add test coverage for the errors.
2025-09-06 13:22:46 -07:00
Evgeni Chasnovski
069be91106 feat(pack): use nvim_echo{kind=progress} to report progress #35625
Problem: Progress reports use plain `nvim_echo()` with manually
  constructed messages and populate history on every call.

Solution: Use `nvim_echo()` with newly added `kind=progress` which (at
  least for now) is meant to be a unified interface for showing progress
  report. Also save in history only first and last progress report
  messages.
2025-09-05 07:12:28 -07:00
zeertzjq
0bafbe872b vim-patch:9.1.1732: filetype: .inc file detection can be improved (#35635)
Problem:  filetype: .inc file detection can be improved
Solution: Update filetype detection for Pascal and BitBake code
          (Martin Schwan).

Fix the detection of .inc files containing Pascal and BitBake code:

- the concatenated string, merged from three lines, only contains one
  beginning and the pattern "^" would not match as expected. Use a range()
  loop to iterate each line string individually. This way, the pattern "^"
  works for beginning of lines.

- improve BitBake include file detection by also matching forward-slashes
  "/" in variable names and assignment operators with a dot ".=" and "=.".
  Valid examples, which should match, are:

    PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
    MACHINEOVERRIDES =. "qemuall:"
    BBPATH .= ":${LAYERDIR}"

- parse twenty instead of just three lines, to accommodate for potential
  comments at the beginning of files

closes: vim/vim#18202

9fd1a657d2

Co-authored-by: Martin Schwan <m.schwan@phytec.de>
2025-09-05 17:22:24 +08:00
Justin M. Keyes
9898327bd7 Merge #35621 from fredizzimo/refactor-mouse-spec
refactor(tests): don't compare the full screen in mouse_spec
2025-09-05 00:40:13 -04:00
Fred Sundvik
e6cdb76665 refactor(tests): don't compare the full screen in mouse_spec
Problem:
Adding multigrid tests to `mouse_spec` requires all tests to test both
the multigrid and non-multigrid screen state, which adds a lot of extra
code.

Solution:
Instead of testing the full screen state, only test substrings of it.
2025-09-05 00:12:55 +03:00
shadmansaleh
2415d8f424 fix(progress): message-id not sent to ui with history set to false 2025-09-04 20:37:05 +06:00