Commit Graph

34072 Commits

Author SHA1 Message Date
Evgeni Chasnovski
dc8235c48c feat(pack): prefer using revision from lockfile during install
Problem: Installing plugin always pulls latest `version` changes
  (usually from the default branch or "latest version tag"). It is more
  robust to prefer initial installation to use the latest recorded
  (i.e. "working") revision.

Solution: Prefer using revision from the lockfile (if present) during
  install. The extra `update()` will pull the latest changes.
2025-10-04 16:15:54 +03:00
Evgeni Chasnovski
cfbc03a954 feat(pack)!: make update() include not active plugins by default
Problem: Running `update()` by default doesn't include not active
  plugins, because there was no way to get relevant `version` to get
  updates from. This might be a problem in presence of lazy loaded
  plugins, i.e. ones that can be "not *yet* active" but still needed to
  be updated.

Solution: Include not active plugins by default since their `version` is
  tracked via lockfile.
2025-10-04 16:13:39 +03:00
Evgeni Chasnovski
a31f63f661 feat(pack)!: update get() to return revision regardless of opts.info
Problem: The revision data is returned behind `opts.info` flag because
  it required extra Git calls. With lockfile it is not the case.

Solution: Use lockfile to always set `rev` field in output of `get()`.
2025-10-04 16:13:38 +03:00
Evgeni Chasnovski
2c0b70e559 fix(pack)!: use lockfile in get() for data about non-active plugins
Problem: `get()` doesn't return `spec.version` about not-yet-active
  plugins (because there was no way to know that without `add()`).

