Commit Graph

32640 Commits

Author SHA1 Message Date
1e2f86394a vim-patch:adb703e: runtime(vim): Update base-syntax, match protected constructors
Support for protected constructors was added in commit 7e89800.

closes: 16618

adb703e1b9

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:46:06 +08:00
700840f4b7 vim-patch:dd3f1c0: runtime(vim): Update base-syntax, match multiline return types
fixes vim/vim#14442.
closes: vim/vim#16914

dd3f1c0dda

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:45:36 +08:00
e2fa151f9c vim-patch:0fab891: runtime(vim): Update base-syntax, improve :syntax highlighting
- Highlight missing :syntax subcommands.
- Don't highlight user specified syntax group names.

closes: vim/vim#16847

0fab89117f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:41:39 +08:00
8e5ef60540 vim-patch:3dca512: runtime(vim): Update base-syntax and generator, only match valid predefined variables
- Only match valid predefined and option variables.
- Match scope dictionaries.
- Highlight scope prefixed variables as a scope dictionary accessor. The
  vimVarScope syntax group can be linked to vimVar to disable this.
- Include support for Neovim-only predefined and option variables.

Temporary collateral damage - scope dictionaries match instead of keys
in dictionary literals.

closes: vim/vim#16727

3dca512939

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:31:34 +08:00
ash
118759aa6b vim-patch:8f09684: runtime(jjdescription): Don't require a space to start comments (#33523)
Since jj v0.24.0 (December 2024), `JJ:` comments are recognised even
when not followed by a space.

closes: vim/vim#17130

8f09684569
2025-04-18 01:05:10 +00:00
fe7cd80cbc Merge pull request #33521 from zeertzjq/vim-9.0.1653
vim-patch:9.0.{1653,1654},9.1.{0721,1317}
2025-04-18 08:30:21 +08:00
e2e6c159d3 vim-patch:9.1.1317: noisy error when restoring folds from session fails
Problem:  noisy error when restoring folds from session fails
Solution: ignore errors silently when sourcing session file.
          (Igor Lacerda)

fixes: vim/vim#15813
closes: vim/vim#17127

cca5dea76e

Co-authored-by: Igor Lacerda <igorlfs@ufmg.br>
2025-04-18 08:11:41 +08:00
0eb708aa8a vim-patch:9.1.0721: tests: test_mksession does not consider XDG_CONFIG_HOME
Problem:  tests: test_mksession does not consider XDG_CONFIG_HOME
Solution: allow to match $HOME/.vim/ and $HOME/.config/vim for &viewdir
          (John M Devin)

closes: vim/vim#15639

5b9237c2e7

Co-authored-by: John M Devin <john.m.devin@gmail.com>
2025-04-18 08:11:41 +08:00
bd0555ecd4 vim-patch:9.0.1654: MS-Windows: test for default 'viewdir' fails
Problem:    MS-Windows: test for default 'viewdir' fails.
Solution:   Escape the pattern.

