Commit Graph

31984 Commits

Author SHA1 Message Date
brianhuster
2b0f967b77 vim-patch:00a00f5: runtime(lua): Update lua ftplugin and documentation
Problem:
- The doc says the default `g:lua_subversion` is 2, but in fact it is 3
  (see `runtime/syntax/lua.vim`)
- `includeexpr` doesn't work with module in `init.lua`

Solution:
- Update documentation
- Assign value to option `&include`
- Add function `LuaInclude` and assign it to `l:&includeexpr`

closes: vim/vim#16655

00a00f5d3f

Co-authored-by: brianhuster <phambinhanctb2004@gmail.com>
Co-authored-by: dkearns <dougkearns@gmail.com>
2025-03-02 06:46:26 +08:00
Christian Clason
ea4a7cc616 vim-patch:8ac975d: runtime(tar): fix syntax error in tar.vim
8ac975d97e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-01 23:03:10 +01:00
Lewis Russell
ec8922978e feat(treesitter): add more metadata to language.inspect() (#32657)
Problem: No way to check the version of a treesitter parser.

Solution: Add version metadata (ABI 15 parsers only) as well as parser state count and supertype information (ABI 15) in `vim.treesitter.language.inspect()`. Also graduate the `abi_version` field, as this is now the official upstream name.

---------

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2025-03-01 15:51:09 +00:00
Christian Clason
48e6147e64 vim-patch:56957ed: runtime(misc): add support for bzip3 to tar, vimball and gzip plugins
fixes: vim/vim#16751
closes: vim/vim#16755

56957ed410

Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
2025-03-01 13:21:55 +01:00
zeertzjq
45d7aa3301 vim-patch:9.1.1158: :verbose set has wrong file name with :compiler! (#32682)
Problem:  :verbose set has wrong file name with :compiler!
Solution: Add -keepscript (zeertzjq)

closes: vim/vim#16752

5e8b2268e1
2025-02-28 23:45:47 +00:00
Luca Saccarola
7b4295390f docs(Open): add reference in documentation (#32678) 2025-02-28 23:14:01 +00:00
luukvbaal
86046c5a31 fix(marks): ineffective conceal_line callback optimization (#32662)
Problem:  _on_conceal_line callbacks are not invoked if callback has not
          let Nvim know it wants to receive them. But this may change on
          factors other than what is currently checked (changed buffer).
Solution: Forego this optimization, callback is still guarded behind
          'conceallevel'.
2025-02-28 13:36:25 +01:00
zeertzjq
77626ed7fd Merge pull request #28486 from zeertzjq/vim-8.2.4603
vim-patch:8.2.{4594,4603,4607,4647,4974}
2025-02-28 18:40:24 +08:00
zeertzjq
b66f395ff4 vim-patch:8.2.4974: ":so" command may read after end of buffer
Problem:    ":so" command may read after end of buffer.
Solution:   Compute length of text properly.

4748c4bd64

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-28 18:21:08 +08:00
zeertzjq
4e25b1a675 vim-patch:8.2.4647: "source" can read past end of copied line
Problem:    "source" can read past end of copied line.
Solution:   Add a terminating NUL.

2bdad61267

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-02-28 18:21:08 +08:00
zeertzjq
7c6a9c5589 vim-patch:8.2.4607: sourcing buffer lines may lead to errors for conflicts
Problem:    Sourcing buffer lines may lead to errors for conflicts.
Solution:   Add the ++clear argument. (Yegappan Lakshmanan, closes vim/vim#9991)

35dc17634d

Documentation changes only. Vim9script is N/A.
Cherry-pick another documentation change for :source from latest Vim.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:08 +08:00
zeertzjq
6750d00fe9 vim-patch:8.2.4603: sourcing buffer lines is too complicated
Problem:    Sourcing buffer lines is too complicated.
Solution:   Simplify the code. Make it possible to source Vim9 script lines.
            (Yegappan Lakshmanan, closes vim/vim#9974)

85b43c6cb7

This commit changes the behavior of sourcing buffer lines to always have
a script ID, although sourcing the same buffer always produces the same
script ID.

vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice

Problem:  Calling CLEAR_FIELD() on the same struct twice.
Solution: Remove the second CLEAR_FIELD().  Move the assignment of
          cookie.sourceing_lnum (zeertzjq).

closes: vim/vim#14627

f68517c167

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:08 +08:00
zeertzjq
a3a9f86d4a vim-patch:8.2.4594: need to write script to a file to be able to source them
Problem:    Need to write script to a file to be able to source them.
Solution:   Make ":source" use lines from the current buffer. (Yegappan
            Lakshmanan et al., closes vim/vim#9967)

36a5b6867b

Most code and test changes are reverted or modified again in patch
8.2.4603, so only port parts that are untouched in patch 8.2.4603.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-28 18:21:07 +08:00
Riley Bruins
9b25c68db2 fix(treesitter): correctly parse queries with combined injections 2025-02-28 09:33:02 +01:00
Christian Clason
8c4c9ca192 vim-patch:3d75ec7: runtime(compiler): improve svelte-check
closes: vim/vim#16749

3d75ec7401

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-28 09:32:42 +01:00
zeertzjq
da219960cb vim-patch:85a50fe: runtime(doc): fix confusing docs for 'completeitemalign' (#32671)
closes: vim/vim#16743

85a50fe825
2025-02-28 08:28:24 +08:00
zeertzjq
567ab3c34f vim-patch:60bd140: runtime(vim): Update base-syntax, match Vim9 function calls after "|" (#32670)
Match Vim9 function calls after ex-bar.  These are also currently
matched but invalid syntax for legacy script.

fixes: vim/vim#16721
closes: vim/vim#16747

60bd140256

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-02-28 08:28:05 +08:00
zeertzjq
332d596959 vim-patch:9.1.1157: command completion wrong for input() (#32669)
Problem:  command completion wrong for input()
          (Cdrman Fu)
Solution: Set commandline completion context explicitly
          (Jim Zhou)

fixes vim/vim#16723
closes: vim/vim#16733

3255af850e

Co-authored-by: Jim Zhou <csd_189@163.com>
2025-02-28 08:23:02 +08:00
zeertzjq
3eee6f9d63 vim-patch:9.1.1156: tests: No test for what patch 9.1.1152 fixes (#32668)
Problem:  No test for what patch 9.1.1152 fixes.
Solution: Add a test (zeertzjq).

closes: vim/vim#16742

4be1ab80be
2025-02-27 23:11:16 +00:00
zeertzjq
df0328521f vim-patch:9.1.1155: Mode message not cleared after :silent message (#32667)
Problem:  Mode message not cleared after :silent message
          (after 9.0.1634).
Solution: Don't reset mode_displayed when the message is empty.
          (zeertzjq)

fixes: neovim/neovim#32641
closes: vim/vim#16744

fce1fa5b61
2025-02-27 23:03:52 +00:00
zeertzjq
89d6d6f25c fix(lua): wrong script context for option set by func from nvim_exec2 (#32659)
Problem:  Wrong script context for option set by function defined by
          nvim_exec2 in a Lua script.
Solution: Call nlua_set_sctx() after adding SOURCING_LNUM and always set
          sc_lnum for a Lua script.

This is a bug discovered when testing #28486. Not sure if this actually
happens in practice, but it's easy to fix and required for #28486.
2025-02-27 13:49:57 +00:00
luukvbaal
f25dd7a8d5 fix(display): correctly store winline info for concealed lines (#32656)
Off-by-one error in storing last line number for a logical line.
2025-02-27 13:15:47 +01:00
glepnir
ac1c5ccb2c fix(popup): reuse pum preview float win, set 'winfixbuf' #32636
Problem:
popup floating window is closed and recreated for each item selection,
this is a bit wasteful.

Solution:
- Hide the preview win (instead of closing it) when the menu is still displayed:
    1. When selected_item is -1.
    2. When switching from an item with an "info" field to one without.
- When pum is undisplayed it is still closed.
2025-02-27 02:41:29 -08:00
David Briscoe
6a9555c0fa doc: clarify window-id, tab-id, nvim_set_current_x #32528
Problem:
Descriptions are somewhat vague. nvim_set_current_line modifies contents
but nvim_set_current_buf does not, etc.

Solution:
- Make it clear that these functions accept or return a winid/tabid by
  linking to that concept in help.
- Only these few files use the term "handles", so replace them with the
  more conventional terminology.
- Add a new help section for tab-ID. This concept is unique to neovim
  because vim exposes tabnr, but not tab handles. This section is
  modelled after `:h winid`.
2025-02-27 02:05:00 -08:00
zeertzjq
746139fa1e refactor(do_source): remove duplicate assignments (#32654)
The code above have already set sc_lnum to 0.
2025-02-27 17:39:25 +08:00
luukvbaal
f86864f22f fix(move): 'scrolloff' cursor correction no longer handles folds properly (#32642)
Problem:  f58e7d5f passed `&botline` to `plines_win_full()`, (probably)
          assuming it would be set to the first line of the fold.
Solution: Reinstate call to `hasFolding()` to do so.
2025-02-27 08:52:19 +01:00
zeertzjq
1e4c708033 test: option set by Lua autocommand has correct script context (#32652) 2025-02-27 05:48:52 +00:00
zeertzjq
877f3b7288 refactor(shada): fix coverity warning about leaking memory (#32650) 2025-02-27 10:38:04 +08:00
zeertzjq
189bba7c77 Merge pull request #32649 from zeertzjq/vim-9.1.1151
vim-patch:9.1.{1151,1152}
2025-02-27 09:17:36 +08:00
zeertzjq
f56d2b3c59 vim-patch:9.1.1152: Patch v9.1.1151 causes problems
Problem:  Patch v9.1.1151 causes problems
Solution: partially revert it (John Marriott)

closes: vim/vim#16736

18bacc811c

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-02-27 08:55:43 +08:00
zeertzjq
e1a3128ec4 vim-patch:9.1.1151: too many strlen() calls in getchar.c
Problem:  too many strlen() calls in getchar.c
Solution: store last inserted and recorded lengths,
          add functions to retrieve those and use those
          functions (John Marriott)

closes: vim/vim#16720

d3c4b7e946

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-02-27 08:55:14 +08:00
Justin M. Keyes
3cce657031 refactor: old references to scripts/ dir #32647 2025-02-26 23:00:54 +00:00
Justin M. Keyes
4f42b69b4a Merge #32601 vim.text.indent() 2025-02-26 14:31:03 -08:00
Justin M. Keyes
4a997a1732 test: unreliable swapfile_preserve_recover_spec
Problem:
Test sometimes fails on bsd (cirrus ci):

    test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:589: retry() attempts: 464
    test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:590: Expected objects to be the same.
    Passed in:
    (table: 0x0d5f1aa44070) {
      [1] = ''
     *[2] = ''
      [3] = '[Process exited 1]' }
    Expected:
    (table: 0x0d5ea3eb8718) {
      [1] = ''
     *[2] = '[Process exited 1]'
      [3] = '' }
    stack traceback:
      test/testutil.lua:104: in function 'retry'
      test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:589: in function <test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:556>

Solution:
Filter out empty items to avoid irrelevant redraw-timing assumptions.
2025-02-26 23:06:22 +01:00
Justin M. Keyes
be1fbe38b3 feat(lua): vim.text.indent()
Problem:
Indenting text is a common task in plugins/scripts for
presentation/formatting, yet vim has no way of doing it (especially
"dedent", and especially non-buffer text).

Solution:
Introduce `vim.text.indent()`. It sets the *exact* indentation because
that's a more difficult (and thus more useful) task than merely
"increasing the current indent" (which is somewhat easy with a `gsub()`
one-liner).
2025-02-26 23:06:22 +01:00
IpsumCapra
f4921e2b7d fix(shada): ":wshada/:rshada [filename]" with shadafile=NONE #32538
Problem: read/write shada function logic was skipped entirely if it was
detected the shadafile option was set to 'NONE'.

Solution: The filename is now always resolved. When the shadafile option
is set to 'NONE' AND no filename was passed, the filename resolves to an
empty string, which causes the read/write functions to return.
Regardless of whether the option is set to 'NONE', when a filename is
explicitly passed, it gets resolved and the read/write logic is
accessed.
2025-02-26 11:03:50 -08:00
Lewis Russell
0f24b0826a build: move all generator scripts to src/gen/
- Move all generator Lua scripts to the `src/gen/`
- Add a `.luarc.json` to `src/gen/`
- Add a `preload.lua` to `src/gen/`
  - Add `src` to `package.path` so it aligns with `.luarc.json'
- Fix all `require` statements in `src/gen/` so they are consistent:
    - `require('scripts.foo')` -> `require('gen.foo')`
    - `require('src.nvim.options')` -> `require('nvim.options')`
    - `require('api.dispatch_deprecated')` -> `require('nvim.api.dispatch_deprecated')`
2025-02-26 16:54:37 +00:00
zeertzjq
85caaa70d4 refactor(gen_api_dispatch): avoid trailing spaces (#32632)
Problem:
Generated Lua API bindings may have trailing spaces (e.g. nvim_set_hl).

Solution:
Add leading spaces only if arg_free_code is non-empty.
Also:
- Remove an unnecessary string.format() in write_shifted_output() args.
- Fix incorrect indent for the nlua_push_keydict() below.
2025-02-26 20:23:27 +08:00
James McCoy
c619d1da61 Merge pull request #32631 from jamessan/snprintf-binary
fix(vim_snprintf): special-case handling of binary format
2025-02-26 04:23:52 -07:00
Tristan Knight
7ead328a48 build(cjson): sync with upstream (#32114)
Sync with commit 91ca29db9a
2025-02-26 09:40:02 +01:00
zeertzjq
b0a1d35f69 fix(eval): don't shorten $HOME in v:stacktrace (#32634) 2025-02-26 07:33:11 +00:00
zeertzjq
f4bb7417b7 refactor: remove unnecessary allocation for "run Nvim with -V1" (#32633) 2025-02-26 05:55:29 +00:00
James McCoy
453f2c52d2 fix(vim_snprintf): special-case handling of binary format
A binary format spec always expects a corresponding unsigned long long
value. However, that explicit handling didn't get included when porting
the code from Vim, so binary format spec was falling through to the
"unsigned" and "length_modifier = NUL" portion of the code:

        } else {
          // unsigned
          switch (length_modifier) {
          case NUL:
            uarg = (tvs
                    ? (unsigned)tv_nr(tvs, &arg_idx)
                    : (skip_to_arg(ap_types, ap_start, &ap, &arg_idx,
                                   &arg_cur, fmt),
                       va_arg(ap, unsigned)));
            break;

This incorrectly read an "unsigned" value from an "unsigned long long"
variable, which would produce incorrect results on certain platforms.
2025-02-25 21:58:22 -05:00
zeertzjq
a2b464944a refactor(options): fix coverity warning about unintialized sc_chan (#32630) 2025-02-26 01:47:29 +00:00
Riley Bruins
93278e7720 fix(extmark): clearer error message for invalid ephemeral mark usage 2025-02-26 01:08:51 +01:00
zeertzjq
23f7e5593d Merge pull request #32614 from brianhuster/vim-094494b
vim-patch: improve &keywordprg in Vim ftplugin
2025-02-26 07:51:10 +08:00
zeertzjq
e2aca58bcc fix(lua): don't override script ID from :source (#32626)
Problem:  When setting an option, mapping etc. from Lua without -V1, the
          script ID is set to SID_LUA even if there already is a script
          ID assigned by :source.
Solution: Don't set script ID to SID_LUA if it is already a Lua script.
          Also add _editor.lua to ignorelist to make script context more
          useful when using vim.cmd().
2025-02-25 23:40:21 +00:00
zeertzjq
9c43e5cd4a vim-patch:580e457: runtime(vim): make VimKeywordPrg even smarter for regexes
closes: vim/vim#16729

580e457a2a

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-02-26 07:31:49 +08:00
brianhuster
6db439ff01 vim-patch:094494b: runtime(vim): improve &keywordprg in ftplugin
- let keywordprg in vim filetype handle context-sensitive help calls by
  detecting the syntax group of the word under the cursor
- reformat whitespace
- add modeline

related: vim/vim#16677
closes: vim/vim#16680

094494bf2e

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Co-authored-by: Andrew Radev <andrey.radev@gmail.com>
Co-authored-by: "D. Ben Knoble" <ben.knoble+github@gmail.com>
Co-authored-by: Gary Johnson <garyjohn@spocom.com>
Co-authored-by: Tim Pope <code@tpope.net>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-02-26 07:31:03 +08:00
luukvbaal
af0a2157ad fix(move): wrong cursor row on concealed line (#32629)
Problem:  Cursor row calculation does not take into account concealed lines.
Solution: Break the loop when the next calculated line is concealed.
2025-02-25 23:45:52 +01:00