Commit Graph

32145 Commits

Author SHA1 Message Date
535c2f8658 build(contrib): add zsh completion (#32617)
* build(contrib): add zsh completion

this is not part of the build system yet, so packager managers are
supposed to install the file by themselves.

bash doesn't seem to provide shell completion, zsh embeds its own
completion that is bundled with vim's.

Instead of copying zsh's completion, this generated one via
https://github.com/RobSis/zsh-completion-generator


---------

Co-authored-by: Eisuke Kawashima <e.kawaschima+github@gmail.com>
2025-03-16 18:15:00 +01:00
3e3775961f refactor(lsp)!: rename lsp.completion.trigger() to get() (#32911)
Problem: `trigger` is a custom word not yet used in APIs. 

Solution: Use `get` instead because the main effect is that the 
completion candidates will be collected (and shown by default,
but follow-up commits are planned to add an `on_result` callback
that allows more general handling).

---------

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2025-03-16 13:58:38 +01:00
f5dd30948e fix(checkhealth): handle nested lua/ directory #32918
Problem: :checkhealth fails if plugin has nested "lua/" directory

Solution: trim `{runtimepath}/lua` from fullpath to get subpath
(`./**/{health, health/init.lua}`)
2025-03-16 05:49:05 -07:00
7aae3f98de refactor(test): move runtime_spec.lua to editor/ #32919
Problem:
The `lua/` tests dir is for Lua stdlib tests. It is not for anything
that randomly happens to be implemented with Lua.

Solution:
Move `lua/runtime_spec.lua` to `editor/runtime_spec.lua`.
2025-03-16 05:43:06 -07:00
xzb
17c25a66fc fix(diagnostic): virtual lines should scroll horizontally 2025-03-16 12:31:29 +01:00
72f630f92d fix(marks): issues with invalid marks and marks beyond eob (#32862)
Problem:  Marks that go beyond the end of the buffer, and paired marks
          whose end is in front of its start mark are added to and
          removed from the decor. This results in incorrect tracking
          of the signcolumn.
Solution: Ensure such marks are not added to and removed from the decor.
2025-03-16 12:15:50 +01:00
466f20dd70 refactor(tui): disable kitty key event reporting
Temporary measure for the stable release. Re-enable for nightly after
0.11 release.
2025-03-16 12:03:45 +01:00
1862d3210d docs(lsp): simplify example of enabling LSP folding 2025-03-16 11:21:44 +01:00
f5714994bc feat(runtime): Lua ftplugin sets 'omnifunc', 'foldexpr' #32697
Problem:
- Many other ftplugin have defined 'omnifunc', but the Lua one doesn't
  define one, even though there is `vim.lua_omnifunc()`
- Users may want "stupid" completion to fix Lua config with
  `nvim --clean` in case they breaks it
- Nvim doesn't port Lua foldexpr from Vim

Solution:
- Set 'omnifunc' to 'v:lua.vim.lua_omnifunc' in ftplugin/lua.lua
- Set 'foldexpr' to use treesitter
2025-03-15 09:44:53 -07:00
afdad5c76e refactor(test): deprecate n.feed_command() #32915
Problem:
`feed_command()` was added as a "bridge" for old test code. 99% of those
cases should be using `n.command()`, which raises errors instead of
silently continuing the test.

Solution:
Deprecate `feed_command()`. It should not be used in new tests.
All usages of `feed_command()` should be converted to `command()` or
`feed()`.
2025-03-15 08:45:39 -07:00
19fc65acbc fix(statuscolumn): misleading v:lnum for virtual lines #32912
Problem:  Virtual 'statuscolumn' lines are evaluated with a misleading v:(rel)num.
          Namely set to the line above for `virt_lines_above = true` lines, or even
          the last drawn line for a partial redraw.
Solution: Set `v:lnum` for the first evaluated row of a line, first above
          virtual line of a row and first non-virtual line of a row.
2025-03-15 08:18:23 -07:00
f8d5811c71 fix(lsp): correctly check for "codeAction/resolve" support 2025-03-15 15:56:47 +01:00
026cfa28d0 docs: misc
Co-authored-by: Au. <acehinnnqru@gmail.com>
Co-authored-by: Daniel Rainer <daniel.rainer@localhost>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Co-authored-by: Pierre Barbin <pierre@heitzsystem.com>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-03-15 15:00:44 +01:00
a41b6fd173 fix(lsp): autocmds to close lsp preview windows not cleared
Problem: Augroup to close lsp preview hover window is not cleared after
the window is closed because of unmatched group name.

Solution: Delete the augroup before closing the preview window with
correct group name.
2025-03-15 14:59:06 +01:00
4662ad5643 feat(defaults): completeopt=popup #32909
Assuming that completeopt=popup does what its documentation claims, it
is more appropriate that completeopt=preview as a default.
2025-03-15 13:07:21 +00:00
d8eec81560 fix(treesitter): update lua, markdown queries 2025-03-15 12:10:22 +01:00
94de236815 build(deps): bump tree-sitter-c to v0.23.4 2025-03-15 12:10:22 +01:00
a70ad5cdb6 fix(cmdline): ext_cmdline block events for conditionals
Problem:  No block events emitted with ext_cmdline for :if, :while, :try etc.
Solution: Emit cmdline block events; store the indent level of the
          previous cmdline and whether a block event was emitted.
2025-03-15 12:09:22 +01:00
98c1355e2f test(old): fix test_tabline failure (#32907)
Also fix tests after test_sha256 in test_alot.vim being skipped.
2025-03-15 10:53:33 +00:00
85d125cac4 vim-patch:9.1.1206: tests: test_filetype fails when a file is a directory (#32905)
Problem:  tests: test_filetype fails when a file is a directory
          (Eisuke Kawashima)
Solution: When encountering a directory instead of a file, skip that
          particular filetype test

fixes: vim/vim#16894

63a885b650

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-15 10:00:40 +00:00
551e26963b vim-patch:9.1.1205: completion: preinserted text not removed when closing pum (#32903)
Problem:  completion: preinserted text not removed when closing pum
Solution: delete preinsert text inside in ins_compl_stop() (glepnir).

closes: vim/vim#16891

84a7503e29
2025-03-15 09:40:25 +00:00
ec8fc28743 vim-patch:9.1.1204: MS-Windows: crash when passing long string to expand() (#32902)
Problem:  MS-Windows: crash when passing long string to expand() with
          'wildignorecase'.
Solution: Use the same buflen as unix_expandpath() in dos_expandpath().
          Remove an unnecessary STRLEN() while at it (zeertzjq).

closes: vim/vim#16896

00a749bd90
2025-03-15 09:34:56 +00:00
9ef80352b6 vim-patch:96395e1: runtime(cs): Update C# runtime files
closes: vim/vim#16884

96395e1512

Co-authored-by: Nick Jensen <nickspoon@gmail.com>
2025-03-15 10:26:56 +01:00
1b1af8aae8 vim-patch:9.1.1203: matchparen keeps cursor on case label in sh filetype (#32900)
Problem:  matchparen keeps cursor on case label in sh filetype
          (@categorical, after 9.1.1187).
Solution: Use :defer so that cursor is always restored, remove checks
          for older Vims, finish early if Vim does not support :defer

fixes: vim/vim#16887
closes: vim/vim#16888

47071c6076
2025-03-15 17:18:08 +08:00
25ba8392f2 vim-patch:2329bd4: runtime(doc): fix a typo in gitrebase filetype (#32899)
Introduced in 4d2c4b90f.

closes: vim/vim#16892

2329bd427a

Co-authored-by: skshetry <18718008+skshetry@users.noreply.github.com>
2025-03-15 17:17:56 +08:00
e7627db35f Merge pull request #32895 from zeertzjq/vim-8.2.4963
vim-patch: buffer overflow when expanding long file name
2025-03-15 08:38:07 +08:00
b0b61c42b3 vim-patch:9.0.1458: buffer overflow when expanding long file name
Problem:    Buffer overflow when expanding long file name.
Solution:   Use a larger buffer and avoid overflowing it. (Yee Cheng Chin,
            closes vim/vim#12201)

a77670726e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-15 08:19:34 +08:00
ad5bced637 vim-patch:8.2.4963: expanding path with "/**" may overrun end of buffer
Problem:    Expanding path with "/**" may overrun end of buffer.
Solution:   Use vim_snprintf().

386c24cd26

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-03-15 08:15:58 +08:00
f1422a313f vim-patch:f22580e: runtime(doc): update a few minor omissions from 5876016 and 4d2c4b9 (#32888)
f22580e57c

Skip options.txt: included in #30189

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-14 12:17:17 +00:00
a25ce5762d test: do not dedent() in feed() (#32884)
Most callers of feed() do not expect feed() to dedent.
Now use a literal space in tests where it looks better.
2025-03-14 09:12:35 +00:00
4a5585da7e test: flaky loop_spec.lua #32885
Problem:
Test may fail because it matches a Lua table address, and the following
whitespace may differ depending on the stringified address length:

    test/functional/lua/loop_spec.lua:233: Row 3 did not match.
    Expected:
      |{3:                                                  }|
      |{9:Error executing callback:}                         |
      |*{9:uv_idle_t: 0x{MATCH:%w+}}                         |
      |{6:Press ENTER or type command to continue}^           |
    Actual:
      |{3:                                                  }|
      |{9:Error executing callback:}                         |
      |*{9:uv_idle_t: 0xd4c2820a00}                           |
      |{6:Press ENTER or type command to continue}^           |

Solution:
Match a variable amount of whitespace.
2025-03-14 09:09:16 +00:00
123f8d229e feat(snippet): set snippet keymaps permanent instead of dynamic (#31887)
Problem:

Given that `vim.snippet.expand()` sets temporary `<tab>`/`<s-tab>`
keymaps there is no way to build "smart-tab" functionality where `<tab>`
chooses the next completion candidate if the popup menu is visible.

Solution:

Set the keymap permanent in `_defaults`.

The downside of this approach is that users of multiple snippet engine's
need to adapt their keymaps to handle all their engines that are in use.
For example:

    vim.keymap.set({ 'i', 's' }, "<Tab>", function()
      if foreign_snippet.active() then
        return "<Cmd>lua require('foreign_snippet').jump()<CR>"
      elseif vim.snippet.active({ direction = 1 }) then
        return "<Cmd>lua vim.snippet.jump(1)<CR>"
      else
        return key
      end
    end, { expr = true })

Upside is that using `vim.keymap.set` to override keymaps is a well
established pattern and `vim.snippet.expand` calls made by nvim itself
or plugins have working keymaps out of the box.


Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2025-03-14 09:51:52 +01:00
6401b433f7 fix(vim.fs): default to follow=false #32859
Problem:
Following symlinks can have surprising behavior and slow performance.

Solution:
Do not set it by default.
2025-03-14 01:36:39 -07:00
2db1ae37f1 refactor(gen_keycodes): put TAB and K_TAB together (#32882)
Keep track of the original indexes of both TAB and K_TAB, so that there
doesn't have to be an extra table and loop for K_TAB.
2025-03-14 03:36:24 +00:00
6d40fd1dbc vim-patch:4d2c4b9: runtime(doc): document gitrebase filetype (#32881)
closes: vim/vim#16883

4d2c4b90fb

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-14 08:27:02 +08:00
4f6196e91d vim-patch:9.1.1200: cmdline pum not cleared for input() completion (#32879)
Problem:  Cmdline pum not cleared for input() completion.
Solution: Temporary reset RedrawingDisabled in cmdline_pum_cleanup(),
          like what is done in wildmenu_cleanup() (zeertzjq).

fixes: vim/vim#16874
closes: vim/vim#16876

1830e787f6

No code change is needed in Nvim, as RedrawingDisabled does not prevent
the compositor from removing a grid.
2025-03-13 23:15:53 +00:00
282f73f067 fix(messages): no trailing newline for inputlist, tselect, z= with ext_messages
Problem:  Various list commands end in a newline to go to a new line on
          the message grid for the prompt message, which is unwanted
          with ext_messages.
Solution: Don't emit a trailing newline with ext_messages for
          inputlist(), :tselect and z=.

Co-authored-by: Tomasz N <przepompownia@users.noreply.github.com>
2025-03-13 11:33:35 +01:00
6e588519c8 vim-patch:9.1.1196: filetype: config files for container tools are not recognized (#32873)
Problem:  filetype: config files for container tools are not recognized
Solution: detect the ones that aren't detected yet as toml filetype
          (David Mandelberg)

The .containerignore format doesn't look exactly the same as gitignore,
but very close. And .dockerignore is already using gitignore.

References:
https://github.com/containers/common/blob/main/docs/containerignore.5.md
https://github.com/containers/common/blob/main/docs/containers.conf.5.md
https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md
https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md
https://github.com/containers/image/blob/main/docs/containers-registries.conf.d.5.md

I wasn't sure exactly how to interpret what containers.conf(5) was
saying about modules, so I looked at
https://github.com/containers/common/tree/main/pkg/config/testdata/modules
to get examples, and based the detection off those.

closes: vim/vim#16852

7546afbf52

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-03-13 17:38:30 +08:00
543e40624e ci(deps): bump lua-language-server to 3.13.9 2025-03-13 09:23:55 +01:00
d832518ec6 fix(lua): vim.hl.on_yank highlights wrong region with yi' (#32850)
Problem: yi' don't highlight last character since
8ce504820a.

Solution: Always use `opts.inclusive=true`, since calculation of `"]`
(`b_op_end`) have taken `inclusive` into account.
2025-03-13 09:11:08 +08:00
b25527d20d vim-patch:9.1.1198: [security]: potential data loss with zip.vim (#32867)
Problem:  [security]: potential data loss with zip.vim and special
          crafted zip files (RyotaK)
Solution: use glob '[-]' to protect filenames starting with '-'

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-693p-m996-3rmf

f209dcd3de

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-13 08:47:02 +08:00
90d1260cb8 vim-patch:9.1.1195: inside try-block: fn body executed with default arg undefined (#32866)
Problem:  inside try-block: fn body executed when default arg is
          undefined
Solution: When inside a try-block do not execute function body after an
          error in evaluating a default argument expression
          (Shane Harper).

closes: vim/vim#16865

2d18789aa6

Co-authored-by: Shane Harper <shane@shaneharper.net>
2025-03-13 08:46:47 +08:00
dbd76c2c41 test: reduce flakiness in blocking wait tests (#32868) 2025-03-13 00:42:02 +00:00
785e620700 vim-patch:c1c3b5d: runtime(doc): remove unnecessary "an" (#32865)
"umask" is pronounce like "youmask", so having an "an" before it is a
bit strange.  In other places in the help, "umask" is not preceded by
either "a" or "an", and sometimes preceded by "the".

Also, "Note" is usually followed either by ":" or "that" in builtin.txt,
so add a ":" after "Note".

closes: 16860

c1c3b5d6a0
2025-03-13 07:15:19 +08:00
c78728a384 fix(diagnostic): clear autocmd only for valid buf (#32861) 2025-03-12 09:30:05 -05:00
0418107074 fix: update osc52 termfeatures flag on UIEnter/UILeave (#32756)
Problem:

Nvim tries to use OSC 52 even when no TUIs are attached.

Solution:

On each UIEnter/UILeave event, check that there is a TUI client connected to Nvim's stdout.
2025-03-12 08:11:19 -05:00
69a19295f8 fix(terminal): delay when finishing terminal process #32846
Problem:
On Windows, the first attempt at finishing up after a terminal process
terminates is delayed by 200ms, even if it would be possible to finish
up immediately.

Solution:
Make the first attempt at finishing up immediately after the process
terminates.
2025-03-12 05:35:14 -07:00
3bc72a4980 refactor(popup): use plines_m_win #32857
Problem: Custom inline function duplicated existing functionality

Solution: Used existing plines_m_win function to reduce code duplication
2025-03-12 05:29:03 -07:00
eea0aff4e5 ci(deps): bump lua-language-server to 3.13.8 2025-03-12 12:04:56 +01:00
ed07167261 fix(lsp): handle non-existent configs in lsp.config/enable 2025-03-12 09:06:28 +00:00