813b7a85f2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-04-18 08:11:41 +08:00
827cfe4a76 vim-patch:9.0.1653: Amiga: default 'viewdir' may not work
Problem:    Amiga: default 'viewdir' may not work.
Solution:   Use "home:" instead of "$VIM". Add a test. (Christian Brabandt,
            closes vim/vim#12576)

b8b1c8ebd4

Cherry-pick Test_mkview_manual_fold() changes from 9.0.{0363,0626}.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-18 08:11:35 +08:00
b4c759716a vim-patch:9.1.1315: completion: issue with fuzzy completion and 'completefuzzycollect' (#33520)
Problem:  chain complete does not work when 'cot' includes fuzzy
          and 'completefuzzycollect' collects wrong next word.
          (Konfekt)
Solution: compl_startpos is not set correctly, remove next word check
          in search_for_fuzzy_match (glepnir).

fixes vim/vim#17131
fixes vim/vim#16942
closes: vim/vim#17136

cfe502c575

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-18 07:22:50 +08:00
Au.
6926fc1615 fix(lsp): opts.reuse_win does not jump if buf is already open #33476
Problem:
`vim.lsp.buf.[implementation|definition|...]({ reuse_win = true })` does not
jump cursor to existing window if buffer is already open.

Steps to reproduce:
1. `nvim repro.lua`
2. Insert anything that lsp can read to open the library definition/implementation, e.g., `vim.keymap.set`
3. open `repro.lua` buffer and the library buffer side by side.
4. type `gd` over `set` to jump to the library definition.

The open buffer is scrolled to the target line, but cursor does not jump.

Solution:
Call nvim_set_current_win if necessary.
2025-04-17 07:46:18 -07:00
2fcdeb0128 refactor(lsp): gen_lsp
- Simplify usage:
  - Instead of `nvim -l src/gen/gen_lsp.lua gen` now just
    run `./src/gen/gen_lsp.lua`

- Removed `--methods` and `--capabilities` options.

- Improved rendering code in various areas.
2025-04-17 15:44:46 +01:00
d7e0d46ffa feat(lsp): use stricter types for methods
This change modifies gen_lsp.lua so alias types are generated for
various types of lsp methods to distinguish between notifications
and requests:
 - vim.lsp.protocol.Method.ServerToClient.Request
 - vim.lsp.protocol.Method.ServerToClient.Notification
 - vim.lsp.protocol.Method.ClientToServer.Request
 - vim.lsp.protocol.Method.ClientToServer.Notification

 These types are then used instead of `string` where appropriate.
2025-04-17 11:40:45 +01:00
34b4df774d vim-patch:fbbaa6e: runtime: set 'cpoptions' for line-continuation in various runtime files
closes: vim/vim#17121

fbbaa6ebe9

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-17 09:25:41 +02:00
5aa35691ab vim-patch:40daa13: runtime(gleam): Update ftplugin, use recommended_style config variable
Wrap the setting of basic whitespace formatting options in a conditional
block, following the de facto standard.

Setting 'et', 'sts' and 'sw' can be disabled by setting
"gleam_recommended_style" to false.

Follow up to PR vim/vim#17086.

closes: vim/vim#17128

40daa1358c

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-17 09:25:41 +02:00
95a255a548 vim-patch:9.1.1312: tests: Test_backupskip() fails when HOME is defined (#33504)
Problem:  tests: Test_backupskip() fails when HOME is defined
Solution: unset $HOME temporarily

ad503fe927

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-17 07:44:42 +08:00
f9f6dc4262 vim-patch:9.1.1310: completion: redundant check for preinsert effect (#33505)
Problem:  Duplicate check for preinsert effect, particularly for Ctrl_w
          and Ctrl_U.
Solution: Remove the specific check for Ctrl_w and Ctrl_U to eliminate
          redundancy (glepnir).

closes: vim/vim#17129

1c2b258250

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-16 23:44:12 +00:00
e3e8dfe99c vim-patch:9.1.1307: make syntax does not reliably detect different flavors (#33498)
Problem:  GNU extensions, such as `ifeq` and `wildcard` function, are
          highlighted in BSDmakefile
Solution: detect BSD, GNU, or Microsoft implementation according to
	  filename, user-defined global variables, or file contents

closes: vim/vim#17089

f35bd76b31

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Co-authored-by: Roland Hieber <rohieb@users.noreply.github.com>
2025-04-17 07:13:05 +08:00
95e29dab70 Merge pull request #33383 from zeertzjq/vim-9.1.1284
vim-patch:9.1.{1262,1284,1296,1306,1309}
2025-04-17 07:05:19 +08:00
afca5b564e vim-patch:9.1.1309: tests: no test for 'pummaxwidth' with non-truncated "kind"
Problem:  tests: no test for 'pummaxwidth' with non-truncated "kind".
Solution: Add a test with "kind" and larger 'pummaxwidth' (zeertzjq).

closes: vim/vim#17126

031919c7ac
2025-04-17 06:46:34 +08:00
54d6055098 vim-patch:9.1.1306: completion menu rendering can be improved
Problem:  Parts of the popup menu were rendered twice when the popup was
          at maximum width because the truncation flag was being set too
          liberally.
Solution: Make the truncation condition more precise by only setting it
          when there's exactly one character of space remaining
          (glepnir).

closes: vim/vim#17108

32f2bb6e1e

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-17 06:46:34 +08:00
6e5671b00d vim-patch:9.1.1296: completion: incorrect truncation logic
Problem:  completion: incorrect truncation logic (after: v9.1.1284)
Solution: replace string allocation with direct screen rendering and
          fixe RTL/LTR truncation calculations (glepnir)

closes: vim/vim#17081

d4dbf822dc

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-17 06:46:34 +08:00
1c723b2e6f vim-patch:9.1.1284: not possible to configure pum truncation char
Problem:  not possible to configure the completion menu truncation
          character
Solution: add the "trunc" suboption to the 'fillchars' setting to
          configure the truncation indicator (glepnir).

closes: vim/vim#17006

b87620466c

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-17 06:46:34 +08:00
b64c2d763e vim-patch:9.1.1262: heap-buffer-overflow with narrow 'pummaxwidth' value
Problem:  heap-buffer-overflow occurs with narrow 'pummaxwidth' value
          (after v9.1.1250)
Solution: test that st_end points after st pointer (Hirohito Higashi)

closes: vim/vim#17005

f13c856154

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-17 06:46:32 +08:00
284b0e4fa2 fix(treesitter): fix :InspectTree incorrect injections 2025-04-16 15:03:28 +01:00
223ac7782e fix(vim.system): unclear non-executable message #33455
Problem:
When a command is not found or not executable, the error message gives
no indication about what command was actually tried.

Solution:
Always append the command name to the error message.

BEFORE:

    E5108: Error executing lua …/_system.lua:248: ENOENT: no such file or directory

AFTER:

    E5108: Error executing lua …/_system.lua:249: ENOENT: no such file or directory: "foo"

fix #33445
2025-04-16 05:06:39 -07:00
fd973c0a4e fix(env.c): drop envmap, free os_getenv() result #32683
Problem:
vim.uv.os_setenv gets "stuck" per-key. #32550
Caused by the internal `envmap` cache. #7920

    :echo $FOO  <-- prints nothing
    :lua vim.uv.os_setenv("FOO", "bar")
    :echo $FOO  <-- prints bar (as expected)
    :lua vim.uv.os_setenv("FOO", "fizz")
    :echo $FOO  <-- prints bar, still (not expected. Should be "fizz")
    :lua vim.uv.os_unsetenv("FOO")
    :echo $FOO  <-- prints bar, still (not expected. Should be nothing)
    :lua vim.uv.os_setenv("FOO", "buzz")
    :echo $FOO  <-- prints bar, still (not expected. Should be "buzz")

Solution:
- Remove the `envmap` cache.
  - Callers to `os_getenv` must free the result.
- Update all call-sites.
- Introduce `os_getenv_noalloc`.
- Extend `os_env_exists()` the `nonempty` parameter.
2025-04-16 03:36:07 -07:00
7432781e71 fix(mouse): do not fetch clipboard twice when pasting with middle button #33494
Problem:
When doing paste operation mouse code tries to figure out it it is
dealing with a multi-line register by calling yank_register_mline(),
which fetches register data and checks its type. Later the code calls
either do_put() or insert_reg() which fetch register data again. This is
unnoticeable when working with internal neovim registers, but starts
hurting when dealing with clipboards, especially remote one (forwarded X
or socket tunnel or similar).

Solution:
Change yank_register_mline() to also return pointer to the
register structure prepared for pasting, and insert_reg() to accept
such register pointer and use it if it is supplied. do_put() already
has support for accepting a register structure to be used for pasting.

Fixes #33493
2025-04-16 03:08:41 -07:00
07d06dd396 docs(man): fix mandoc warnings, prettify #33484
Problem:
mandoc warnings:

    $ cd src/man
    $ mandoc -Tlint -Wall nvim.1
    mandoc: nvim.1:83:95: STYLE: input text line longer than 80 bytes: Remaining arguments ...
    mandoc: nvim.1:251:8: WARNING: undefined escape, printing literally: \+
    mandoc: nvim.1:283:46: WARNING: new sentence, new line
    mandoc: nvim.1:330:115: STYLE: input text line longer than 80 bytes: When supplied with -...
    mandoc: nvim.1:44:2: WARNING: skipping paragraph macro: Pp before Bl
    mandoc: nvim.1:114:7: STYLE: no blank before trailing delimiter: Ic :w!
    mandoc: nvim.1:313:12: STYLE: no blank before trailing delimiter: Ic :source!

Solution:
- wrap text lines (80 at maximum)
- new sentence, new line
- fix inconsistency in macro usage

see
- mandoc_char(7)
- mandoc_man(7)
- mandoc_mdoc(7)

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-16 03:03:36 -07:00
1de276bbcd vim-patch:9.1.1308: completion: cannot order matches by distance to cursor (#33491)
Problem:  During insert-mode completion, the most relevant match is often
          the one closest to the cursor—frequently just above the current line.
          However, both `<C-N>` and `<C-P>` tend to rank candidates from the
          current buffer that appear above the cursor near the bottom of the
          completion menu, rather than near the top. This ordering can feel
          unintuitive, especially when `noselect` is active, as it doesn't
          prioritize the most contextually relevant suggestions.

Solution: This change introduces a new sub-option value "nearest" for the
          'completeopt' setting. When enabled, matches from the current buffer
          are prioritized based on their proximity to the cursor position,
          improving the relevance of suggestions during completion
          (Girish Palya).

Key Details:
- Option: "nearest" added to 'completeopt'
- Applies to: Matches from the current buffer only
- Effect: Sorts completion candidates by their distance from the cursor
- Interaction with other options:
  - Has no effect if the `fuzzy` option is also present

This feature is helpful especially when working within large buffers where
multiple similar matches may exist at different locations.

You can test this feature with auto-completion using the snippet below. Try it
in a large file like `vim/src/insexpand.c`, where you'll encounter many
potential matches. You'll notice that the popup menu now typically surfaces the
most relevant matches—those closest to the cursor—at the top. Sorting by
spatial proximity (i.e., contextual relevance) often produces more useful
matches than sorting purely by lexical distance ("fuzzy").

Another way to sort matches is by recency, using an LRU (Least Recently Used)
cache—essentially ranking candidates based on how recently they were used.
However, this is often overkill in practice, as spatial proximity (as provided
by the "nearest" option) is usually sufficient to surface the most relevant
matches.

```vim
set cot=menuone,popup,noselect,nearest inf

def SkipTextChangedIEvent(): string
    # Suppress next event caused by <c-e> (or <c-n> when no matches found)
    set eventignore+=TextChangedI
    timer_start(1, (_) => {
        set eventignore-=TextChangedI
    })
    return ''
enddef

autocmd TextChangedI * InsComplete()

def InsComplete()
    if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
        SkipTextChangedIEvent()
        feedkeys("\<c-n>", "n")
    endif
enddef

inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedIEvent()<cr><c-e>

inoremap <silent><expr> <tab>   pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
```

closes: vim/vim#17076

b156588eb7

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-16 02:48:08 +00:00
b0f97177d4 vim-patch:9.1.1305: completion menu active after switching windows/tabs (#33488)
Problem:  When switching to another window or tab page while the
          completion menu is active, the menu stays visible, although it
          belongs to the previous window/tab page context (Evgeni
          Chasnovski).
Solution: Track the window and tab page where completion started. Detect
          changes in the main editing loop and cancel completion mode if
          the current window or tab page differs from where completion
          started.

fixes: vim/vim#17090
closes: vim/vim#17101

cf7f01252f

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-16 07:50:08 +08:00
d2d1b5e944 vim-patch:9.1.1303: missing out-of-memory check in linematch.c (#33487)
Problem:  missing out-of-memory check in linematch.c
Solution: return early in case of memory allocation failure, move the
          pow() calculation ouside of the for() loop
          (John Marriott)

closes: vim/vim#17118

2137710b43

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-04-16 06:47:51 +08:00
5333d6371b fix(man.lua): E95 when piping to :Man #33068
Problem: When piping raw manpage content into `:Man!`, buf name is
set to 'man://.. ref', but the check only matches the prefix.
Allows duplicate buffers to be created, triggering E95.

Solution: Match full buf name instead of only 'man://' prefix.
If the buffer already exists, generate a unique name with
'man://' .. 'ref' .. '?new=' format.

Refs: #30132
2025-04-15 06:27:51 -07:00
07b33c3266 Merge pull request #31837 from fredizzimo/multigrid-composition
feat(ui): include compositor info with multigrid
2025-04-15 11:56:39 +02:00
f29856d034 feat(ui): include compositor info with multigrid
Provide compositor information, like composition index and absolute
position.
2025-04-15 10:52:57 +02:00
c58c650adf vim-patch:829eda7: runtime(new-tutor): update tutor and correct comandline completion (#33449)
Problem: Some parts of the tutor are outdated.

- For example, pressing `<Tab>` after typing `:e` does not complete the
command `:edit`, but shows a completion menu with the first entry being
`:earlier`.

closes: vim/vim#17107

829eda7d38
2025-04-15 15:11:17 +08:00
9272dc9597 vim-patch:9.1.1300: wrong detection of -inf (#33474)
Problem:  wrong detection of -inf
Solution: correctly compare 4 characters and not 3
          (John Marriott)

closes: vim/vim#17109

10f69298b4

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-04-15 08:58:00 +08:00
3341ab0776 fix(marks): clamp conceal_lines corrected line number #33464
Problem:  Line number corrected for conceal_lines may be set beyond eob
          when the last buffer line is concealed, causing ml_get errors.

Solution: Avoid setting line number beyond eob.
2025-04-14 04:19:07 -07:00
aa47c8efa9 vim-patch:9.1.1297: Ctrl-D scrolling can get stuck #33453
Problem:  cursor_correct() calculates a valid cursor position which
	  is later changed by update_topline() and causes Ctrl-D
          scrolling to be stuck (Daniel Steinberg, after v9.1.0258).
Solution: Update the valid cursor position before validating topline
          (Luuk van Baal).

c98250377d
2025-04-14 04:10:36 -07:00
287955cfb4 vim-patch:9.1.1299: filetype: mbsyncrc files are not recognized
Problem:  filetype: mbsyncrc files are not recognized
Solution: detect isyncrc and "*.mbsyncrc" files as mbsync filetype,
          include filetype and syntax plugin (Pierrick Guillaume)

mbsync is a command line application which synchronizes mailboxes;
currently Maildir and IMAP4 mailboxes are supported.
New messages, message deletions and flag changes can be propagated both ways;
the operation set can be selected in a fine-grained manner.

References:
mbsync syntax overview: mbsync manual (isync v1.4.4)
https://isync.sourceforge.io/mbsync.html

Upstream support for the mbsync filetype.
Original plugin: https://github.com/Fymyte/mbsync.vim

closes: vim/vim#17103

836b87d699

Co-authored-by: Pierrick Guillaume <pguillaume@fymyte.com>
2025-04-14 09:47:56 +02:00
2d6120240d vim-patch:3cbd7f1: runtime(gleam): update Maintainer and filetype options (#33461)
closes: vim/vim#17086

3cbd7f18e3

Co-authored-by: Kirill Morozov <kirill@robotix.pro>
2025-04-14 15:41:58 +08:00
51caf0a3af fix(completion): avoid freeing uninitialized value (#33459) 2025-04-14 05:02:58 +00:00
fd76646a95 vim-patch:9.1.1298: define_function() is too long (#33457)
Problem:  define_function() is too long
Solution: refactor and split up into smaller functions
          (Yegappan Lakshmanan)

closes: vim/vim#17105

3956c5b53c

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-04-14 02:07:36 +00:00
ec9931fae1 Merge pull request #33456 from zeertzjq/vim-eded336
vim-patch: improve 'wildmode' description
2025-04-14 08:44:35 +08:00
0f4623d346 vim-patch:f4b1a60: runtime(doc): update options.txt and clarify 'wildmode' further
related: vim/vim#17100

f4b1a60dd1

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-14 08:22:29 +08:00
52be3b14e3 vim-patch:eded336: runtime(doc): Improve 'wildmode' setting desciption
closes: vim/vim#17100

eded33621b

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-14 08:21:33 +08:00
2f8fb4f28a fix(mouse): mouseclick after conceal_lines is miscalculated #33451
Problem:  Computed buffer line for mouse position does not take into
          account concealed lines on the reached row.

Solution: Adjust for concealed lines at the end of the loop computing
          the buffer position.
2025-04-13 14:30:24 -07:00
0977f70f4d fix(treesitter): injected lang ranges may cross capture boundaries #32549
Problem:
treesitter injected language ranges sometimes cross over the capture
boundaries when `@combined`.

Solution:
Clip child regions to not spill out of parent regions within
languagetree.lua, and only apply highlights within those regions in
highlighter.lua.


Co-authored-by: Cormac Relf <web@cormacrelf.net>
2025-04-13 14:22:17 -07:00
ee3f9a1e03 vim-patch:6f6c0db: runtime(doc): disable last-position-jump in diff mode (#33442)
This has been bothering me quite for some time and I never knew why it
happened. Just today it occurred to me this might have been because of
the last-position-jump.

So I figured, let's fix it for everybody, not just me.

closes: vim/vim#17092

6f6c0dba9f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-13 00:36:28 +00:00