Commit Graph

36639 Commits

Author SHA1 Message Date
zeertzjq
a952575c3b vim-patch:9.2.0506: home_replace() function can be improved (#39925)
Problem:  home_replace() function can be improved
Solution: Refactor home_replace() to return the length of the string
          (John Marriott).

In addition:
- in function set_b0_fname() move ulen into the block where it is used.
- In function findswapname() rework logic around displaying "swap file
  already exists" dialogue so that literal message text is set once.

closes: vim/vim#20249

a0931a90ee

Co-authored-by: John Marriott <basilisk@internode.on.net>
2026-05-21 09:35:27 +08:00
zeertzjq
74cc0364f1 vim-patch:85eb099: runtime(mbsync): Properly handle values for the "Sync" keyword
This has been manually tested with my personal mbsync configuration and
with the following test file:

    $ cat test.mbsyncrc
    Channel Foo
    # None may not be combined with other operations
    Sync None
    Sync None New
    # First form
    Sync Pull
    Sync Push
    Sync New
    Sync Old
    Sync Upgrade
    Sync ReNew
    Sync Gone
    Sync Delete
    Sync Flags
    Sync Invalid
    # Second form
    Sync PullNew
    Sync PullOld
    Sync PullUpgrade
    Sync PullReNew
    Sync PullGone
    Sync PullDelete
    Sync PullFlags
    Sync PullFull
    Sync PullAll
    Sync PullInvalid
    Sync PushNew
    Sync PushOld
    Sync PushUpgrade
    Sync PushReNew
    Sync PushGone
    Sync PushDelete
    Sync PushFlags
    Sync PushFull
    Sync PushAll
    Sync PushInvalid
    Sync NewInvalid
    # Multiple operations
    Sync New Upgrade Gone Flags
    # Mix of the two styles (an example from the mbsync manpage)
    Sync PullNew PullGone Push
    # Syntaxically correct, though they will raise a warning in mbsync:
    Sync PullNew Pull
    Sync PullNew Gone Push

closes: vim/vim#20243

85eb099bf2

Co-authored-by: Cyril Roelandt <tipecaml@gmail.com>
2026-05-21 08:07:01 +08:00
zeertzjq
040c5deb3f vim-patch:1294861: runtime(getscript,vimball,rust): Use correct shellescape() form for ! ex cmd
Problem:  shellescape() called without {special} flag for :! ex command
Solution: Pass 1 as second argument to shellescape() in :! contexts

related: Commit: 3fb5e58fbc63d86a3e65f1a141b0d67af2 (patch 9.2.0479:
         [security]: runtime(tar): command injection in tar plugin)

129486193c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-21 08:07:01 +08:00
Maria Solano
3883cba996 fix(lsp): flush change notifications on save (#39894) 2026-05-20 16:33:10 -07:00
Justin M. Keyes
9aa4608401 refactor: introduce nvim_on internally #39883
Problem:
`nvim_create_autocmd` is too verbose and its `callback` requires extra
"nesting".

Solution:
Introduce `nvim_on`. Start using it internally. Then we can get a feel
for how it should look before making it public.
2026-05-20 17:33:01 -04:00
Justin M. Keyes
799cbfff85 fix(vim.secure): read() command injection vulnerability #39918
Problem:
Malicious filename can execute code because of ":" cmdline expansion.

Solution:
Use `fnameescape()`.

fix https://github.com/neovim/neovim/issues/39914
2026-05-20 15:27:43 -04:00
Justin M. Keyes
24e00f2844 fix(net): :edit <uri> should set buftype=nofile #39915 2026-05-20 12:36:28 -04:00
Justin M. Keyes
9f0ecad6d9 fix(api): fail fast if has_lua_imp retval looks wrong #39866 2026-05-20 11:52:22 -04:00
Natanael Copa
584dfdb76d fix(test): support multiple --filter-out #39885
fixes regression introduced in commit 55f9c2136e (test: replace busted
with local harness)
2026-05-20 09:03:45 -04:00
Justin M. Keyes
d7cbaf2971 Merge #39876 checkhealth improvements 2026-05-20 08:56:37 -04:00
luukvbaal
53da0c5060 fix(messages): avoid recursive rtp build due to msg_show #39888
Problem:  If there are pending messages when starting to build the
          runtime search path, a msg_show callback may invoke
          runtime_search_path_validate() recursively.
Solution: Avoid msg_show callback by ensuring messages are flushed.
2026-05-20 08:13:41 -04:00
Justin M. Keyes
e446779726 fix(health): "Create bug report" button 2026-05-20 14:09:20 +02:00
Justin M. Keyes
74ea3875b4 fix(health): show Nvim-owned checks at the top 2026-05-20 14:09:20 +02:00
Justin M. Keyes
6674329d15 feat(health): highlight current buffer
Problem:
A benefit of the old `:LspInfo` was that it showed info related to the
"current buffer" a bit more clearly.

Solution:
Highlight the "current buffer" in the LSP checkhealth report.
2026-05-20 14:09:20 +02:00
Justin M. Keyes
7812087341 fix(health): cleanup LSP healthcheck
Problem:
filewatcher and position-encoding info is reported after the big list of
client details.

Solution:
- report the info in the top-level, not in dedicated subsections.
2026-05-20 14:09:20 +02:00
Justin M. Keyes
735a7d0c9e feat(fswatch): report filewatchers in :checkhealth 2026-05-20 14:09:20 +02:00
Matei Stroia
526ae1cc1b fix(fold): virtual lines duplicate foldopen (#39891)
Problem:
Virtual lines above a line where a fold starts show `foldopen` in
`foldcolumn`.

Solution:
Check if the line below the virtual one is inside a fold that starts
higher up or if it's the start of a fold. In the latter case, don't show
anything in `foldcolumn` for the virtual line.

refactor: lint
2026-05-20 19:56:39 +08:00
bfredl
2e82e0bcf6 Merge pull request #39887 from bfredl/o_dod_suss
fix(warnings): annotate or ignore all uses of printf formatting
2026-05-20 12:55:30 +02:00
Olivia Kinnear
f0c3cc2398 fix(pack): collect "Removed plugin" into one message #39840 2026-05-20 06:45:05 -04:00
Justin M. Keyes
1f75fef951 Merge #39889 from ofseed/pos-util
refactor(pos,range): drop `to_cursor`, extract `vim.pos._util`
2026-05-20 05:35:09 -04:00
Justin M. Keyes
f1fad32e2e docs: misc, custom text-object #39877
text-object-define is a pattern I found in tpope's plugins (e.g.
https://github.com/tpope/vim-jdaddy) which shows an elegant way to
define a text-object. (Any mistakes in the example are my fault.)
2026-05-20 05:21:27 -04:00
Yi Ming
cd3b544611 refactor(pos,range): add missing validators and improve the docs
Problem:
Our documentation is incomplete or inconsistent in several ways:
- Some public APIs lack corresponding validators.
- Some public APIs lack usage examples.
- The meaning of some return values or parameters is not clearly explained.

Solution:
Add the missing validators, examples, and clarifications.
2026-05-20 16:23:03 +08:00
Yi Ming
b1c1f32089 refactor(pos,range): extract vim.pos._util
Problem:
- To share logic, creating a `vim.Range` currently creates two `vim.Pos` values
  as intermediates, which causes unnecessary table allocations.
- `pos.lua` and `range.lua` contain some overlapping logic.

Solution:
Add `vim.pos._util`, a module for handling
positions represented directly by `row` and `col`.
2026-05-20 16:23:03 +08:00
Yi Ming
8d1233a144 feat(pos,range)!: remove range.cursor() and range:to_cursor(),
Problem:
- A window can only have one cursor, ranges selected by the cursor are typically
  obtained by marks like ">" and "<", instead of calling get_cursor() twice.
- `vim.Range` is described as end-exclusive,
  but the current `range.cursor()`/`range:to_cursor()` are end-inclusive.
- Conversion between `vim.Range` and mark-indexed range can be done by
  `range.mark()`/`range:to_mark()`

Solution:
Remove `range.cursor()` and `range:to_cursor()`,
2026-05-20 16:23:01 +08:00
Barrett Ruth
5181984db9 fix(api): nvim_exec_autocmds({buf=x}) runs in buffer context #39061
Problem: `nvim_exec_autocmds({ buf = ... })` matches the target buffer, but callbacks and modelines run with the caller buffer current rather than the target buffer.

Solution: Execute the buffered path in prepared target-buffer context and restore the caller afterward.
2026-05-20 03:48:55 -04:00
Olivia Kinnear
ea8f1463dd fix(lua): fields of nvim.spellfile.Opts are optional #39902 2026-05-20 02:47:35 -04:00
dependabot[bot]
a59c8a9c76 ci: bump the github-actions group across 1 directory with 2 updates
Bumps the github-actions group with 2 updates in the / directory: [actions/create-github-app-token](https://github.com/actions/create-github-app-token) and [korthout/backport-action](https://github.com/korthout/backport-action).


Updates `actions/create-github-app-token` from 3.1.1 to 3.2.0
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/create-github-app-token/compare/v3.1.1...v3.2.0)

Updates `korthout/backport-action` from 4.5.1 to 4.5.2
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](bf97bcfb53...6606540695)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: korthout/backport-action
  dependency-version: 4.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-20 07:51:39 +02:00
zeertzjq
3bc21c0903 vim-patch:9.2.0502: runtime(netrw): bookmark handling can be improved (#39900)
Problem:  To goto or delete a bookmark, one needs to prefix a count
          for the bookmark number (e.g., "2gb" to open bookmark#2).
          As the bookmark list gets or deletes entries, the numbers
          keep changing, requiring listing the bookmarks with qb to
          discover the desired bookmark number. Typing gb or mB
          without a count targets g:netrw_bookmarklist[-1].
Solution: If no count is given to gb or mB, list all bookmarks and
          prompt for a number using inputlist(), similar to tag jump
          with g].

closes: vim/vim#20211

35b767a090

Co-authored-by: J. Paulo Seibt <jpseibt@gmail.com>
2026-05-20 01:12:12 +00:00
zeertzjq
62dcd07787 vim-patch:d004cc4: runtime(htmldjango): Remove unnecessary code. (#39899)
I submitted the PR vim/vim#20232 to resolve an undesired behavior in with the
highlighter inheriting from "django.vim" and "html.vim". After
further testing I noticed the re-declaration of `djangoOperators` in
"htmldjango" is not necessary, and my conclusions where a mistake from a
not-clean test environment.

This PR reverses the effect of the commit #f03155a.

related: vim/vim#20232
closes:  vim/vim#20248

d004cc4f89

Co-authored-by: tecis <67809811+tecis@users.noreply.github.com>
2026-05-20 00:30:00 +00:00
bfredl
3d391cf84d fix(warnings): annotate or ignore all uses of printf formatting
This fixes all clang 22 warnings of the form: "warning: diagnostic behavior
may be improved by adding the 'format(printf, 3, 4)' attribute to the
declaration of 'some_function'"

dialog_msg() was essentially a NULL-handling wrapper. but some callsites
already use their own NULL handling or NULL:s are impossible as the
value has already been assumed non-NULL. Non-locally assuming
a buffer size is also a code smell, especially if we can
just use "sizeof buff" without a wrapper.

append_redir() is... whatever it is.
2026-05-19 19:42:58 +02:00
bfredl
c7ea9c075a Merge pull request #39429 from ollien/mouse-n-visual
fix(mouse): mouse=n should not adjust visual selection
2026-05-19 12:36:26 +02:00
Nick Krichevsky
24f7182390 fix(mouse): mouse=n should not adjust visual selection
Problem:

When mouse=n is set
  - Dragging the mouse enters visual mode, and then stops listening for
    mouse events.
  - Double/Triple/Quad clicking performs selections.
  - Clicking in visual mode moves the cursor (though not through the TUI).

Solution:

Explicitly gate mouse actions that affect visual mode with a check for
MOUSE_VISUAL. This matches the behavior described in :help mouse.

> If enabled for "v" (Visual mode) then double-click selects word-wise,
> triple-click makes it line-wise, and quadruple-click makes it
> rectangular block-wise.
2026-05-19 11:45:56 +02:00
Justin M. Keyes
16d17c50bb refactor: simplify aucmd_restbuf usage #39879
Problem:
`aucmd_restbuf` must be guarded in case `aucmd_prepbuf` wasn't called.

Solution:
Update `aucmd_restbuf` to be a no-op if `aucmd_prepbuf` wasn't called.
This requires `aco` to be zero-initialized.
2026-05-19 05:09:23 -04:00
Barrett Ruth
353d2a4e4a feat(normal): lines textobject "il", "al" #39845
`al` to select the whole buffer linewise.
`il` to select the current line without surrounding whitespace.
2026-05-19 05:08:23 -04:00
zeertzjq
f3bb21e71d vim-patch:9.2.0500: filetype: some html files wrongly recognized as htmlangular (#39880)
Problem:  filetype: some html files are wrongly recognized as htmlangular
Solution: Use the \< atom to anchor ng-template and ng-content to start
          of word (truffle)

Prevent false-positive htmlangular detection on words containing
'ng-template' or 'ng-content' as a substring (e.g. 'song-template',
'sing-content'). Anchor both branches with \< to require a word start,
matching the \<DTD\s\+XHTML\s idiom used five lines below.

related: neovim/neovim#39778.
closes:  vim/vim#20246

354ab1a69e

Co-authored-by: truffle <truffleagent@gmail.com>
2026-05-19 08:42:05 +08:00
glepnir
450ba41436 fix(api): adjust Visual position after nvim_buf_set_text #30690
Problem:
Visual selection could end up in the wrong place after
nvim_buf_set_text or nvim_buf_set_lines. In some delete cases,
Visual.lnum was already clamped before the line shift happened, so the
adjustment got skipped.

Solution:
Split fix_cursor_cols into reusable fix_pos_col logic and reuse it
for Visual updates. Also adjust Visual.lnum before changed_lines so
the shift uses the original position before final clamping.
2026-05-18 13:08:26 -04:00
Manoj Panda
4791444953 refactor: remove unused MAP_DECLS specializations #39865
Problem:
Various "unused function" warnings when building `map_defs.h`.
https://github.com/neovim/neovim/issues/26452

Solution:
Removed unused `MAP_DECLS(T, U)` specializations, their generated symbols, and
2 obsolete constants.
2026-05-18 11:25:03 -04:00
Justin M. Keyes
d8ec793379 Merge #39822 from ofseed/pos-mark
feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
2026-05-18 10:45:21 -04:00
Yi Ming
ff43f1950e feat(lsp)!: deprecate vim.lsp.util.character_offset() 2026-05-18 22:19:07 +08:00
Yi Ming
856bc6d284 fix(range): handle inclusive/exclusive positions on multibyte characters 2026-05-18 22:19:07 +08:00
Yi Ming
f2b031136f feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
Problem:
Ranges represented by marks are usually end-inclusive,
but the range utilities we provided are end-exclusive.

Solution:
Add pos:to_mark(), pos.mark(), range:to_mark(), and range.mark().
2026-05-18 22:19:00 +08:00
Justin M. Keyes
b20fa21ac5 Merge #39832 from justinmk/doc2
docs: misc, remove legacy/textobjects_spec.lua
2026-05-18 09:25:05 -04:00
bfredl
e932d6ff17 fix(api): regressions with lua return values #39837
fixes #39834
fixes #39833
fixes #39851
2026-05-18 09:05:49 -04:00
zeertzjq
7b46848f14 vim-patch:9.2.0494: User commands cannot handle single args with spaces (#39854)
Problem:  User commands cannot handle single args with spaces
Solution: Add the -nargs=_ attribute (Maxim Kim)

-nargs=_ allow user commands to have a single argument with spaces.

For example given the following Test command and TestComplete function:

```
vim9script
def TestComplete(A: string, _: string, _: number): list<string>
    var all = ["qqqq", "aaaa", "qq aa"]
    return all->matchfuzzy(A)
enddef
command! -nargs=_ -complete=customlist,TestComplete Test echo <q-args>
```

`:Test q a<tab>` should successfully complete `qq aa`

fixes:  vim/vim#20102
closes: vim/vim#20189

f0e874a129

Co-authored-by: Maxim Kim <habamax@gmail.com>
2026-05-18 17:44:26 +08:00
glepnir
3ffe29d679 fix(lsp): preserve trigger chars on completion #39850
Problem:
After 767fbd8, typing trigger chars would open completion but the
chars were removed.

Solution:
Use filterText fallback so selected item respects typed trigger chars.
2026-05-18 05:25:41 -04:00
Justin M. Keyes
920fcaeeb7 test: remove legacy/textobjects_spec.lua
It is redundant with `test/old/testdir/test_textobjects.vim`.
2026-05-18 11:20:26 +02:00
Justin M. Keyes
82cc02d19f docs: misc, $NVIM_TERMDEFS 2026-05-18 11:20:18 +02:00
zeertzjq
d7164eced6 Merge pull request #39842 from zeertzjq/vim-23c77d8
vim-patch: runtime file updates
2026-05-18 08:32:26 +08:00
zeertzjq
878718fa76 vim-patch:9.2.0496: [security]: Code Injection in cucumber filetype plugin
Problem:  [security]: Code Injection in cucumber filetype plugin
          (Christopher Lusk)
Solution: Use rubys Regexp.new() with the untrusted pattern

Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-4473-94jm-w5x9

a65a52d684

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-18 08:11:18 +08:00
zeertzjq
a7d3835cb9 vim-patch:9.2.0495: [security]: runtime(netrw): code injection via NetrwBookHistSave()
Problem:  [security]: runtime(netrw): code injection via
          NetrwBookHistSave()
Solution: Properly quote the directory name using string() function
          (Srinivas Piskala Ganesh Babu)

Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-crm5-rh6j-2c7c

f08ab2f4d7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-18 08:11:18 +08:00