Commit Graph

33296 Commits

Author SHA1 Message Date
zeertzjq
d7050d6e39 vim-patch:f2290a6: runtime(compiler): Add PHPStan compiler (#34985)
closes: vim/vim#17781

f2290a6823

Co-authored-by: Dietrich Moerman <dietrich.moerman@gmail.com>
2025-07-18 09:18:26 +00:00
Christian Clason
9df9d3af3b vim-patch:b7fc24d: runtime(python): Highlight f-strings in Python
fixes: vim/vim#10734
fixes: vim/vim#14033
closes: vim/vim#17767

b7fc24d3a3

Co-authored-by: Rob B <github@0x7e.net>
2025-07-18 10:33:05 +02:00
Justin M. Keyes
fd5d04fbff Merge #34921 tutor: reimplement interactive marks as extmarks 2025-07-17 23:26:55 -04:00
brianhuster
1de2a03fc7 test(tutor_spec): remove test description("Tutor: tutor")
Problem:
It is redundant since we have another test that test interactive marks
in lesson 2.6 of tutor 1
2025-07-18 10:04:36 +07:00
brianhuster
1255a8d88d refactor(tutor): reimplement interactive marks as extmark in Lua
Problem:
From https://matrix.to/#/!cylwlNXSwagQmZSkzs:matrix.org/$Ofj-TFIsEMbp0O9OhE8xuZSNi-nhRLtZTOgs6JRLNrs?via=matrix.org&via=gitter.im&via=mozilla.org

In lesson 2.6, users are asked to remove the second, forth and fifth
lines with `dd` command, then they are asked to undo twice to make the
text go back to original state. But after that, the mark ✗ appears
again, which confuses the user because they think they do something
wrong. This is a limitation with the current implementation, which is
based on line number only.

Solution:
Reimplement interactive marks as extmarks in Lua. This also make the
feature less fragile, as users can remove, add some arbitrary lines
without breaking the interactive marks.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-07-18 10:04:20 +07:00
zeertzjq
995bc31eaf vim-patch:3ab6941: runtime(doc): Tweak documentation (#34980)
closes: vim/vim#17759

3ab6941713

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-18 02:01:29 +00:00
zeertzjq
7631302ad6 vim-patch:9.1.1544: :retab cannot be limited to indentation only (#34939)
Problem:  :retab cannot be limited to indentation only
Solution: add the optional -indentonly parameter
          (Hirohito Higashi)

closes: vim/vim#17730

836e54f5de

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-18 01:30:32 +00:00
zeertzjq
4fe6fcc5b7 Merge pull request #34979 from zeertzjq/vim-9.1.1552
vim-patch: tar plugin updates
2025-07-18 09:05:47 +08:00
zeertzjq
77c6cae25b vim-patch:9.1.1552: [security]: path traversal issue in tar.vim
Problem:  [security]: path traversal issue in tar.vim
          (@ax)
Solution: warn the user for such things, drop leading /, don't
          forcefully overwrite files when writing temporary files,
          refactor autoload/tar.vim

tar.vim: drop leading / in path names

A tar archive containing files with leading `/` may cause confusions as
to where the content is extracted.  Let's make sure we drop the leading
`/` and use a relative path instead.

Also while at it, had to refactor it quite a bit and increase the
minimum supported Vim version to v9. Also add a test for some basic tar
functionality

closes: vim/vim#17733

87757c6b0a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-18 08:40:23 +08:00
zeertzjq
ad0c21a445 vim-patch:470317f: runtime(tar): remove dependency on netrw#WinPath, include mapping doc
related: vim/vim#17124

470317f78b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-18 08:40:23 +08:00
zeertzjq
2efc84d005 vim-patch:a250738: runtime(tar): use readblob() instead of shelling out to file(1)
fixes: #vim/vim#16761
closes: vim/vim#16769

a250738303

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2025-07-18 08:40:23 +08:00
zeertzjq
5671b61327 vim-patch:partial:9.0.0877: using freed memory with :comclear while listing commands
Problem:    Using freed memory with :comclear while listing commands.
Solution:   Bail out when the command list has changed. (closes vim/vim#11440)

cf2594fbf3

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-18 08:40:23 +08:00
zeertzjq
4f0ab9877b vim-patch:9.1.1557: not possible to anchor specific lines in diff mode (#34967)
Problem:  not possible to anchor specific lines in diff mode
Solution: Add support for the anchoring lines in diff mode using the
          'diffanchor' option (Yee Cheng Chin).

Adds support for anchoring specific lines to each other while viewing a
diff. While lines are anchored, they are guaranteed to be aligned to
each other in a diff view, allowing the user to control and inform the
diff algorithm what the desired alignment is. Internally, this is done
by splitting up the buffer at each anchor and run the diff algorithm on
each split section separately, and then merge the results back for a
logically consistent diff result.

To do this, add a new "diffanchors" option that takes a list of
`{address}`, and a new "diffopt" option value "anchor". Each address
specified will be an anchor, and the user can choose to use any type of
address, including marks, line numbers, or pattern search. Anchors are
sorted by line number in each file, and it's possible to have multiple
anchors on the same line (this is useful when doing multi-buffer diff).
Update documentation to provide examples.

This is similar to Git diff's `--anchored` flag. Other diff tools like
Meld/Araxis Merge also have similar features (called "synchronization
points" or "synchronization links"). We are not using Git/Xdiff's
`--anchored` implementation here because it has a very limited API
(it requires usage of the Patience algorithm, and can only anchor
unique lines that are the same across both files).

Because the user could anchor anywhere, diff anchors could result in
adjacent diff blocks (one block is directly touching another without a
gap), if there is a change right above the anchor point. We don't want
to merge these diff blocks because we want to line up the change at the
anchor. Adjacent diff blocks were first allowed when linematch was
added, but the existing code had a lot of branched paths where
line-matched diff blocks were handled differently. As a part of this
change, refactor them to have a more unified code path that is
generalized enough to handle adjacent diff blocks correctly and without
needing to carve in exceptions all over the place.

closes: vim/vim#17615

0d9160e11c

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-07-18 08:04:32 +08:00
Gregory Anders
e0d179561d Merge pull request #34860 from gpanders/push-lorwmnmtysnt
feat(tui): use DA1 response to determine OSC 52 support
2025-07-17 18:47:33 -05:00
zeertzjq
9d1333a385 vim-patch:9.1.1563: completion: ruler may disappear (#34977)
Problem:  The ruler disappears after typing the second character during
          insert mode completion, even when completion messages are
          suppressed ('shortmess' includes "c"). This makes the UI
          appear inconsistent.
Solution: Ensure the ruler is restored during screen redraw when popup
          completion is active (Girish Palya).

Notes:
No new tests were added, as existing screen dump tests were updated to
reflect the corrected behavior.

closes: vim/vim#17770

824286c9a7

Nvim already behaves correctly as the popup menu is a separate grid in
the compositor.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-17 23:37:17 +00:00
zeertzjq
1b6848c299 vim-patch:175662f: runtime(vim): Update base syntax, fix incorrect function error (#34975)
Don't match lower-case function names as errors when the qualifier
includes a dict/list accessor.

This is a less than perfect fix until qualified function call matching
is reworked.

fixes: vim/vim#17766
closes: vim/vim#17780

175662f4f2

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-17 23:06:51 +00:00
zeertzjq
0d0655f725 vim-patch:57300a2: runtime(doc): fix claim that 'CTRL-W CTRL-C' and 'CTRL-W c' are the same (#34976)
closes: vim/vim#17776

57300a22dc

Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-07-18 07:02:10 +08:00
zeertzjq
4a4e6a792a Merge pull request #34961 from zeertzjq/vim-9.1.1554
vim-patch:9.1.{1554,1559}
2025-07-18 06:29:47 +08:00
zeertzjq
be35864318 vim-patch:9.1.1559: tests: Test_popup_complete_info_01() fails when run alone
Problem:  tests: Test_popup_complete_info_01() fails when run alone.
Solution: Set buffer-local competeopt+=noinsert and add missing cleanup
          in Test_popup_complete() (zeertzjq).

closes: vim/vim#17773

12d274af44
2025-07-18 06:09:51 +08:00
zeertzjq
436ae1d23e vim-patch:9.1.1554: crash when omni-completion opens command-line window
Problem:  Vim crashes during omnifunc completion inside the command-line
          window ("q:") if the completion item attempts to open an "info"
          preview window. This leads to a failed assert during execution.
Solution: Avoid opening preview windows while inside the command-line
          window to prevent the crash (Girish Palya).

closes: vim/vim#17764

e4fdb1e4e7

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-18 06:09:51 +08:00
luukvbaal
a08d6a8ac1 test(screen): remove screen:get_default_attr_ids() (#34973)
Problem:  get_default_attr_ids() is used to get and change a subset of
          the current highlight definitions in {fold,popupmenu}_spec.lua,
          for which we have add_extra_attr_ids().
Solution: Use global highlight definitions and use add_extra_attr_ids to
          replace.
2025-07-17 22:57:34 +02:00
zeertzjq
e6ce067f02 vim-patch:9.1.1556: string handling in cmdexpand.c can be improved (#34966)
Problem:  string handling in cmdexpand.c can be improved
Solution: Improve string manipulation in cmdexpand.c (John Marriott).

This PR does the following:

In cmdline_fuzzy_completion_supported():
- replace the series of if tests with a switch

In expand_shellcmd_onedir():
- move the code to concatenate path and pattern to expand_shellcmd().
  This allows us to slightly simplify the argument list to pass the fully
  pathed pattern and the length of the path in the pattern (0 if no path)
- factor out calls to STRMOVE()

In expand_shellcmd():
- factor out calls to STRMOVE() in the first for loop.
- reorganise the second for loop by:
  a) only calling vim_strchr() if s is not at the end of the string
  b) making sure that when the path and pattern are concatenated they fit
     inside buf
  c) concatenating path and pattern and pass to expand_shellcmd_onedir()

In globpath():
- slightly improve logic that determines if the complete path will fit
  inside the buffer

In f_getcompletion():
- replace the series of if tests with a switch
- factor out calls to STRLEN()

In copy_substring_from_pos():
- factor out the call to STRLEN()

closes: vim/vim#17742

393d398247

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-07-17 02:45:37 +00:00
nikolightsaber
8bf99ddbac docs(lua): add vim.pack to _meta.lua #34957
Problem: Goto definition to pack.lua does not work

Solution: Add pack to _meta.lua

Co-authored-by: Nikolai Devolder <nikolai.devolder@yamabiko.eu>
2025-07-16 19:18:52 -07:00
luukvbaal
e946951f6a test(tui_spec): flakiness, global highlight definitions #34958 2025-07-16 18:54:22 -07:00
zeertzjq
1c6ddd9a5f build(vim-patch.sh): remove vim.pot (#34964)
This file is updated on almost every source change like version.c.
2025-07-17 09:27:41 +08:00
zeertzjq
fcec1610e7 vim-patch:9.1.1555: completion: repeated insertion of leader (#34962)
Problem:  completion: repeated insertion and deletion of complete
          functions
Solution: Remove unnecessary insertion and deletion of leader text
          ('compl_orig_text') during expansion of function present in
          'complete' option (Girish Palya).

closes: vim/vim#17738

78b10eab6c

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-16 23:17:50 +00:00
Christian Clason
8bccd07972 vim-patch:9.1.1549: filetype: pkl files are not recognized
Problem:  filetype: pkl files are not recognized
Solution: detect *.pkl files as pkl filetype, include
          a filetype plugin (Riley Bruins)

References:
https://pkl-lang.org/
https://github.com/apple/pkl

closes: vim/vim#17751

d128889b30

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-07-16 10:32:33 +02:00
Christian Clason
4195b82ec9 vim-patch:9.1.1548: filetype: OpenFGA files are not recognized
Problem:  filetype: OpenFGA files are not recognized
Solution: detect *.fga files as fga filetype, include an fga filetype
          plugin (Riley Bruins)

References:
https://github.com/openfga
https://marketplace.visualstudio.com/items?itemName=openfga.openfga-vscode

closes: vim/vim#17752

0992f62fc1

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-07-16 10:32:33 +02:00
Christian Clason
fa648731ec vim-patch:9a667b4: runtime(swig): add 'comments', 'commentstring' in filetype plugin
Reference:
https://www.swig.org/Doc1.3/SWIG.html#SWIG_nn5

closes: vim/vim#17753

9a667b4dba

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-07-16 10:32:33 +02:00
Christian Clason
694f634556 vim-patch:30df425: runtime(twig): include twig filetype plugin
closes: vim/vim#17754

30df42557c

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-07-16 10:32:33 +02:00
Christian Clason
83818b885a vim-patch:edce689: runtime(python2): Highlight b-strings in Python 2.7
related: vim/vim#14033
related: vim/vim#17726

closes: vim/vim#17757

edce68912e

Co-authored-by: Rob B <github@0x7e.net>
2025-07-16 10:32:33 +02:00
Donatas
ace254c9ff fix(lsp): close floating preview window correctly #34946
Problem:
After 28b7c2d (found with bisect) the hover preview window does not
close when :edit'ing another file, even when you move the cursor.

Solution:
Change the BufLeave to target the original buffer, not the preview
buffer.
2025-07-15 20:12:45 -07:00
zeertzjq
5cfdd4d8b9 vim-patch:9.1.1551: [security]: path traversal issue in zip.vim (#34951)
Problem:  [security]: path traversal issue in zip.vim (@ax)
Solution: drop leading ../ on write of zipfiles, don't forcefully
          overwrite existing files

A zip plugin which contains filenames with leading '../'  may cause
confusion as to where the content will be extracted.  Let's drop such
things and make sure we use a relative filename instead and don't
forcefully overwrite temporary files. Also, warn the user of such
things.

related: vim/vim#17733

586294a041

vim-patch:e1044fb: runtime(zip): raise minimum Vim version to v9.0
vim-patch:e2d9b0d: runtime(zip): zip plugin does not work with Vim 9.0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-16 01:08:57 +00:00
Phạm Bình An
9789a3b854 revert: "fix(runtime): set 'foldmethod' for Lua ftplugin #34929" (#34947)
This reverts commit 12276832ab.
2025-07-16 06:15:16 +08:00
Gregory Anders
112092271b refactor(vterm): update vterm DA1 response
Update vterm's DA1 response to the more modern version that indicates
level 1 support for VT100 emulation (61) as well as ANSI color support
(22).
2025-07-15 08:41:13 -05:00
Christian Clason
d4c8e8df1c vim-patch:a24f5be: runtime(python): highlight bytes in python
- Highlight bytes literals
- Do not highlight Unicode escape sequences in bytes literals

fixes: vim/vim#14033
fixes: vim/vim#17726
closes: vim/vim#17728

a24f5be86d

Co-authored-by: Rob B <github@0x7e.net>
2025-07-15 00:14:00 +02:00
Christian Clason
3eb597c999 vim-patch:baa781a: runtime(python2): highlight unicode strings in python2
fixes: vim/vim#14033
fixes: vim/vim#17726
closes: vim/vim#17729

baa781a4c3

Co-authored-by: Rob B <github@0x7e.net>
2025-07-15 00:14:00 +02:00
Christian Clason
73987a4301 vim-patch:e85a66a: runtime(erlang): Add support for triple-quoted strings and docstrings
Erlang recently added the `-moduledoc` attribute as well as triple
quoted strings and the `~` prefix for binary strings, see [1].

Erlang also added nominal types. See EEP-69 [2].

This commit removes the documentation of "g:erlang_highlight_bifs" and
"g:erlang_highlight_special_atoms", which are not longer supported.
"g:erlang_old_style_highlight" is kept undocumented (as it should not be
used by new users).

This commit contains the modifications in the following PR and commits:

- vim-erlang/vim-erlang-runtime#58
- vim-erlang/vim-erlang-runtime@43d18d3
- vim-erlang/vim-erlang-runtime@ac88ebf
- vim-erlang/vim-erlang-runtime@19c1be9
- vim-erlang/vim-erlang-runtime@7f5cefc
- vim-erlang/vim-erlang-runtime@976b10b

[1]: https://www.erlang.org/doc/system/documentation.html
[2]: https://www.erlang.org/eeps/eep-0069

closes: vim/vim#17687

e85a66a4d4

Co-authored-by: Csaba Hoch <csaba@cursorinsight.com>
Co-authored-by: Johannes Christ <jc@jchri.st>
2025-07-15 00:14:00 +02:00
Lewis Russell
a945686444 feat(term): increase max scrollback to 1000000
Problem:
Cannot use `nvim_open_term()` to pipe terminal scrollback > 100000

Solution:
Increase scrollback limit to 1000000

If there's no technical consequences of doing this, can be set even
higher in the future.
2025-07-14 16:41:18 +01:00
Phạm Bình An
12276832ab fix(runtime): set 'foldmethod' for Lua ftplugin #34929
Problem:
Neovim's Lua ftplugin doesn't set `'foldmethod'`, though Vim one sets it 1341176e7b/runtime/ftplugin/lua.vim (L66-L68)

Solution:
Set it
2025-07-14 05:28:30 -07:00
Justin M. Keyes
7bf04bc01f test(fold): flaky "doesn't open folds that are not touched" #34911 2025-07-13 17:05:01 -07:00
zeertzjq
9f16b598f9 vim-patch:1341176: runtime(vim): Update help syntax file, improve highlighting of included Vim examples (#34924)
- Take over as file maintainer.
- Improve highlighting of legacy script examples by using :syn-iskeyword
  with the default 'iskeyword' value. Vim9 script examples are not
  supported yet.
- Match admonition labels in more contexts.
- Match URLs in more contexts.

fixes vim/vim#17721
closes: vim/vim#17731

1341176e7b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-13 23:11:22 +00:00
zeertzjq
f487ae90cf vim-patch:9.1.1539: completion: messages don't respect 'shm' setting (#34923)
Problem:  completion: messages don't respect 'shm' setting
Solution: Turn off completion messages when 'shortmess' includes "c"
          (Girish Palya).

`:set shortmess+=c` is intended to reduce noise during completion by
suppressing messages.
Previously, some completion messages still appeared regardless of this setting.

This change ensures that **all** completion-related messages are suppressed
when `'c'` is present in `'shortmess'`.

Not entirely sure if the original behavior was intentional. If there's a
reason certain messages were always shown, feel free to close this without
merging.

closes: vim/vim#17737

fe1d3c8af7

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-13 22:53:40 +00:00
Christian Clason
96ec4db3e9 build(deps): bump tree-sitter to v0.25.8 2025-07-13 23:00:50 +02:00
Tom Ampuero
7cd5356a6f feat(net): vim.net.request(), :edit [url] #34140
Problem:
Nvim depends on netrw to download/request URL contents.

Solution:
- Add `vim.net.request()` as a thin curl wrapper:
  - Basic GET with --silent, --show-error, --fail, --location, --retry
  - Optional `opts.outpath` to save to a file
  - Operates asynchronously. Pass an `on_response` handler to get the result.
- Add integ tests (requires NVIM_TEST_INTEG to be set) to test success
  and 404 failure.
- Health check for missing `curl`.
- Handle `:edit https://…` using `vim.net.request()`.

API Usage:
1. Asynchronous request:

    vim.net.request('https://httpbingo.org/get', { retry = 2 }, function(err, response)
      if err then
        print('Fetch failed:', err)
      else
        print('Got body of length:', #response.body)
      end
    end)

2. Download to file:

    vim.net.request('https://httpbingo.org/get', { outpath = 'out_async.txt' }, function(err)
      if err then print('Error:', err) end
    end)

3. Remote :edit integration (in runtime/plugin/net.lua) fetches into buffer:

    :edit https://httpbingo.org/get
2025-07-13 13:43:11 -07:00
Christian Clason
444a8b3ec6 vim-patch:6f85cec: runtime(python): update rendering of Unicode named literals in syntax script
This change:

* enforces that the alias starts with a letter
* allows the other words in an alias to be separated by either a space
  or a hyphen, but not both or double separators
* allows only a letter after space, possibly followed by letters or
  digits
* allows both letters and digits after a hyphen

Tested with:

    a = '\N{Cyrillic Small Letter Zhe} is pronounced as zh in pleasure'
    b = '\N{NO-BREAK SPACE} is needed here'
    # ... other tests here
    r = '\N{HENTAIGANA LETTER E-1} is a Japanese hiragana letter archaic ye'
    s = '\N{CUNEIFORM SIGN NU11 TENU} is a correction alias'
    t = '\N{RECYCLING SYMBOL FOR TYPE-1 PLASTICS} base shape is a triangle'
    print(a)
    print(b)
    print(r)
    print(s)
    print(t)

The tests confirm the behavior and are selected from real Unicode
tables/aliases to check these combinations based on the specification.

fixes: vim/vim#17323
closes: vim/vim#17735

6f85cec4fb

Co-authored-by: Zvezdan Petkovic <zpetkovic@acm.org>
2025-07-13 11:07:40 +02:00
zeertzjq
3e7f5d95aa vim-patch:ce1d196: runtime(vim): Update base syntax, improve :match highlighting (#34912)
- Match the range prefix separately as a count.
- Match an explicit count of 1, rarely used but seen in the wild.
- Allow whitespace between the count and command.

closes: vim/vim#17717

ce1d1969f3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-13 16:39:19 +08:00
Yi Ming
73fbc693b5 refactor(lsp): drop vim.lsp.util._refresh() #33903
Problem:
- util._refresh() is only used by `inlay_hint.lua` and `document_color.lua`, and
  both have their own wrapper functions;
- util._refresh() provides unified parameters, but this layer of wrapping is
  almost meaningless because
  - document color does not need the range parameter;
  - inlay hint requires a range parameter, but it is not complicated

Therefore, it can be considered redundant.
ref https://github.com/neovim/neovim/pull/32887#discussion_r1996413602

Solution:
Remove it.
2025-07-12 22:00:10 -07:00
Justin M. Keyes
89b946aa87 fix(lua): vim.diff is nil in uv.new_work() thread #34909
Problem:
The "gitsigns" plugin runs `vim.diff` in a thread (`uv.new_work`), but
`vim.diff` is nil in that context:

    Lua callback:
    …/gitsigns.nvim/lua/gitsigns/diff_int.lua:30: bad argument #1 to 'decode' (string expected, got nil)
    stack traceback:
      [C]: in function 'decode'
      …/gitsigns.nvim/lua/gitsigns/diff_int.lua:30: in function <…/gitsigns.nvim/lua/gitsigns/diff_int.lua:29>
    Luv thread:
    …/gitsigns.nvim/lua/gitsigns/diff_int.lua:63: attempt to call field 'diff' (a nil value)

Solution:
Revert the `stdlib.c` change (set `vim.diff` instead of `vim._diff`).
2025-07-12 20:54:22 -07:00
Justin M. Keyes
5c4f9b05fa Merge #34797 refactor(lsp): enable()/is_enabled() 2025-07-12 23:44:21 -04:00