Solution: Use lockfile data to set `spec.version` of non-active plugins.
2025-10-04 16:13:36 +03:00
Evgeni Chasnovski
d7db552394 feat(pack): add initial lockfile tracking
Problem: Some use cases require or benefit from persistent on disk
  storage of plugin data (a.k.a. "lockfile"):

  1. Allow `update()` to act on not-yet-active plugins. Currently if
    `add()` is not yet called, then plugin's version is unknown
    and `update()` can't decide where to look for changes.

  2. Efficiently know plugin's dependencies without having to read
    'pkg.json' files on every load for every plugin. This is for the
    future, after there is `packspec` support (or other declaration of
    dependencies on plugin's side).

  3. Allow initial install to check out the exact latest "working" state
    for a reproducible setup. Currently it pulls the latest available
    `version.`

  4. Ensure that all declared plugins are installed, even if lazy loaded.
    So that later `add()` does not trigger auto-install (when there
    might be no Internet connection, for example) and there is no issues
    with knowing which plugins are used in the config (so even never
    loaded rare plugins are still installed and can be updated).

  5. Allow `add()` to detect if plugin's spec has changed between
    Nvim sessions and act accordingly. I.e. either set new `src` as
    origin or enforce `version.` This is not critical and can be done
    during `update()`, but it might be nice to have.

Solution: Add lockfile in JSON format that tracks (adds, updtes,
  removes) necessary data for described use cases. Here are the required
  data that enables each point:

    1. `name` -> `version` map.
    2. `name` -> `dependencies` map.
    3. `name` -> `rev` map. Probably also requires `name` -> `src` map
       to ensure that commit comes from correct origin.
    4. `name` -> `src` map. It would be good to also track the order,
       but that might be too many complications and redundant together
       with point 2.
    5. Map from `name` to all relevant spec fields. I.e. `name` -> `src`
       and `name` -> `version` for now. Storing data might be too much,
       but can be discussed, of course.

  This commit only adds lockfile tracking without implementing actual
  use cases. It is stored in user's config directory and is suggested to
  be tracked via version control.

  Example of a lockfile:

  ```json
  {
    # Extra nesting to more future proof.
    "plugins": {
      "plug-a": {
        "ref": "abcdef1"
        "src": "https://github.com/user/plug-a",
        # No `version` means it was `nil` (infer default branch later)
      },
      "plug-b": {
        "dependencies": ["plugin-a", "plug-c"],
        "src": "https://github.com/user/plug-b",
        "ref": "bcdefg2",
        # Enclose string `version` in quotes
        "version": "'dev'"
      },
      "plug-c": {
        "src": "https://github.com/user/plug-c",
        "ref": "cdefgh3",
        # Store `vim.version.Range` via its `tostring()` output
        "version": ">=0.0.0",
      }
    }
  }
  ```
2025-10-04 16:13:32 +03:00
zeertzjq
f8b50bf3b0 vim-patch:9.1.1825: completion: flicker when LSP server is slow (#36020)
Problem:  completion: flicker when LSP server is slow
Solution: reinsert leader text before invoking user function
          (Girish Palya)

Reference:
https://github.com/girishji/vimcomplete/issues/101#issuecomment-3343063245

In insert-mode completion, the leader text is temporarily removed while
searching for candidates. When the LSP server responds slowly, the
client may call `:sleep` to wait, which triggers `out_flush()`. This
causes the deleted text to disappear briefly before being redrawn,
resulting in visible flicker.

This commit reinserts the leader text before invoking the user function,
and removes it again afterward to eliminate flicker.

closes: vim/vim#18468

c51d1cc578

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-10-04 12:08:28 +00:00
zeertzjq
0fca343d64 vim-patch:9.1.1823: diff: w_topline may be invalidated (#36018)
Problem:  diff: w_topline may be invalidated
Solution: Update lnum in diff_set_topline()
          (Yee Cheng Chin).

This can happen in ex_diffupdate() for certain edge cases which cause
the logic to now be wrong. This was also the root cause for vim/vim#18437 where
Vim would crash due to a null pointer dereferencing (said pointer would
not be null under normal circumstances).

related: vim/vim#18437
closes: vim/vim#18484

dd9ed46a39

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-10-04 11:50:51 +00:00
zeertzjq
94bd212dbc vim-patch:9.1.1824: tests: no test for displaying 'foldcolumn' with Unicode "foldinner" (#36019)
Problem:  tests: no test for displaying 'foldcolumn' with Unicode
          "foldinner" in 'fillchars'.
Solution: Add a few more test cases.  Also fix misplaced "foldinner"
          entry in version9.txt (zeertzjq).

closes: vim/vim#18483

bcf44668f6
2025-10-04 11:43:23 +00:00
zeertzjq
8db42b3b86 vim-patch:bfcf638: runtime(java): Make changes for JDK 25 (#36017)
- Add to the list of java.lang classes three new types: IO,
  ScopedValue, and ScopedValue.Carrier.
- Add to the list of java.lang interfaces a new type:
  ScopedValue.CallableOp.
- "Demote" RuntimePermission from the list of java.lang
  class types to javaLangDeprecated.
- Reintroduce supported syntax-preview-feature numbers 455
  and 488 as _a new number_ 507.

References:
https://bugs.openjdk.org/browse/JDK-8353641
https://openjdk.org/jeps/506 (Scoped Values)
https://openjdk.org/jeps/507 (Primitive Types in Patterns etc.)
https://openjdk.org/jeps/512 (Compact Source Files etc.)

closes: vim/vim#18479

bfcf638c73

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-10-04 19:15:48 +08:00
glepnir
19f5f05ac2 fix(api): nvim_open_win respects requested split window size (#35601)
Problem: requested window size passed to nvim_open_win for splits may be ignored
by win_split_ins if it decides to forcefully equalize window sizes instead (e.g:
in an attempt to make room for the new window).

Solution: try to set the size again if it differs from what was requested.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-10-04 09:07:27 +01:00
Jan Edmund Lazo
96e9041a78 vim-patch:partial:8.1.1939: code for handling v: variables in generic eval file (#35968)
Problem:    Code for handling v: variables in generic eval file.
Solution:   Move v: variables to evalvars.c. (Yegappan Lakshmanan,
            closes vim/vim#4872)

e5cdf153bc

Remove direct reference to "vimvars" for following functions:
- assert_error()
- get_vim_var_nr()
- get_vim_var_list()
- get_vim_var_dict()
- get_vim_var_str()
- set_cmdarg()
- set_reg_var()
- set_vcount()
- set_vexception()
- set_vthrowpoint()
- set_vim_var_bool()
- set_vim_var_dict()
- set_vim_var_list()
- set_vim_var_nr()
- set_vim_var_special()
- set_vim_var_string()
- set_vim_var_type()

Reorder functions based on v8.2.4930 for
eval_one_expr_in_str() and eval_all_expr_in_str().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-04 04:28:30 +00:00
zeertzjq
04022c70f3 refactor(terminal): remove an unnecessary xmemdupz() for OSC 8 (#36012)
Instead, NUL-terminate the StringBuilder when needed.
Also deduplicate xmemdup() calls for schedule_termrequest().
2025-10-04 11:30:07 +08:00
zeertzjq
81d9c29d69 Merge pull request #36004 from zeertzjq/tui-buf-overflow
fix(tui): handle sequence larger than entire buffer
2025-10-04 09:00:44 +08:00
zeertzjq
40bf38fefc fix(terminal): handle OSC 8 split into multiple fragments
Also fix off-by-one size passed to xmemdupz().
2025-10-04 08:35:15 +08:00
zeertzjq
f64475a226 fix(tui): handle sequence larger than entire buffer 2025-10-04 07:54:50 +08:00
zeertzjq
b6b80824cc vim-patch:9.1.1819: Cannot configure the inner foldlevel indicator (#36010)
Problem:  Cannot configure the inner foldlevel indicator for the
          foldcolumn
Solution: Add "foldinner" suboption value to the 'fillchar' option
          (Maria José Solano).

closes: vim/vim#18365

1a691afd27

Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2025-10-03 23:53:29 +00:00
zeertzjq
2c76a50e20 vim-patch:9.1.1821: filetype: Not all PKL files are recognized (#36008)
Problem:  filetype: Not all PKL files are recognized
Solution: Detect *.pcf as pkl filetype, detect using the pkl-lsp://
          protocol as pkl filetype, include PKL syntax script
          (Jan Claußen)

This adds basic syntax support for the new PKL language by Apple.

What works:
- Shebang support
- Comment support
- Integers (decimal, hex, octal and binary) support
- Floating point support including exponentials
- Basic datatype support
- Unicode escape delimiters
- Escape code support
- String interpolation
- Support up to five pounds for custom delimiters
- Folding of multi-line comments and blocks

What doesn't work:

  The language heavily uses parameterized type declarations, which can get
  very complex. It is very hard to highlight this properly. There is
  official Tree-sitter support for this. Since it is hard to pull this off
  in a vim syntax file, I opted for basic support of the data types.

References:
  https://github.com/apple/pkl-pantry

fixes: vim/vim#18271
closes: vim/vim#18274

67a8f2945e

Co-authored-by: Jan Claußen <jan.claussen10@web.de>
2025-10-04 06:01:16 +08:00
zeertzjq
8151fc59cf vim-patch:9.1.1820: completion: some issues with 'acl' (#36007)
Problem:  completion: some issues with 'acl' when "preinsert" and
          "longest" is in 'completeopt' (musonius, after v9.1.1638)
Solution: Fix various issues (see details below) (Girish Palya)

This commit addresses multiple issues in the 'autocompletedelay' behavior with
"preinsert" and "longest":

- Prevents spurious characters from being inserted.
- Ensures the completion menu is not shown until `autocompletedelay` has
  expired.
- Shows the "preinsert" effect immediately.
- Keeps the "preinsert" effect visible even when a character is deleted.

fixes: vim/vim#18443
closes: vim/vim#18460

f77c187277

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-10-03 13:10:05 +00:00
zeertzjq
97ab7dd784 test(tui_spec): deduplicate (#36003) 2025-10-03 10:25:04 +00:00
zeertzjq
0124481c80 vim-patch:0a8b4ef: runtime(log): remove domain highlight (#36002)
The domain highlight is eazy to be confused and useless. Because we can
catch URL as a much obvious syntax.

closes: vim/vim#18467

0a8b4ef8b2

Co-authored-by: Mao-Yining <mao.yining@outlook.com>
2025-10-03 17:30:40 +08:00
zeertzjq
1939ec1763 vim-patch:09b1ce0: runtime(doc): fix typo after commit cfcf1a57cbef (#36001)
related: vim/vim#18452

09b1ce0860

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-03 17:30:24 +08:00
zeertzjq
affe0cd1b1 Merge pull request #35986 from zeertzjq/vim-9d57fe2
vim-patch: tutor updates
2025-10-03 17:06:05 +08:00
zeertzjq
e4d8474ad9 vim-patch:12da242: runtime(new-tutor): fix mismatched line numbers in vim-02-beginner
closes: vim/vim#18466

12da2427c7
2025-10-03 16:16:52 +08:00
zeertzjq
c755172a34 vim-patch:9d57fe2: runtime(new-tutor): Updated English new tutor
This updates the new tutor with the changes from commit
b87f133b0724f7328e7dd41dd611af67f4ae3e39

closes: vim/vim#18461

9d57fe278f

Link to :checkhealth for clipboard support.

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2025-10-03 16:16:26 +08:00
glepnir
f8db37868e refactor: common logic in parse_cmdline, do_one_cmd #35019
Problem: Significant code duplication between the two command parsing functions

Solution: Extract shared parsing logic into helper functions while preserving original behavior
2025-10-02 22:45:19 -07:00
zeertzjq
2abea5dc37 ci: stop using macos-13 runner (#35996)
> The macOS 13 runner image will be retired by December 4th, 2025.

Update to the macos-15-intel runner.

It seems that runners ending with "large" require an enterprise plan, so
macos-15-intel is the only other available macOS Intel runner.
2025-10-02 23:09:15 +00:00
Yi Ming
18d6436ad2 fix(lsp): inlineCompletion: ignore out-of-range items #35990 2025-10-02 16:00:39 -07:00
Riley Bruins
ac15b384a6 refactor(treesitter): use scratch buffer for string parser #35988
This commit changes `languagetree.lua` so that it creates a scratch
buffer under the hood when dealing with string parsers. This will make
it much easier to just use extmarks whenever we need to track injection
trees in `languagetree.lua`. This also allows us to remove the
`treesitter.c` code for parsing a string directly.

Note that the string parser's scratch buffer has `set noeol nofixeol` so
that the parsed source exactly matches the passed in string.
2025-10-02 15:33:18 -07:00
Gregory Anders
8eb0964537 feat(tui): native progress bars for Progress events #35973 2025-10-02 14:51:26 -07:00
zeertzjq
28ccebd138 Merge pull request #35987 from zeertzjq/vim-9.1.1818
vim-patch:9.1.{partial:1110,1818}
2025-10-02 12:57:19 +08:00
zeertzjq
df0b9e7a5d vim-patch:9.1.1818: possible crash when calculating topline in diff.c
Problem:  possible crash when calculating topline in diff.c
          (youngmith)
Solution: Check for pointer being Null before accessing it

fixes: vim/vim#18437

d32b3bb7eb

The POC is likely not applicable to Nvim due to #32160.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 12:36:15 +08:00
zeertzjq
dfd3ac6f48 vim-patch:partial:9.1.1110: Vim tests are slow and flaky
Problem:  Vim tests are slow and flaky at the same time due to reliance
          on timeouts which are unreliable.
Solution: improve Vim test performance and reduce flakiness
          (Yee Cheng Chin)

A lot of Vim tests currently rely on waiting a specific amount of time
before asserting a condition. This is bad because 1) it is slow, as the
timeout is hardcoded, 2) it's unreliable as a resource-starved runner
may overshoot the timeout. Also, there are a lot of builtin sleep
commands in commonly used utilities like VerifyScreenDump and WaitFor()
which leads to a lot of unnecessary idle time.

Fix these issues by doing the following:
1. Make utilities like VerifyScreenDump and WaitFor use the lowest wait
   time possible (1 ms). This essentially turns it into a spin wait. On
   fast machines, these will finish very quickly. For existing tests
   that had an implicit reliance on the old timeouts (e.g.
   VerifyScreenDump had a 50ms wait before), fix the tests to wait that
   specific amount explicitly.
2. Fix tests that sleep or wait for long amounts of time to instead
   explicitly use a callback mechanism to be notified when a child
   terminal job has finished. This allows the test to only take as much
   time as possible instead of having to hard code an unreliable
   timeout.

With these fixes, tests should 1) completely quickly on fast machines,
and 2) on slow machines they will still run to completion albeit slowly.
Note that previoulsy both were not true. The hardcoded timeouts meant
that on fast machines the tests were mostly idling wasting time, whereas
on slow machines, the timeouts often were not generous enough to allow
them to run to completion.

closes: vim/vim#16615

e70587dbdb

Part of shared.vim and test_crash.vim changes only.

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-10-02 12:18:16 +08:00
zeertzjq
9f33b69cfd vim-patch:cfcf1a5: runtime(doc): Clarify use of "noselect" in 'completeopt'
closes: vim/vim#18452

cfcf1a57cb

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Tomasz N <przepompownia@users.noreply.github.com>
2025-10-02 11:40:36 +08:00
zeertzjq
3f422cb5eb vim-patch:6e28211: runtime(doc): Tweak documentation style
closes: vim/vim#18462

6e282117c7

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-10-02 11:40:36 +08:00
Sergei Slipchenko
a1bc5d0ae6 fix(diagnostics): showing stale diagnostics in handlers #35890
Fixes #35884

Problem: Since `once_buf_loaded` might call a callback passed to it at a
later point (which is it's reason to exist) that callback might end up
referring to stale diagnostics in a handler's `show` function. For
example, if we first call `vim.diagnostic.set` for an unloaded buffer,
then call `vim.diagnostic.reset` and only then load the buffer, we might
still see diagnostics from `vim.diagnostic.set` call, which are stale at
this point.

Solution: only keep one autocommand from the most reset `show` call and
delete it when `hide` is called.
2025-10-01 20:17:55 -07:00
Justin M. Keyes
237827a0da test: normalize test filepath #35983
Problem:
Inconsistet slashes in Windows CI:

    ERROR test/functional\ex_cmds\mksession_spec.lua @ 36: ...

Solution:
Normalize the slashes.

    ERROR test/functional/ex_cmds/mksession_spec.lua @ 36: ...
2025-10-01 19:08:10 -07:00
zeertzjq
d72c805e87 vim-patch:8337d77: runtime(netrw): MS-Windows: fix netrw not being able to navigate to parent folder (#35982)
fixes: vim/vim#18421
closes: vim/vim#18464

8337d77eff

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2025-10-02 01:57:53 +00:00
zeertzjq
c12efc50a9 vim-patch:a644b79: runtime(optwin): Update formatting of option descriptions (#35980)
closes: vim/vim#18446

a644b7924d

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2025-10-02 09:06:41 +08:00
zeertzjq
39c0425c4c vim-patch:0977c8b: runtime(vim): Update base syntax, contain user command replacement text (#35979)
Ensure that :command replacement text terminates at the end of the
logical line.

Add :command to the generator exclusion list.

fixes: vim/vim#18414 (@Dougaak)
fixes: vim/vim#18448 (Maxim Kim)
closes: vim/vim#18415

0977c8b03e

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-10-02 00:41:04 +00:00
Riley Bruins
b4016f4525 fix(treesitter): don't add final newline if not present #35970
**Problem(?):** Buffers that (for whatever reason) aren't meant to have
a final newline are still parsed with a final newline in `treesitter.c`.

**Solution:** Don't add the newline to the last buffer line if it
shouldn't be there. (This more closely matches the approach of
`read_buffer_into()`.)

This allows us to, say, use a scratch buffer with `noeol` and `nofixeol`
behind the scenes in `get_string_parser()`.

...which would allow us to track injection trees with extmarks in that
case.

...which would allow us to not drop previous trees after reparsing a
different range with `get_parser():parse()`.

...which would prevent flickering when editing a buffer that has 2+
windows to it in view at a time.

...which would allow us to keep our sanity!!!

(one step at a time...)
2025-10-01 17:31:52 -07:00
zeertzjq
89dc889c3d Merge pull request #35978 from zeertzjq/vim-9.1.0689
vim-patch:9.1.{0689,0695,0698}
2025-10-02 08:26:44 +08:00
zeertzjq
532cc88604 vim-patch:9.1.0698: tests: "Untitled" file not removed when running Test_crash1_3 alone
Problem:  tests: "Untitled" file not removed when running Test_crash1_3 alone
          with TEST_FILTER (after v9.1.0695)
Solution: Use a TearDown function instead of another test.
          (zeertzjq)

closes: vim/vim#15578
closes: vim/vim#15577

d56c451e1c
2025-10-02 07:55:58 +08:00
zeertzjq
71662bbb49 vim-patch:9.1.0695: tests: test_crash leaves Untitled file around
Problem:  tests: test_crash leaves Untitled file around
Solution: cleanup at the end of the test_crash.vim test file

cd83173def

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 07:55:41 +08:00
zeertzjq
69a9a25fcc vim-patch:9.1.0689: [security]: buffer-overflow in do_search() with 'rightleft'
Problem:  buffer-overflow in do_search() with 'rightleft'
          (SuyueGuo)
Solution: after reversing the text (which allocates a new buffer),
          re-calculate the text length

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-v2x2-cjcg-f9jm

cacb6693c1

Add missing change from patch 8.1.1270.
Omit `call delete('Untitled')`: moved again in patch 9.1.0695.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-10-02 07:52:18 +08:00
zeertzjq
43f7434bd5 vim-patch:014c731: runtime(doc): make :h virtcol() more accurate (#35976)
The current description (especially the "unlimited width" part) is
inaccurate in several ways:
- The size of virtual text can depend on window width. In particular,
  the size of "above" virtual text can be equal to window width.
- A double-width character that doesn't fit adds 1 to the virtual column
  of the following characters.
- The size of 'showbreak' and 'breakindent' is counted.

related: vim/vim#5713
closes: vim/vim#18447

014c731fa5
2025-10-01 23:33:36 +00:00
v1nh1shungry
70460d557c fix(lsp): scope inline_completion autocmds to buffer (#35965)
Problem:
Autocmds in inline_completion Completor are not scoped to specific
buffers. When multiple buffers have inline completion enabled, events
(InsertEnter, CursorMovedI, TextChangedP, InsertLeave) in any buffer
trigger callbacks for all Completor instances, causing incorrect
behavior across buffers.

Solution:
Add `buffer = bufnr` parameter to nvim_create_autocmd() calls to make
them buffer-local. Each Completor instance now only responds to events
in its own buffer.
2025-10-01 06:56:56 -07:00
崔书豪
a053186aa7 build: redundant variable in cmake/Deps.cmake #35924 2025-09-30 20:16:02 -07:00
zeertzjq
6d550f3cdb test(terminal/mouse_spec): forwarding works with resized grid (#35969) 2025-10-01 01:24:02 +00:00
glepnir
198c9e9bca fix(shada): preserve marks after delete across sessions (#35795)
Problem: Marks are lost after `:bdelete` because `ignore_buf()` filters
out unlisted buffers during shada mark processing.

Solution: Revert to original buffer checks for mark operations, avoiding
`!buf->b_p_bl` condition that incorrectly ignores deleted buffers.
2025-09-30 05:28:35 +00:00
zeertzjq
35fc4fda99 vim-patch:9.1.1799: completion: crash with autcompletion (#35963)
Problem:  completion: crash with autcompletion
          (Maxim Kim)
Solution: Rework remove_old_matches (Girish Palya)

fixes: vim/vim#18378
fixes: vim/vim#18390
fixes: vim/vim#18391
closes: vim/vim#18427

3aa2edb557

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-09-30 02:42:13 +00:00