Compare commits

...

1485 Commits

Author SHA1 Message Date
Jan Edmund Lazo
b3d29f396d vim-patch:8.1.1259: crash when exiting early (#35552)
Problem:    Crash when exiting early. (Ralf Schandl)
Solution:   Only pop/push the title when it was set. (closes vim/vim#4334)

e5c83286bb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-30 13:48:24 +08:00
Jan Edmund Lazo
0c0ef489f9 vim-patch:8.1.1136: decoding of mouse click escape sequence is not tested (#35551)
Problem:    Decoding of mouse click escape sequence is not tested.
Solution:   Add a test for xterm and SGR using low-level input.  Make
            low-level input execution with feedkeys() work.

905dd905de

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-30 05:39:43 +00:00
zeertzjq
4edeaaa6e2 vim-patch:partial:9.1.1708: tests: various tests can be improved (#35548)
Problem:  tests: various tests can be improved
Solution: Use string interpolation to concatenate strings in
          test_winfixbuf, check for specific errors in assert_fails()
          (Yegappan Lakshmanan)

closes: vim/vim#18151

97ea879b9b

Cherry-pick Test_file_perm.vim changes from patch 9.0.{0363,0611}.
Skip Test_colornames_assignment_and_unassignment().

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-08-30 08:55:48 +08:00
zeertzjq
6eebf30a39 vim-patch:7239d95: runtime(vim): Update base syntax, match :defer command argument (#35547)
closes: vim/vim#18159

7239d95bf2

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-08-30 08:15:01 +08:00
zeertzjq
8a2587be23 Merge pull request #35546 from zeertzjq/vim-a07a2f4
vim-patch:a07a2f4: runtime(astro): catch json_decode() error when parsing tsconfig.json
2025-08-30 08:14:15 +08:00
zeertzjq
834e1181da Merge pull request #35545 from zeertzjq/vim-9.1.1687
vim-patch:9.1.{1687,1693,1697,1713}: m4 ft detection updates
2025-08-30 07:22:13 +08:00
zeertzjq
68a2e0ef78 vim-patch:9.1.1713: filetype: fvwm2m4 files are no longer detected
Problem:  filetype: fvwm2m4 files are no longer recognized
          (after 9.1.1687).
Solution: Add a special case in m4 filetype detection (zeertzjq).

closes: vim/vim#18146

5355e81868

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-08-30 06:57:09 +08:00
zeertzjq
61712cbc3a vim-patch:9.1.1697: tests: no test for aclocal.m4
Problem:  tests: no test for aclocal.m4
          (after v9.1.1693)
Solution: Add a test that aclocal.m4 is detected as config filetype

related: vim/vim#18065

f5670a1596

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-30 06:57:09 +08:00
zeertzjq
8a1afac653 vim-patch:9.1.1693: tests: test_filetype fails in shadow dir
Problem:  tests: test_filetype fails in shadow dir
          (after v9.1.9.1.1687)
Solution: Use a custom test that does not rely on configure.ac
          being existing in the upper directory tree.

de6e560150

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-30 06:57:09 +08:00
zeertzjq
dab31a3637 vim-patch:9.1.1687: filetype: autoconf filetype not always correct
Problem:  filetype: autoconf filetype not always correct
Solution: Detect aclocal.m4 as config filetype, detect configure.ac as
          config filetype, fall back to POSIX m4 (Damien Lejay).

closes: vim/vim#18065

2b55474f0a

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-08-30 06:57:08 +08:00
bfredl
772f1966a3 Merge pull request #31400 from vanaigr/decor-provider-range
feat(decor): add range-based highlighting
2025-08-29 10:33:15 +02:00
zeertzjq
19f2e5c3eb vim-patch:b760062: runtime(debversions): Move bullseye, focal, and oracular to "unsupported" (#35531)
These versions have exited their standard support term as of
- bullseye: 2024-08-14
- focal: 2025-05
- oracular: 2025-07-10

closes: vim/vim#18134

b760062897

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-08-29 07:23:43 +08:00
Siddhant Agarwal
7a71235399 fix(server): serverlist({peer=true}) does not find peer servers #35506 2025-08-28 06:41:31 -07:00
Shadman
bc6737250d fix(progress): simplify ui-event, introduce default presentation #35527
Problem:
`msg_show` has "progress" info (title, status, percent) which is not presented
by default.

Solution:
Format TUI messages as `{title}: {msg}...{percent}%`. This also gets sent to UI.

- With specific formatting sent to UI we can remove the `progress` item from
  `msg_show` event. It can be added if needed in the future. Also, having
  a default presentation makes the feature more useful.
- For `vim._extui` we just need to implement the replace-msg-with-same-id
  behavior.
- If any UI/plugin wants to do anything fancier, they can handle the `Progress`
  event.
2025-08-28 06:33:41 -07:00
vanaigr
5edbabdbec perf: add on_range in treesitter highlighting 2025-08-28 08:22:38 -05:00
vanaigr
118e7e7111 test: add treesitter long lines benchmark 2025-08-28 08:22:38 -05:00
Christian Clason
c10e36fc01 refactor(lua): consistent use of local aliases 2025-08-28 11:34:01 +02:00
Meriel Luna Mittelbach
a33284c2c0 fix(health): accept TERM=tmux-direct #35511
tmux-direct is functionally the same as tmux-256color, except it
directly reports 24-bit color and how to set them (setaf/setab)
via ncurses 6.x's extended terminfo format.
2025-08-27 20:01:07 -07:00
Robert Muir
729111d3a3 fix(lsp): don't treat MarkedString[] with language id as empty #35518
Problem:
Hover response of MarkedString[] where the first element contains a
language identifier treated as empty.

Solution:
Fix empty check to handle case of MarkedString[] where the first element
is a pair of a language and value.
2025-08-27 18:51:30 -07:00
zeertzjq
2ac00f1350 vim-patch:9.1.1698: Some error numbers are not documented (#35522)
Problem:  Some error numbers are not documented
          (Restorer)
Solution: Document missing error numbers (Yegappan Lakshmanan).

fixes: vim/vim#18114
closes: vim/vim#18135

5e27058fc4

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-08-28 00:15:06 +00:00
zeertzjq
24020ef2dd vim-patch:9.1.1700: Multiline ignorecase specific pattern does not match with 'ignorecase' (#35520)
Problem:  a pattern that involves a backref on a different line does not
          match when 'ignorecase' is set (QiWei, after v9.1.0645)
Solution: Use MB_STRNICMP when ignorecase is set, fix tests to close
          swapfiles

related: vim/vim#14756
fixes: vim/vim#17470
closes: vim/vim#18104

bf82e58a70

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-28 07:35:22 +08:00
zeertzjq
9512aac42a Merge pull request #35519 from zeertzjq/vim-9.1.1701
vim-patch:9.1.{1701,1702}
2025-08-28 07:26:34 +08:00
zeertzjq
a3b1159949 vim-patch:9.1.1702: tests: test_edit still fails on CI
Problem:  tests: test_edit still fails on CI
          (after v9.1.1701)
Solution: Fix the skip condition

42acf736a3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-28 06:58:10 +08:00
zeertzjq
c961361406 vim-patch:9.1.1701: tests: failure on CI with GUI and ASAN in test_edit.res
Problem:  tests: failure on CI with GUI and ASAN in test_edit.res
          (Hirohito Higashi)
Solution: Disable the test for that specific situation in CI, close
          swapfiles

fixes: vim/vim#18070

6c14c4625b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-28 06:57:52 +08:00
Justin M. Keyes
bcf952e85f Merge #35505 from ofseed/lsp-fix-autocomplete 2025-08-27 13:33:17 -04:00
phanium
cd7cf4bd16 fix(extui): error on :call input('') (#35515)
Problem:  Error on empty string prompt.
Solution: (prompt .. '\n'):gmatch('(.-)\n').
2025-08-27 17:12:17 +02:00
Yi Ming
db1b7f7412 fix(lsp): update completion items on TextChangedP 2025-08-27 20:40:35 +08:00
Yi Ming
6c3e9b5573 fix(lsp): update on CursorHoldI cause users unable to select() 2025-08-27 20:38:49 +08:00
Yi Ming
6005fcf671 fix(lsp): opts.wrap always true 2025-08-27 20:02:42 +08:00
zeertzjq
9269a1da35 fix(floatwin): handle viewport width properly at end of window (#35490)
Also avoid repeated calls of compute_foldcolumn().
2025-08-27 19:27:50 +08:00
zeertzjq
117b129378 vim-patch:9.1.1694: filetype: Buck eXtension Lang files are not recognized (#35504)
Problem:  filetype: Buck eXtension Lang files are not recognized
Solution: Detect *.bxl files as bzl filetype.
          (Jade Lovelace)

References:
- https://buck2.build/docs/bxl/

closes: vim/vim#18130

3aea867b27

Co-authored-by: Jade Lovelace <jadel@mercury.com>
2025-08-27 12:23:31 +08:00
zeertzjq
6014174b71 vim-patch:3571388: runtime(lf): update syntax to support lf version r37 (#35503)
Adds the lf release 37 specific syntax highlighting changes.

From the PR andis-sprinkis/lf-vim#23 by @CatsDeservePets

closes: vim/vim#18115

3571388ded

Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
2025-08-27 12:23:17 +08:00
zeertzjq
3586e047e6 vim-patch:9.1.1695: Need more Vim script specific tests (#35500)
Problem:  Need more Vim script specific tests
Solution: Add more tests (Yegappan Lakshmanan).

closes: vim/vim#18118

e810ba5a1f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-08-27 10:18:10 +08:00
zeertzjq
b116ed7b12 vim-patch:9.1.1690: Missing recursion guard in dos/unix_expandpath() (#35499)
Problem:  Missing recursion guard in dos/unix_expandpath()
Solution: Add guard variables (ashamedbit)

fixes: vim/vim#18099
closes: vim/vim#18106

e8948a1f80

Co-authored-by: ashamedbit <muralianiruddhan@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-27 10:17:30 +08:00
zeertzjq
443278c587 refactor: rename ga_concat_strings_sep() to ga_concat_strings() (#35498)
This adds a missing change from Vim patch 7.4.279.

N/A patch:
vim-patch:9.1.1691: over-allocation in ga_concat_strings()
2025-08-27 10:17:12 +08:00
zeertzjq
4263ec21c2 vim-patch:9.1.1688: potential buffer overrun in bufwrite.c (#35497)
Problem:  potential buffer overrun in bufwrite.c
Solution: Use a temporary variable (John Marriott)

In my Windows 11 Pro 64-bit build MAXPATHL is 1024 and IOSIZE is 1025.
In my Archlinux Linux 64-bit build MAXPATHL is 4096 and IOSIZE is 1025.

In funuction buf_write():
There is a check (line 713) that makes sure the length of fname is less
than MAXPATHL. There is a call to STRCPY() (line 1208) which copies the
string at fname into IObuff (which has size IOSIZE). For Unix builds
fname is set to sfname which may or may not be shorter. However, if
sfname is NULL sfname is set to fname.

Therefore, in builds where MAXPATHL > IOSIZE (eg in my linux build), it
is theoretically possible for the STRCPY() call to exceed the bounds of
IObuff.

This PR addresses this by copying fname into a local variable that has
the same maximum size as fname.

In addition:
Given that the filename is unconditionally overwritten in the for loop,
only copy the directory portion of fname. Move variable i closer to
where it is used.

closes: vim/vim#18095

a19b019b87

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-08-27 10:16:59 +08:00
zeertzjq
c741927883 vim-patch:9.1.1689: CmdlineChanged not triggered by <Del> (#35496)
Problem:  CmdlineChanged not triggered by <Del>
Solution: Use STRCMP() instead of STRNCMP()
          (Shougo Matsushita)

closes: vim/vim#18101

540480697d

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2025-08-27 10:16:44 +08:00
zeertzjq
8f78591f9a fix(column): wrong alignment and highlight with empty 'display' (#35495)
This fixes a regression from #26961.
2025-08-27 10:16:13 +08:00
Shadman
8b171852a9 feat(api): nvim_echo can emit Progress messages/events #34846
Problem:
Nvim does not have a core concept for indicating "progress" of
long-running tasks. The LspProgress event is specific to LSP.

Solution:
- `nvim_echo` can emit `kind="progress"` messages.
  - Emits a `Progress` event.
  - Includes new fields (id, status, percent) in the `msg_show` ui-event.
  - The UI is expected to overwrite any message having the same id.
- Messages have a globally unique ID.
  - `nvim_echo` returns the message ID.
- `nvim_echo(… {id=…})` updates existing messages.

Example:

    local grp = vim.api.nvim_create_augroup("Msg", {clear = true})
    vim.api.nvim_create_autocmd('Progress', {
      pattern={"term"},
      group = grp,
      callback = function(ev)
        print(string.format('event fired: %s', vim.inspect(ev))..'\n')
      end
    })

    -- require('vim._extui').enable({enable=true, msg={target='msg', timeout=1000}})
    vim.api.nvim_echo({{'searching'}}, true, {kind='progress',  percent=80, status='running', title="terminal(ripgrep)"})
    local id = vim.api.nvim_echo({{'searching'}}, true, {kind='progress', status='running', percent=10, title="terminal(ripgrep)"})
    vim.api.nvim_echo({}, true, {id = id, kind='progress', percent=20, status = 'running', title='find tests'})
    vim.api.nvim_echo({}, true, {id = id, kind='progress', status='running', percent=70})
    vim.api.nvim_echo({{'complete'}}, true, {id = id, kind='progress', status='success', percent=100, title="find tests"})

Followups:
- Integrate with 'statusline' by listening to the Progress autocmd event.
- Integrate progress ui-event with `vim._extui`.
2025-08-26 13:48:53 -07:00
Sean Dewar
1e1619de83 fix(eval): winnrs of unfocusable/hidden windows #35474
Problem: various functions may return incorrect window numbers for unfocusable
or hidden windows.

Solution: fix the checks. Make sure current windows in non-current tabpages have
a window number.

Fixes #35453
2025-08-26 13:13:05 -07:00
Sean Dewar
6a409e0507 fix(terminal): don't trigger TextChangedT for unrelated redraws
Problem: TextChangedT fires depending on whether Nvim needs to update_screen
while in terminal mode. This makes little sense as redraws can be completely
unrelated to the terminal. Also, TextChanged could be fired from changes in
terminal mode after returning to normal mode.

Solution: trigger it when b:changedtick changes, like other such events. Happens
when invalid cells are refreshed, though is no longer affected by cursor
changes. Don't fire TextChanged from changes in terminal mode after leaving.

Unlike the other TextChanged* events, I've elected to not have it be influenced
by typeahead. Plus, unlike when leaving insert mode when no TextChangedI events
are defined, I don't trigger TextChanged when returning to normal mode from
changes in terminal mode (is that a Vim bug?)

Curiously, Vim's TextChangedT is different; it's tied to its terminal cursor
redraws, which triggers pretty eagerly (but is unaffected by unrelated redraws)
- usually *twice* when data is sent to the terminal (regardless of whether it
causes any visible changes, like incomplete escape codes; wasn't true for Nvim).

Not clear to me how this event was actually intended to work, but this seems to
make the most sense to me.
2025-08-26 09:49:12 +01:00
Sean Dewar
e6ba78919c fix(terminal): possibly wrong wrow/wcol in active terminal
Problem: w_wrow/col calculation in terminal_check_cursor is wrong when the
terminal is smaller than the window. Common when there's a larger window open
with the same terminal, or just after a resize (as refresh_size is deferred).

Solution: don't calculate it; validate_cursor will correct it later if it's
out-of-date.

Note that the toplines set for the terminal (also before this PR) assume
'nowrap' (which is set by default for terminal windows), and that no weird stuff
like filler lines are around. That means, for example, it's possible for the
cursor to be moved off-screen if there's wrapped lines. If this happens, it's
likely update_topline will move the cursor back on screen via validate_cursor or
similar, but maybe this should be handled more elegantly in the future?
2025-08-26 09:49:12 +01:00
Sean Dewar
c845f1923d fix(terminal): patch various autocommand-related holes
Problem: autocommands can cause various problems in terminal mode, which can
lead to crashes, for example.

Solution: fix found issues. Move some checks to terminal_check and guard against
autocommands messing with things. Trigger TermEnter/Leave after terminal mode
has changed/restored most state. Wipeout the correct buffer if TermLeave
switches buffers and fix a UAF if it or WinScrolled/Resized frees the terminal
prematurely.

These changes also allow us to remove the buffer restrictions on TextChangedT;
they were inadequate in stopping some issues, and WinScrolled/Resized was
lacking them anyway.
2025-08-26 09:49:12 +01:00
Sean Dewar
b7124ae768 fix(terminal): update winopts and focus when switching terminals
Problem: window options and terminal focus notifications not updated when
switching terminals without leaving terminal mode.

Solution: update them.
2025-08-26 09:49:12 +01:00
Sean Dewar
d07cbb2f42 fix(terminal): check size when creating new tabpage
Problem: when creating a new tabpage with a terminal window, terminal size is
not updated if there is no statusline.

Solution: do not rely on last_status to implicitly call terminal_check_size as a
side effect of making room for a statusline; call it directly.
2025-08-26 09:49:12 +01:00
Sean Dewar
61217e3618 fix(terminal): avoid events messing up topline of focused terminal
Problem: topline of a focused terminal window may not tail to terminal output if
events scroll the window.

Solution: set the topline in terminal_check_cursor.
2025-08-26 09:49:12 +01:00
Sean Dewar
ad1dfc92a0 fix(terminal): add various missing redraws
Problem: missing redraws when restoring saved cursorline/column, plus missing
statusline and mode redraws when not updating the screen in terminal mode.

Solution: schedule the redraws in a similar manner to other modes and remove
some now unnecessary redrawing logic. Redraw if cursorline-related options
change from entering terminal mode. This fixes test failures in later commits.

WTF: TextChangedT triggers based on must_redraw, which is... fun...? Try to
preserve its behaviour as much as we can for now.
2025-08-26 09:49:12 +01:00
Sean Dewar
5e521c3b5a fix(terminal): avoid tailed cursor in focused terminal in events
Problem: in terminal mode, adjust_topline moves curwin's cursor to the last row
so set_topline tails the non-scrollback area. This may result in the observed
cursor position remaining tailed in events within the focused terminal, rather
than reflecting the actual cursor position.

Solution: use the focused terminal's actual cursor position immediately, rather
than relying on the next terminal_check_cursor call in terminal_check to set it.

Note: Maybe also possible for terminal mode cursor position to be stale
(reporting the normal mode position) when switching buffers in events to another
terminal until the next terminal_check call? (or until refresh_terminal is
called for it) Maybe not worth fixing that, though.
2025-08-26 09:49:12 +01:00
Jan Edmund Lazo
088ba835ed vim-patch:8.2.0845: text properties crossing lines not handled correctly (#35483)
Problem:    Text properties crossing lines not handled correctly.
Solution:   When joining lines merge text properties if possible.
            (Axel Forsman, closes vim/vim#5839, closes vim/vim#5683)

87be9be1db

Port docs from patch v8.1.0688.
Rewrite docs for ml_replace_buf_len().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-26 12:54:13 +08:00
zeertzjq
821bfc02fb vim-patch:9.1.1685: Missing changes from PR 18068 (#35482)
Problem:  Missing changes from PR 18068
Solution: Include the missing changes
          (Girish Palya)

c6a0f42cdb

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-26 07:24:21 +08:00
zeertzjq
516363e6ba test: increase timeout in 'autocompletedelay' test (#35467)
Change timeout from 200ms to 400ms, which is still 100ms lower than the
'autocompletedelay' value.
2025-08-25 15:33:54 +08:00
Jan Edmund Lazo
5f3d00a5a6 vim-patch:8.1.2371: FEAT_TEXT_PROP is a confusing name (#35466)
Problem:    FEAT_TEXT_PROP is a confusing name.
Solution:   Use FEAT_PROP_POPUP. (Naruhiko Nishino, closes vim/vim#5291)

05ad5ff0ab

textprop,popuwin remain N/A features.
getchar.c has the relevant code changes.

Port runtest.vim changes from patch v8.1.1561.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-25 15:16:16 +08:00
Justin M. Keyes
58060c2340 Merge #33972 feat(lsp): textDocument/inlineCompletion 2025-08-24 22:17:34 -04:00
Yi Ming
42f244bf18 fix(lsp): check whether buffer is valid when scheduled #35461 2025-08-24 18:59:56 -07:00
Yi Ming
0e70aa0e86 feat(lsp): support textDocument/inlineCompletion 2025-08-25 09:48:27 +08:00
Justin M. Keyes
bccec33f5a docs: misc #35459 2025-08-24 23:43:48 +00:00
zeertzjq
b2a136bd67 Merge pull request #35445 from janlazo/vim-9.1.0546
vim-patch:8.1.{579,654,655},9.1.0546
2025-08-25 07:36:59 +08:00
Maria José Solano
1f63735f17 fix(lsp): treat nil inlay hint result as empty array (#35458)
`gopls` seems to send a nil result when there are no inlay hints for the
buffer. [The protocol](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint)
allows for the server to send an array or nil, and it isn't clear what
nil should represent. I think it's reasonable to treat it as an empty
array though.
2025-08-24 15:46:08 -07:00
Jan Edmund Lazo
76729a2044 vim-patch:8.1.0655: when appending a line text property flags are not added
Problem:    When appending a line text property flags are not added.
Solution:   Add text properties to a newly added line.

b56ac049ea

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-24 18:43:18 -04:00
Jan Edmund Lazo
b5e20d7dff vim-patch:8.1.0654: when deleting a line text property flags are not adjusted
Problem:    When deleting a line text property flags are not adjusted.
Solution:   Adjust text property flags in preceding and following lines.

c1a9bc1a72

"textprop" feature remains N/A.
Porting to sync ml_delete_int() with Vim 8.2.0845 and later.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-24 11:00:01 -04:00
Jan Edmund Lazo
5a14a2679d vim-patch:8.1.0579: cannot attach properties to text
Problem:    Cannot attach properties to text.
Solution:   First part of adding text properties.

98aefe7c32

"textprop" feature remains N/A.
Porting for ml_replace_len().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-24 10:56:05 -04:00
Yi Ming
40f5115ac4 fix(lua): disable strict_indexing when converting LSP positions 2025-08-24 21:02:02 +08:00
zeertzjq
6018aed92f Merge pull request #35454 from zeertzjq/vim-f66674c
vim-patch: runtime file updates
2025-08-24 20:40:06 +08:00
zeertzjq
98407a8b91 vim-patch:99964e2: runtime(python): support 'type's soft keyword form
`type` became a soft keyword in Python 3.12. In that form, it is a
statement that declares a type alias:

    # type_stmt ::= 'type' identifier [type_params] "=" expression
    type Point = tuple[float, float]

To implement support for this, this change does three things:

1. adds a `pythonType` group (linked to `Type`)
2. matches `type` followed by an identifier as `pythonStatement`
3. continues to match `type` in other forms as `pythonBuiltin`

Ref:
- https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
- https://docs.python.org/3/reference/simple_stmts.html#the-type-statement

closes: vim/vim#18090

99964e2ea7

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-24 20:09:33 +08:00
zeertzjq
e12eca77ee vim-patch:e06d81f: runtime(sh): add syntax highlighting support for ${ cmd;} and ${|cmd;}
bash 5.3 (released July 2025) added support for ${ cmd;} and
${|cmd;} style command substitution, which is similar (but not
identical) to ksh/mksh.

closes: vim/vim#18084

e06d81fe67

Co-authored-by: Kevin Pulo <kevin.pulo@mongodb.com>
2025-08-24 20:09:02 +08:00
zeertzjq
53802da38b vim-patch:f66674c: runtime(fstab): Added mtab support to fstab syntax.
closes: vim/vim#18074

f66674cf42

Co-authored-by: Radu Dineiu <radu.dineiu@gmail.com>
2025-08-24 20:08:15 +08:00
Yi Ming
62b45b8fe4 feat(lua): conversion between extmark positions 2025-08-24 19:38:38 +08:00
Yi Ming
7499c9f9a7 feat(lua): conversion between cursor positions 2025-08-24 19:38:38 +08:00
Yi Ming
a4a690e597 docs(lua): mark vim.Pos.Optional as optional 2025-08-24 19:38:38 +08:00
zeertzjq
523371b044 vim-patch:9.1.1681: tests: no test for actually moving cursor with 'acl' (#35452)
Problem:  tests: no test for actually moving cursor when menu is not
          open with 'autocompletedelay'.
Solution: Use <Up> first in the test. Also remove two unnecessary <Esc>s
          in completion timeout test (zeertzjq).

closes: vim/vim#18097

e8b99ff6d5
2025-08-24 11:33:44 +00:00
zeertzjq
0b8a9bde0e fix(diff): set default diff flags properly (#35450) 2025-08-24 14:42:10 +08:00
zeertzjq
810a234978 vim-patch:9.1.1672: completion: cannot add timeouts for 'cpt' sources (#35447)
Problem:  completion: cannot add timeouts for 'cpt' sources
          (Evgeni Chasnovski)
Solution: Add the 'autocompletetimeout' and 'completetimeout' options
          (Girish Palya)

fixes: vim/vim#17908
closes: vim/vim#17967

69a337edc1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-24 13:16:55 +08:00
Jan Edmund Lazo
17601e709f vim-patch:9.1.0546: vim-tiny fails on CTRL-X/CTRL-A
Problem:  vim-tiny fails on CTRL-X/CTRL-A
          (Rob Foehl, after 9.1.0172)
Solution: Move #ifdefs, so that after changing the line in del_bytes,
          the cached textlen value is invalidated

closes: vim/vim#15178

03acd4761b

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-08-23 23:47:26 -04:00
Yochem van Rosmalen
c1fa3c7c37 feat(gen_help_html): generate helptags.json, helptag.html #35442
Problem:
No way to know the html page with the docs of a tag when you only have
the tag name.

Solution:
Generate a helptags.json that maps tags to their locations.
Generate a helptag.html page that redirects to the HTML page of the given tag.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-08-23 15:04:52 -07:00
Riley Bruins
29c5559ce1 fix(treesitter): show capture-level priorities in :Inspect #35443 2025-08-23 12:01:38 -07:00
github-actions[bot]
faff3617ba docs: update version.c #35411
vim-patch:8.2.0082: when reusing a buffer listeners are not cleared
vim-patch:8.2.0446: listener with undo of deleting all lines not tested
vim-patch:8.2.1092: not checking if saving for undo succeeds
vim-patch:8.2.3174: Vim9: "legacy undo" finds "undo" variable
vim-patch:8.2.3426: crash when deleting a listener in a listener callback
vim-patch:8.2.4142: build failure with normal features without persistent undo

vim-patch:9.0.0361: removing a listener may result in a memory leak
2025-08-23 11:59:34 -07:00
zeertzjq
ed40d89d7c Merge pull request #35427 from zeertzjq/vim-9.1.1638
vim-patch: 'autocompletedelay'
2025-08-23 21:24:17 +08:00
zeertzjq
963ead29d9 vim-patch:9.1.1670: completion: autocomplete breaks second completion
Problem:  completion: autocomplete breaks second completion
          (gravndal)
Solution: Fix the autocomplete bug (Girish Palya)

fixes: vim/vim#18044
closes: vim/vim#18068

b4e0bd93a9

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-23 20:40:59 +08:00
zeertzjq
1c0465bec6 vim-patch:5ca1ea8: runtime(doc): Tweak documentation style
closes: vim/vim#18078

5ca1ea83ad

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-23 20:40:59 +08:00
zeertzjq
6ef996a082 vim-patch:9.1.1657: Autocompletion adds delay
Problem:  Autocompletion adds delay
          (gcanat, char101, after v9.1.1638)
Solution: Temporarily disable autocomplation (Girish Palya).

related: vim/vim#17960
fixes: vim/vim#18022
closes: vim/vim#18048

196c376682

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-23 20:40:59 +08:00
zeertzjq
4019d3050d vim-patch:9.1.1638: completion: not possible to delay the autcompletion
Problem:  completion: not possible to delay the autcompletion
Solution: add the 'autocompletedelay' option value (Girish Palya).

This patch introduces a new global option 'autocompletedelay'/'acl' that
specifies the delay, in milliseconds, before the autocomplete menu
appears after typing.

When set to a non-zero value, Vim waits for the specified time before
showing the completion popup, allowing users to reduce distraction from
rapid suggestion pop-ups or to fine-tune the responsiveness of
completion.

The default value is 0, which preserves the current immediate-popup
behavior.

closes: vim/vim#17960

a09b1604d4

N/A patch: vim-patch:9.1.1641: a few compiler warnings are output

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-23 20:40:58 +08:00
zeertzjq
639f9f4cda vim-patch:9.1.1667: Another outdated comment in eval.c (#35438)
Problem:  Another outdated comment in eval.c (after 9.1.1665).
Solution: Remove that comment as well. Add a few more tests for mapnew()
          that fail without patch 8.2.1672 (zeertzjq).

closes: vim/vim#18089

6b56711804
2025-08-23 10:35:18 +00:00
zeertzjq
b9699d5701 vim-patch:9.1.1665: Outdated comment in eval.c (#35436)
Problem:  Outdated comment in eval.c.
Solution: Remove the comment, which is no longer true after 8.2.1672.
          Also fix a typo in version9.txt (zeertzjq).

closes: vim/vim#18077

5d3c39af2a
2025-08-23 07:38:07 +08:00
glepnir
eeba0dc2ed fix: memory leak from double buffer initialization in read_stdin #35413
Problem: When stdin follows files, set_curbuf() initializes buffer via
enter_buffer(), then open_buffer() initializes again, causing memory leaks.

Solution: Use readfile() directly for new buffers already initialized by
enter_buffer(), only call open_buffer() for original buffer case.
2025-08-22 14:50:30 -07:00
Gregory Anders
586b1b2d9b feat(tui): add nvim_ui_send (#35406)
This function allows the Nvim core to write arbitrary data to a TTY
connected to a UI's stdout.
2025-08-22 15:05:43 -05:00
Justin M. Keyes
5d8e870c11 Merge #35429 vim.pack adjustments 2025-08-22 14:35:41 -04:00
bfredl
df9ff9cfa8 Merge pull request #35434 from bfredl/zigtag2
fix(build): workaround errors in zig build due to stale cache
2025-08-22 19:40:38 +02:00
bfredl
ec8a0c7340 fix(build): workaround errors in zig build due to stale cache
addDirectoryArg with a source dir is not enough to depend on changes
to invidiual files. as a workaround, mark this step as having
side-effects (always being run) for now.
2025-08-22 19:10:43 +02:00
Evgeni Chasnovski
1ffaaa06c5 docs(pack): document $XDG_DATA_HOME/nvim/site presence in 'packpath'
Problem: Some use cases might lead to `vim.pack.add()` failing to
`:packadd` a plugin because of missing entry in 'packpath'. Like with
`nvim --clean` or manually setting `$XDG_DATA_HOME` during startup.

Solution: Document it. A more proactive approach can be ensuring correct
'packpath' entry, but it is currently somewhat verbose to do (due to
having to adjust for Windows using `\` in 'packpath' entries).
2025-08-22 13:41:36 +03:00
Evgeni Chasnovski
7acfad226d test(pack): simplify tests for data field 2025-08-22 13:32:11 +03:00
Evgeni Chasnovski
92e7d5eaf2 perf(pack): reduce number of 'opt/' directory computations 2025-08-22 13:00:30 +03:00
tao
d73cfefed5 fix(folds): error when deleting lines at end of buffer #35396
Problem:
with `foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr()
foldminlines=0`, deleting lines at the end of the buffer always
reports an invalid top error, because the top value (i.e. the
start line number of the deletion) is always 1 greater than
the total line number of the modified buffer.

Solution:
remove the ml_line_count validation
2025-08-21 19:55:45 -07:00
zeertzjq
12b6f65283 vim-patch:014d50d: runtime(systemverilog): Add syntax highlighting for 1800-2023 block strings (#35425)
closes: vim/vim#18056

014d50df80

Co-authored-by: Ayan Banerjee <ayanbanrj@gmail.com>
2025-08-22 09:26:47 +08:00
Igor Lacerda
8e48c02061 fix(lsp): handle array with empty string when checking empty hover (#35423) 2025-08-21 17:15:56 -07:00
zeertzjq
865a28155e vim-patch:8.2.1672: v_lock is used when it is not initialized (#35416)
Problem:    v_lock is used when it is not initialized. (Yegappan Lakshmanan)
Solution:   Initialize the typval in eval1().

4a091b9978

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-22 06:28:45 +08:00
Birdee
c522cb0e96 feat(pack): support user-defined data in plugin spec #35360
Problem:
The load function in opts was difficult to use if you wished to
customize based on the plugin being loaded.

You could get the name, but without some way to mark a spec, that was of
limited usefulness unless you wanted to hardcode a list of names in the
function, or write a wrapper around the whole thing

Solution:
Allow users to provide an arbitrary data field in plugin specs so that
they may receive info as to how to handle that plugin in load, get() and
events, and act upon it

Co-authored-by: BirdeeHub <birdee@localhost>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2025-08-21 10:08:29 -07:00
luukvbaal
9467731865 feat(extui): support paging in the dialog window (#35310)
Problem:  Unable to see e.g. `inputlist()` prompts that exceed the dialog
          window height.
          Multi-line prompts are not handled properly, and tracking
          is insufficient for messages in cmdline_block mode.
Solution: Add vim.on_key handler while the dialog window is open that
          forwards paging keys to the window.
          Properly render multi-line prompts. Keep track of both the start
          and end of the current cmdline prompt. Append messages after the
          current prompt in cmdline_block mode.
2025-08-21 14:56:59 +02:00
Cameron Ring
30dae87de4 fix(startup): file buf is lost if stdin is empty and "-" is last #35402
Problem:
Running `echo dummy | nvim file1 file2` closes the file1 buffer if
file1 doesn't exist.

Solution:
Logic changed in 43e8ec9 such that stdin buffer may now be created *after*
file args. Handle that case.
2025-08-20 20:34:49 -07:00
zeertzjq
a8dad46e1c Merge pull request #35352 from janlazo/vim-8.1.2008
vim-patch:8.1.2008,v8.2.{844,853,3348,3795,4379}
2025-08-21 11:31:31 +08:00
Jan Edmund Lazo
dc2d4b07a8 vim-patch:8.2.0853: ml_delete() often called with FALSE argument
Problem:    ml_delete() often called with FALSE argument.
Solution:   Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE.

ca70c07b72

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:46:35 -04:00
Jan Edmund Lazo
e77d15cc5d vim-patch:8.2.3348: line2byte() returns wrong value after adding textprop
Problem:    line2byte() returns wrong value after adding textprop. (Yuto
            Kimura)
Solution:   Reduce the length by the size of the text property. (closes vim/vim#8759)

14c7530c4f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:46:35 -04:00
Jan Edmund Lazo
ed012b817d vim-patch:8.2.0844: text properties crossing lines not handled correctly
Problem:    Text properties crossing lines not handled correctly.
Solution:   When saving for undo include an extra line when needed and do not
            adjust properties when undoing. (Axel Forsman, closes vim/vim#5875)

ML_DEL_UNDO, ML_APPEND_UNDO are no-opt because textprop feature is N/A.

a9d4b84d97

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:45:49 -04:00
Jan Edmund Lazo
09964b7ef0 vim-patch:8.2.4379: an empty change is reported to a listener
Problem:    An empty change is reported to a listener.
Solution:   Do not report an empty change. (closes vim/vim#9768)  Remove unused
            return value.

55737c2a31

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:45:49 -04:00
Jan Edmund Lazo
15d3a83999 vim-patch:8.2.3795: too many #ifdefs
Problem:    Too many #ifdefs.
Solution:   Graduate the jumplist feature.

739f13a55b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:45:48 -04:00
Jan Edmund Lazo
d06fdecb97 vim-patch:8.1.2008: error for invalid range when using listener and undo
Problem:    Error for invalid range when using listener and undo. (Paul Jolly)
Solution:   Do not change the cursor before the lines are restored.
            (closes vim/vim#4908)

4544bd2f24

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-20 21:45:48 -04:00
zeertzjq
fbaead249b Merge pull request #35410 from zeertzjq/vim-308a313
vim-patch: doc updates
2025-08-21 09:15:20 +08:00
zeertzjq
7d53982b7f vim-patch:84a343a: runtime(doc): correct another problem in :h items()
The returned value is only in arbitrary order for a Dict.

closes: vim/vim#18050

84a343a6ed
2025-08-21 08:44:08 +08:00
zeertzjq
1fdacbb3e4 vim-patch:44c8072: runtime(doc): fix style and clarify items() function for String type
related: vim/vim#18021

44c8072ef6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-21 08:44:08 +08:00
zeertzjq
049de6f119 vim-patch:partial:308a313: runtime(doc): Update help for the items() function
closes: vim/vim#18021

308a3130be

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-08-21 08:44:07 +08:00
Tiago Inaba
848c7a7894 fix(lsp): update window title when cycling through signatures #35407 2025-08-20 11:09:16 -07:00
github-actions[bot]
cd2d5de1f9 docs: update version.c #35201
vim-patch:8.1.1555: NOT_IN_POPUP_WINDOW is confusing
vim-patch:8.1.1586: error number used in two places
vim-patch:8.1.1599: compiler warning for uninitialized variable
vim-patch:8.1.1603: crash when using unknown highlighting in text property
vim-patch:8.1.1655: popup window border drawn wrong with multi-byte char
vim-patch:8.1.1675: listener list not correctly updated on listener_remove()
vim-patch:8.1.1710: Coverity found dead code
vim-patch:8.1.1844: buffer no longer unloaded when adding text properties
vim-patch:8.1.2071: when 'wincolor' is set text property changes highlighting
vim-patch:8.1.2211: listener callback "added" argument is not the total
vim-patch:8.1.2215: unreachable code in adjusting text prop columns
vim-patch:8.1.2216: text property in wrong place after :substitute
vim-patch:8.1.2298: missing part of 8.1.2296
vim-patch:8.1.2308: deleting text before zero-width textprop removes it
vim-patch:8.1.2369: cannot build with quickfix and without text properties


vim-patch:8.2.0124: compiler warnings for variable types
vim-patch:8.2.0126: textprop test fails
vim-patch:8.2.0967: unnecessary type casts for vim_strnsave()
vim-patch:8.2.1670: a couple of gcc compiler warnings
vim-patch:8.2.2429: :goto does not work correctly with text properties
vim-patch:8.2.2890: text property duplicated when data block splits
vim-patch:8.2.3062: internal error when adding several text properties
vim-patch:8.2.3372: line2byte() value wrong when adding a text property
vim-patch:8.2.3483: #ifdef for using sysinfo() is incomplete
vim-patch:8.2.4043: using int for second argument of ga_init2()
vim-patch:8.2.4144: cannot load libsodium dynamically
vim-patch:8.2.4960: text properties that cross lines not updated for deleted line
vim-patch:8.2.4961: build error with a certain combination of features
vim-patch:8.2.5014: byte offsets are wrong when using text properties
vim-patch:8.2.5041: cannot close a terminal popup with "NONE" job

vim-patch:9.0.0169: insufficient testing for line2byte() with text properties
vim-patch:9.0.0181: textprop test with line2byte() fails on MS-Windows


vim-patch:9.1.0633: Compilation warnings with `-Wunused-parameter`
vim-patch:9.1.0957: MS-Windows: conversion warnings
2025-08-20 09:43:26 -07:00
luukvbaal
61b6553ee9 fix(ui): proper event ordering for nested cmdline_block events (#35344)
Problem:  Wrong event order for nested cmdline in a conditional cmdline_block.
Solution: Emit all but the first cmdline_block event immediately after
          getting the next command, before executing it.
2025-08-20 15:02:55 +02:00
bfredl
4a1295c626 Merge pull request #34186 from bfredl/neotags
build: generate helptags without running "nvim" binary
2025-08-20 09:10:02 +02:00
zeertzjq
27bc7dcb01 Merge pull request #35399 from zeertzjq/vim-9.1.1647
vim-patch: runtime file updates
2025-08-20 08:09:14 +08:00
zeertzjq
3d511833ae vim-patch:2f7e4eb: runtime(python): optimize pythonSync pattern
Order the keywords by expected frequency: "def" and "class" are assumed
to be more likely than "async def" in the majority of Python code.

closes: vim/vim#18032

2f7e4eb335

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-20 07:24:35 +08:00
zeertzjq
ba25f3e4d4 vim-patch:9.1.1647: filetype: Cangjie files are not recognized
Problem:  filetype: Cangjie files are not recognized
Solution: Detect *.cj files as cangjie filetype, include a syntax plugin
          (WuJunkai2004)

This commit introduces a new syntax highlighting file for the Cangjie
programming language, includes 4 parts as required:
- The main syntax file: runtime/syntax/cangjie.vim
- The filetype detection rule in: runtime/filetype.vim
- The documentation update in: runtime/doc/syntax.txt
- Some menus

References:
- https://gitcode.com/Cangjie
- https://cangjie-lang.cn/

fixes: 18014
closes: vim/vim#18027

0c4405a6b2

Co-authored-by: WuJunkai2004 <wujunkai20041123@outlook.com>
2025-08-20 07:23:49 +08:00
Sean Dewar
3ec63cdab8 fix(treesitter): run FileType autocmds in the context of <abuf>
Problem: many FileType autocommands assume curbuf is the same as the target
buffer; this can cause &syntax to be restored for the wrong buffer in some cases
when TSHighlighter:destroy is called.

Solution: run nvim_exec_autocmds in the context of the target buffer via
nvim_buf_call.
2025-08-19 20:03:05 +01:00
TheBlob42
701258921e feat(snippet): highlight active tabstop (#35378) 2025-08-19 06:21:32 -07:00
bfredl
6b936002cc build: make build.zig generate helptags without running "nvim" binary
This is matters for cross-compiling where we might not
be able to run the "nvim" binary on the host.

Instead reimplement the helptags extractor as a small
lua script, which we can run on the host using the nlua0
helper already used for other generator scripts.
2025-08-19 11:14:02 +02:00
zeertzjq
25bc41847e vim-patch:9.1.1649: attrs allocation and fuzzy growarray could leak (#35383)
Problem:  attrs allocation and fuzzy growarray could leak on early
          returns
Solution: Ensure proper cleanup of allocated memory on exit paths
          (glepnir)

closes: vim/vim#18038

c7c10f8c11

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-19 08:45:15 +08:00
ite-usagi
1e20f31aa3 docs(tutor): update Japanese tutor #35379 2025-08-18 10:46:56 -07:00
ite-usagi
ddae46fba0 docs(l10n): building translation file #35380 2025-08-18 08:06:21 -07:00
Justin M. Keyes
1b2a6e0664 Merge #35018 refactor(lsp): centralized enable/is_enabled strategy 2025-08-18 10:57:57 -04:00
Yi Ming
f40162ba19 refactor(lsp): use vim.lsp._capability.enable internally 2025-08-18 19:41:55 +08:00
Yi Ming
050b04384e refactor(lsp): correct enable marker name 2025-08-18 19:41:55 +08:00
Yi Ming
2ace4089f8 refactor(lsp): no longer rely on LspDetach for detaching capabilities 2025-08-18 19:41:55 +08:00
Yi Ming
b3fbc8d6fa refactor(lsp): move util.enable to capability.enable 2025-08-18 19:41:53 +08:00
zeertzjq
052126b77a test(tui_spec): avoid race between server exit and new client (#35376)
Don't start a new client to check for server exit. Check for the server
socket being removed instead.
2025-08-18 15:24:22 +08:00
zeertzjq
f363ea8547 test(tui_spec): fix another case of flakiness (#35374) 2025-08-18 12:53:40 +08:00
Justin M. Keyes
960b33a9d8 docs: misc, dev-api-fast, $XDG_STATE_HOME #35138 2025-08-17 20:45:40 -07:00
Siddhant Agarwal
1d40f67776 feat(ssh): SSH configuration parser #35027 2025-08-17 20:40:28 -07:00
zeertzjq
37119ad0d2 vim-patch:9.1.1645: fuzzy.c can be further improved (#35371)
Problem:  fuzzy.c can be further improved
Solution: Fix memory leak and refactor it (glepnir).

Optimize performance and memory allocation:

- Fix memory leak in fuzzy_match_in_list.
- using single memory allocation in match_positions
- Improve has_match performance and add null pointer checks

closes: vim/vim#18012

59799f3afa

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-18 11:03:08 +08:00
zeertzjq
e4d3812c8b Merge pull request #35370 from zeertzjq/excmd
:connect fixes
2025-08-18 09:43:34 +08:00
zeertzjq
c1f142322b fix(excmd): correct :connect abbreviation 2025-08-18 09:22:42 +08:00
zeertzjq
f5cbf11644 fix(client): avoid :connect race with server detach
Also fix some warnings and flakiness in :restart/:connect tests.
2025-08-18 09:22:41 +08:00
Sean Dewar
2211953266 fix(api): on_detach consistently before buf_freeall autocmds
Problem: on_detach may be called after buf_freeall and other important things,
plus its textlock restrictions are insufficient. This can cause issues such as
leaks, internal errors and crashes.

Solution: disable buffer updates in buf_freeall, before autocommands (like the
order after #35355 and when do_ecmd reloads a buffer). Don't do so in
free_buffer_stuff; it's not safe to run user code there, and buf_freeall already
runs before then; just free them to avoid leaks if buf_freeall autocommands
registered more for some reason.

Fixes #28084
Fixes #33967
Fixes #35116
2025-08-17 22:32:53 +01:00
Justin M. Keyes
d8ed43c6a7 Merge #35109 vim.pos, vim.range 2025-08-17 16:37:56 -04:00
Corey Cole
4299837b44 docs(windows): WSL build instructions #35365 2025-08-17 13:07:03 -07:00
Justin M. Keyes
7eb9badd93 refactor(tests): remove redundant test #35364 2025-08-17 12:11:13 -07:00
Jaehwang Jung
285c04e2d0 fix(api,lsp): call on_detach before wiping out the buffer #35355
Problem:
Buffer-updates on_detach callback is invoked before buf_freeall(), which
deletes autocmds of the buffer (via apply_autocmds(EVENT_BUFWIPEOUT,
...)). Due to this, buffer-local autocmds executed in on_detach (e.g.,
LspDetach) are not actually invoked.

Solution:
Call buf_updates_unload() before buf_freeall().
2025-08-17 11:37:24 -07:00
zeertzjq
35a7642647 vim-patch:3cee950: runtime(diff): fix mixed translations in zh_CN (#35362)
some translations confused zh_CN and zh_TW

3cee950fc9

Co-authored-by: 毛逸宁 <mao.yining@outlook.com>
2025-08-17 18:33:29 +08:00
Yi Ming
a37e101dc7 refactor(lsp): change capability name to snake case 2025-08-17 12:37:34 +08:00
Yi Ming
7c3e579a90 refactor(lsp): register all derived Capability prototypes 2025-08-17 12:37:34 +08:00
Yi Ming
81d8198bda refactor(lsp): define Capability.on_attach 2025-08-17 12:37:34 +08:00
Yi Ming
a7fef170b7 refactor(lsp): check supported methods instead of tbl_get 2025-08-17 12:37:34 +08:00
Yi Ming
9f5b309d82 feat(lua): conversion between vim and lsp position/range 2025-08-17 12:13:24 +08:00
Yi Ming
98f8224c19 feat(lua): vim.pos/vim.range 2025-08-17 11:54:53 +08:00
zeertzjq
7e450aa383 vim-patch:b405c79: runtime(vim): set 'comments' based on script type (legacy/Vim9) (#35359)
fixes: vim/vim#18000

b405c79004

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-17 01:26:37 +00:00
zeertzjq
577f9fa1be vim-patch:9.1.1640: Unicode has deprecated some code-points (#35358)
Problem:  Unicode has deprecated some code-points
Solution: Update the digraph tables to align with the Unicode v16
          release (David Friant)

This commit updates the digraphs Left-Pointing Angle Bracket '</'
and Right-Pointing Angle Bracket '/>' to account for the fact that
the old Unicode codepoints for them (2329 and 232A, respectively)
have been deprecated. As per the Miscellaneous Technical code chart
(https://www.unicode.org/charts/PDF/U2300.pdf), the old digraphs
have been reassigned to the CJK Left Angle Bracket and Right Angle
Bracket (3008 and 3009) with their declaration moved to the
appropriate block.

This commit also introduces the new digraphs '<[' and ']>' to
represent the Mathematical Left Angle Bracket and Mathematical
Right Angle Bracket (27E8 and 27E9) to replace the deprecated code
points in the Technical block.

Tests have been added and, I believe, the documentation has been
updated accordingly.

closes: vim/vim#17990

c08b94b072

Co-authored-by: David Friant <friant@HPEnvyx360.friant.dev>
2025-08-17 08:52:05 +08:00
Michael Henry
5f8d4a248a feat(provider): detect venv python via "pynvim-python" tool #35273
Problem:
Detection of the pynvim module is currently done by finding the first
Python interpreter in the `PATH` and checking if it can import pynvim.
This has several problems:
- Activation of an unrelated Python virtual environment will break
  automatic detection, unless pynvim is also installed in that
  environment.
- Installing pynvim to the expected location is difficult. User
  installation into the system-wide or user-wide Python site area is now
  deprecated.  On Ubuntu 24.04 with Python 3.12, for example, the
  command `pip install --user pynvim` now fails with the error message
  `error: externally-managed-environment`.
- Users may create a dedicated virtual environment in which to install
  pynvim, but Nvim won't detect it; instead, they must either activate
  it before launching Nvim (which interferes with the user of other
  virtual environments) or else hard-code the variable
  `g:python3_host_prog` in their `init.vim` to the path of the correct
  Python interpreter.  Neither option is desirable.

Solution:
Expose pynvim's Python interpreter on the `PATH` under the
name `pynvim-python`.  Typical user-flow:

1. User installs either uv or pipx.
2. User installs pynvim via:
   ```
   uv tool install --upgrade pynvim
   # Or:
   pipx install --upgrade pynvim
   ```

With corresponding changes in pynvim https://github.com/neovim/pynvim/issues/593
the above user-flow is all that's needed for Nvim to detect the
installed location of pynvim, even if an unrelated Python virtual
environments is activated.  It uses standard Python tooling to automate
the necessary creation of a Python virtual environment for pyenv and the
publication of `pynvim-python` to a directory on `PATH`.
2025-08-16 14:48:08 -07:00
MinimalEffort07
77860f5418 build(deps): CMake generation fails when path contains spaces #35332
Problem:
Additional include directories in DEPS_INCLUDE_FLAGS variable are not
quoted. Paths with spaces break the resulting compile command.

Solution:
Enclose values in double quotes.
Note: normally we should avoid manual quoting, but in this case we can't
because of how `DEPS_INCLUDE_FLAGS` is used in `BuildLuv.cmake`
and `BuildLpeg.cmake`.
2025-08-16 12:25:34 -07:00
zeertzjq
013af17ed9 vim-patch:9.1.1623: Buffer menu does not handle unicode names correctly (#35353)
Problem:  Buffer menu does not handle unicode names correctly
          (after v9.1.1622)
Solution: Fix the BMHash() function (Yee Cheng Chin)

The Buffers menu uses a BMHash() function to generate a sortable number
to be used for the menu index. It used a naive (and incorrect) way of
encoding multiple ASCII values into a single integer, but assumes each
character to be only in the ASCII 32-96 range. This means if we use
non-ASCII file names (e.g. Unicode values like CJK or emojis) we get
integer underflow and overflow, causing the menu index to wrap around.
Vim's GUI implementations internally use a signed 32-bit integer for the
`gui_mch_add_menu_item()` function and so we need to make sure the menu
index is in the (0, 2^31-1) range.

To do this, if the file name starts with a non-ASCII value, we just use
the first character's value and set the high bit so it sorts after the
other ASCII ones. Otherwise, we just take the first 5 characters, and
use 5 bit for each character to encode a 30-bit number that can be
sorted.

This means Unicode file names won't be sorted beyond the first
character. This is likely going to be fine as there are lots of ways to
query buffers.

related: vim/vim#17403
closes: vim/vim#17928

8f9de4991e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-08-16 13:20:36 +08:00
bfredl
c12701d4e1 Merge pull request #35329 from bfredl/uncrustify_all
fix(build): also check os_win sources with uncrustify in CI
2025-08-15 11:06:42 +02:00
zeertzjq
8d154e5927 vim-patch:9.1.1633: Search pattern shown incorrectly with negative offset (#35337)
Problem:  Search pattern shown incorrectly with negative offset.
          (lkintact)
Solution: Don't prepend a '+' sign to a negative offset (zeertzjq).

fixes: vim/vim#17993
closes: vim/vim#17994

ade0815856
2025-08-15 00:06:32 +00:00
zeertzjq
7afcfb6c9a vim-patch:9.1.1632: memory leak in fuzzy.c
Problem:  memory leak in fuzzy.c
Solution: Free fuzmatch, add a few minor refactors
          (glepnir)

fixes neovim CID 584055: fuzmatch leak when count becomes 0
Fix partial allocation failure cleanup in buffer expansion

closes: vim/vim#17996

03d6e06edd

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-15 07:17:24 +08:00
zeertzjq
e38e65b86c vim-patch:9.1.1630: tests: fuzzy bufname completion test doesn't match successfully
Problem:  tests: fuzzy buffer name completion test doesn't match
          successfully (after 9.1.1627).
Solution: Update pattern to account for the change in case sensitivity.
          Also mark Test_search_stat_option() as flaky as it can still
          sometimes fail (zeertzjq).

closes: vim/vim#17992

891353671a
2025-08-15 07:17:24 +08:00
Gregory Anders
218ff601c4 fix(tui): do not emit resize screen sequence after host terminal is resized (#35335)
Some terminals support the CSI 8 t sequence to resize their own window
area. Neovim will emit this sequence when the TUI is resized
programatically, but it should not be emitted when the TUI is resized
because the host terminal was resized, as that results in an infinite
resize loop.
2025-08-14 18:14:26 -05:00
Siddhant Agarwal
649bb372f6 feat(ui): :connect command #34586
Add the `:connect <address>` command which connects the currently
running TUI to the server at the given address.
2025-08-14 15:58:09 -07:00
Jalil David Salamé Messina
bd45e2be63 fix(checkhealth): wrong ABI version for treesitter parsers #35327
Don't print ABI version of duplicated parsers that are later in the
runtime path (see [#35326]).

Change the sorting from `name > path` to `name > rtpath_index`, this
ensures the first (loaded) parser is first in the list and any
subsequent parsers can be considered "not loaded".

This is fuzzy at best since `vim.treesitter.language.add` can take a
path to a parser and change the load order.

The correct solution is for `vim.treesitter.language.inspect` to return
the parser path so we can compare against it and/or for it to also be
able to take a path to a parser so we can inspect it without loading it
first.
2025-08-14 11:47:43 -07:00
bfredl
c26f989b2f fix(build): also check os_win sources with uncrustify in CI 2025-08-14 10:36:08 +02:00
bfredl
38986188ba Merge pull request #35206 from bfredl/nopreproc_cleanup
refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
2025-08-14 10:02:57 +02:00
bfredl
442f297c63 refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
These are not needed after #35129 but making uncrustify still play nice
with them was a bit tricky.

Unfortunately `uncrustify --update-config-with-doc` breaks strings
with backslashes. This issue has been reported upstream,
and in the meanwhile auto-update on every single run has been disabled.
2025-08-14 09:34:38 +02:00
zeertzjq
d19d2b4491 vim-patch:1ee1d9b: runtime(python): highlight "self" and "cls" in syntax script (#35328)
These are special names by convention, and giving them distinct
highlighting is a nice visual clue (using Identifier by default).

This group is named "pythonClassVar" to match the name used by
python-syntax. Some third-party color schemes are aware of this
name and customized their colors accordingly.

closes: vim/vim#17968

1ee1d9b43d

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-14 08:36:24 +08:00
zeertzjq
9843573a61 Merge pull request #35320 from zeertzjq/vim-9.1.1627
vim-patch:9.1.{1627,1628}
2025-08-14 07:18:05 +08:00
zeertzjq
2619a749a5 vim-patch:9.1.1628: fuzzy.c has a few issues
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim/vim#17984

17a6d696bd

Co-authored-by: glepnir <glephunter@gmail.com>
2025-08-14 06:48:31 +08:00
zeertzjq
6f0ef8a5f2 vim-patch:c93a2b3: runtime(doc): Adapt fuzzy doc to reflect 'fzy' algorithm
closes: vim/vim#17988

c93a2b3327

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-14 06:48:31 +08:00
zeertzjq
869000e7ce vim-patch:9.1.1627: fuzzy matching can be improved
Problem:  fuzzy-matching can be improved
Solution: Implement a better fuzzy matching algorithm
          (Girish Palya)

Replace fuzzy matching algorithm with improved fzy-based implementation

The
[current](https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/)
fuzzy matching algorithm has several accuracy issues:

* It struggles with CamelCase
* It fails to prioritize matches at the beginning of strings, often
  ranking middle matches higher.

After evaluating alternatives (see my comments
[here](https://github.com/vim/vim/issues/17531#issuecomment-3112046897)
and
[here](https://github.com/vim/vim/issues/17531#issuecomment-3121593900)),
I chose to adopt the [fzy](https://github.com/jhawthorn/fzy) algorithm,
which:

* Resolves the aforementioned issues.
* Performs better.

Implementation details

This version is based on the original fzy
[algorithm](https://github.com/jhawthorn/fzy/blob/master/src/match.c),
with one key enhancement: **multibyte character support**.

* The original implementation supports only ASCII.
* This patch replaces ascii lookup tables with function calls, making it
  compatible with multibyte character sets.
* Core logic (`match_row()` and `match_positions()`) remains faithful to
  the original, but now operates on codepoints rather than single-byte
  characters.

Performance

Tested against a dataset of **90,000 Linux kernel filenames**. Results
(in milliseconds) show a **\~2x performance improvement** over the
current fuzzy matching algorithm.

```
Search String            Current Algo    FZY Algo
-------------------------------------------------
init                          131.759    66.916
main                          83.688     40.861
sig                           98.348     39.699
index                         109.222    30.738
ab                            72.222     44.357
cd                            83.036     54.739
a                             58.94      62.242
b                             43.612     43.442
c                             64.39      67.442
k                             40.585     36.371
z                             34.708     22.781
w                             38.033     30.109
cpa                           82.596     38.116
arz                           84.251     23.964
zzzz                          35.823     22.75
dimag                         110.686    29.646
xa                            43.188     29.199
nha                           73.953     31.001
nedax                         94.775     29.568
dbue                          79.846     25.902
fp                            46.826     31.641
tr                            90.951     55.883
kw                            38.875     23.194
rp                            101.575    55.775
kkkkkkkkkkkkkkkkkkkkkkkkkkkkk 48.519     30.921
```

```vim
vim9script

var haystack = readfile('/Users/gp/linux.files')

var needles = ['init', 'main', 'sig', 'index', 'ab', 'cd', 'a', 'b',
'c', 'k',
    'z', 'w', 'cpa', 'arz', 'zzzz', 'dimag', 'xa', 'nha', 'nedax',
'dbue',
    'fp', 'tr', 'kw', 'rp', 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk']
for needle in needles
    var start = reltime()
    var tmp = matchfuzzy(haystack, needle)
    echom $'{needle}' (start->reltime()->reltimefloat() * 1000)
endfor
```

Additional changes

* Removed the "camelcase" option from both matchfuzzy() and
  matchfuzzypos(), as it's now obsolete with the improved algorithm.

related: neovim/neovim#34101
fixes vim/vim#17531
closes: vim/vim#17900

7e0df5eee9

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-14 06:48:30 +08:00
TheBlob42
6f904cfef1 fix(snippet): adjacent tabstops without placeholders (#35167)
* fix(snippet): adjacent tabstops without placeholders

* test(snippet): add tests for directly adjacent tabstops
2025-08-13 14:51:43 -04:00
zeertzjq
7b9512e613 fix(api): fix not capturing output in cmdline mode (#35322) 2025-08-13 20:12:47 +08:00
bfredl
44fdbd6589 Merge pull request #34969 from bfredl/winbuild
feat(build): build.zig windows support.
2025-08-13 10:23:18 +02:00
bfredl
b70a6f3f3e Merge pull request #34394 from bfredl/shadamem
refactor(shada): A shada entry is a shada entry
2025-08-13 10:19:25 +02:00
zeertzjq
35be59cc7b vim-patch:9.1.1626: cindent: does not handle compound literals (#35319)
Problem:  C-indent does not handle compound literals
          (@44100hertz, @Jorenar)
Solution: Detect and handle compound literal and structure
          initialization (Anttoni Erkkilä)

match '=' or "return" optionally followed by &, (typecast), {
Fixes also initialization which begins with multiple opening braces.

fixes: vim/vim#2090
fixes: vim/vim#12491
closes: vim/vim#17865

5ba6e41d37

Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
2025-08-12 23:21:09 +00:00
zeertzjq
50ceac4054 vim-patch:9.1.1625: Autocompletion slow with include- and tag-completion (#35318)
Problem:  Autocompletion slow with include- and tag-completion
Solution: Refactor ins_compl_interrupted() to also check for timeout,
          further refactor code to skip outputting message when
          performing autocompletion (Girish Palya).

Running `vim *` in `vim/src` was slower than expected when
'autocomplete' was enabled. Include-file and tag-file completion
sources were not subject to the timeout check, causing unnecessary
delays.

So apply the timeout check to these sources as well, improving
autocompletion responsiveness, refactor find_pattern_in_path() to take
an additional "silent" argument, to suppress any messages.

closes: vim/vim#17966

59e1d7f353

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-13 07:14:49 +08:00
argothiel
76a383bb7b docs: "git" is a prerequisite #35315
BUILD.md: Add git to prerequisites

The git command is literally the first one in the build instructions, therefore it's reasonable to treat it as one of the prerequisites. Void Linux already had git as one of the prerequisites; this commits adds git to all the other Unix systems.
2025-08-12 14:11:51 -07:00
glepnir
c7c3f9fc9c fix(api): fix crash in command preview with % #35228
Problem: parse_cmdline() sets eap->cmdlinep to address of local parameter,
causing invalid memory access when expand_filename() tries to modify it.
This leads to crashes when typing '%' in user commands with preview=true
and complete=file.

Solution: Change parse_cmdline() signature to accept char **cmdline,
allowing cmdlinep to point to caller's variable for safe reallocation.
2025-08-12 13:43:56 -07:00
Jaehwang Jung
3eab5bd38a fix(treesitter): set local values of window options 2025-08-12 16:26:11 +01:00
zeertzjq
e6e1e71abf vim-patch:dba9eb4: runtime(python): Also sync syntax at 'async def' (#35309)
A file containing only async functions (`async def func()`) wouldn't
previously match the pythonSync pattern.

Also, this pattern only matches at the beginning of the line, so it
won't ever match method definitions (which are indented within class
scopes). Update the comment accordingly.

closes: vim/vim#17963

dba9eb46e6

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-12 20:11:38 +08:00
bfredl
5e1c35509e refactor(shada): A shada entry is a shada entry
problem: most shada entries use weird `PossiblyFreedShadaEntry` type
solution: delet it

Shada entries can either be allocated by shada.c when reading,
or be constructed to represent the state of the current instance,
with direct references to live instance data to avoid extra allocations.
shada.c needs to carefully only free memory allocated by the first case,
and not free memory owned by other subsystems.

In some part of the code, this is inferred by the context but in others
we are mixing entries from different sources and need to indicate
the provenance by a `can_free_entry` flag. However constantly
frontloading this distinction  in the name of the type and with
extra nesting levels, cause extra cognitive overhead when trying
to understand the code in any other aspects than the specific detail
of avoiding leaks/double frees.

As we always know if the memory is owned or not for any entry, we
can just put `can_free_entry` directly on the ShadaEntry struct.
That only one state is possible in a given context, is indicated
by this neat little syntactical construct called a constant field
initializer.
2025-08-12 13:47:33 +02:00
bfredl
dc6cf3add9 feat(build): build.zig windows support
Tested using cross-compiling from linux:

    zig build -Dcross=true -Dtarget=x86_64-windows nvim_bin

Note: not fully functional without a runtime, which still has to be
fuddled with manually

Macos and windows builds require a recent zig 0.15+dev version
As this zig master branch is currently too much in flux, we can't make
our CI depend on zig master.

Revisit CI after zig 0.15 release or at least feature freeze.
2025-08-12 13:33:24 +02:00
tao
a26cdcb20e fix(inccommand): skip input() during preview #35272
Problem:
During preview, the `input` still prompts the user to enter something
that won't be used later, which could be a bit confusing.
e.g., `:s/a/\=input("")`.

Solution:
Make the input() return early during 'inccommand' preview.
2025-08-11 15:39:03 -07:00
Sergei Slipchenko
bc4bddbb21 fix: don't use logical diagnostic position in get_prev and get_next #35282
Problem: `vim.diagnostic.get_prev()` / `vim.diagnostic.get_next()` use
logical diagnostic positions and consider extmark validity.
`vim.diagnostic.get()` only uses original positions and doesn't care
about extmark validity. This results in inconsistency between these
APIs.

Solution: use original positions in `vim.diagnostic.get_prev()` and
`vim.diagnostic.get_next()` and don't consider extmark validity to match
previous behavior, which is consistent with `vim.diagnostic.get`.
2025-08-11 15:34:29 -07:00
Justin M. Keyes
3c7b698d61 Merge #35270 vim.pack: more control over "load" behavior 2025-08-11 18:20:25 -04:00
Shashwat Agrawal
67fede0fc9 fix(gen_help_html): ASCII art rendering in docs #35262
Problem:
gen_help_html.lua script misinterprets parts of ASCII diagrams as help tags
(e.g., `|_________|` in `usr_28.txt`). This incorrectly triggered
special alignment-fixing logic that is meant for columnar text.

Signed-off-by: Shashwat Agrawal <shashwatagrawal473@gmail.com>
2025-08-11 14:37:26 -07:00
skewb1k
7cc07e8383 feat(lsp): support signature help noActiveParameterSupport #34838 2025-08-11 14:31:57 -07:00
luukvbaal
be5a4851ea fix(extui): ensure temporary cmdline config is not restored #35301
Problem:  Temporary cmdline config is saved to be restored later.
Solution: Close the cmdline window so that it is recreated with the appropriate config.
2025-08-11 14:13:39 -07:00
Maria José Solano
f7802dd5d5 fix(lsp): deprecate vim.lsp.set_log_level, vim.lsp.get_log_path #35274 2025-08-11 13:51:40 -07:00
dependabot[bot]
b52f9a19b3 ci: bump actions/checkout from 4 to 5 #35305
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-11 13:43:53 -07:00
Riley Bruins
09f2c8d8ed docs(lsp): specify formatting_options type (#35302) 2025-08-11 14:36:35 -04:00
Maria José Solano
e94d8f03b9 fix(lsp): check for lens range in vim.lsp.codelens.run() (#35294) 2025-08-11 12:37:32 -04:00
zeertzjq
e3fd906b61 Merge pull request #35283 from janlazo/vim-8.1.0636
vim-patch:8.1.{636,1681,1700,1711},8.2.0115
2025-08-11 13:48:00 +08:00
Jan Edmund Lazo
7048c36ba8 vim-patch:8.2.0115: byte2line() does not work correctly with text properties
Problem:    Byte2line() does not work correctly with text properties. (Billie
            Cleek)
Solution:   Take the bytes of the text properties into account.
            (closes vim/vim#5334)

9df53b62de

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-11 01:06:42 -04:00
Jan Edmund Lazo
750c350be8 vim-patch:8.1.1711: listener callback called at the wrong moment
Problem:    Listener callback called at the wrong moment
Solution:   Invoke listeners before calling ml_delete_int(). (closes vim/vim#4657)

acf7544cf6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-10 23:35:10 -04:00
Jan Edmund Lazo
c9b35360ac vim-patch:8.1.1700: listener callback called for the wrong buffer
Problem:    Listener callback called for the wrong buffer.
Solution:   Invoke listeners before calling ml_append_int().

250e3112c6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-10 23:35:10 -04:00
Jan Edmund Lazo
83f38800e7 vim-patch:8.1.1681: insert stray "{" when listener gets buffer line
Problem:    Insert stray "{" when listener gets buffer line. (Paul Jolly)
Solution:   Flush the cached line after invoking listeners. (closes vim/vim#4455)

0fb286e82d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-10 22:22:44 -04:00
Jan Edmund Lazo
36fc266e86 vim-patch:8.1.0636: line2byte() gives wrong values with text properties
Problem:    line2byte() gives wrong values with text properties. (Bjorn Linse)
Solution:   Compute byte offsets differently when text properties were added.
            (closes vim/vim#3718)

b413d2e6a8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-10 22:22:44 -04:00
zeertzjq
03c953008c vim-patch:32d6bd6: runtime(doc): remove dead links (#35297)
related: vim/vim#17879

32d6bd6df2

N/A patch:
vim-patch:8b18345: runtime(doc): Fix 2 minor issues after 32d6bd6df

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-08-11 00:04:30 +00:00
zeertzjq
d2cdfc413b Merge pull request #35296 from zeertzjq/vim-7270a5a
vim-patch: runtime file updates
2025-08-11 07:23:43 +08:00
zeertzjq
39af96c8ef vim-patch:a94a055: runtime(python): Highlight f-string replacement fields in Python
Highlight f-string replacement fields, including

- Comments
- Debugging flags
- Conversion fields
- Format specifications
- Delimiters

Syntax inside fields will be addressed in a separate commit.

related: vim/vim#10734
related: vim/vim#14033
closes: vim/vim#17784

a94a0555d9

Co-authored-by: Rob B <github@0x7e.net>
2025-08-11 07:01:27 +08:00
zeertzjq
82a54a772b vim-patch:48b7eb1: runtime(python): Highlight classes as structures
Class and function definitions previously shared a single highlight
group (pythonFunction). This change gives classes their own highlight
group (pythonClass) that's linked to Structure.

closes: vim/vim#17856

48b7eb1ceb

Co-authored-by: Jon Parise <jon@indelible.org>
2025-08-11 07:00:50 +08:00
zeertzjq
d395dc9d38 vim-patch:7270a5a: runtime(racket): update Racket runtime files
This brings the upstream files to commit 9dc3bd3 (ftplugin: escape Vim
special characters when opening docs, 2025-08-09). Note that not all
upstream files are included.

closes: vim/vim#17956

7270a5a843

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2025-08-11 07:00:28 +08:00
Dietrich Moerman
47e3aecb78 vim-patch:9.1.1620: filetype: composer.lock and symfony.lock files not recognized (#35291)
Problem:  filetype: composer.lock and symfony.lock files not recognized
Solution: Detect composer.lock and symfony.lock files as json filetype
          (Dietrich Moerman)

closes: vim/vim#17945

4fca92faa2
2025-08-10 13:42:57 +00:00
zeertzjq
9d85f086d9 vim-patch:9.1.1622: Patch v9.1.1432 causes performance regressions (#35288)
Problem:  Patch v9.1.1432 causes performance regressions
Solution: Revert "patch 9.1.1432: GTK GUI: Buffer menu does not handle
          unicode correctly" (Yee Cheng Chin).

This reverts commit 08896dd330c6dc8324618fde482db968e6f71088.

The previous change to support Unicode characters properly in the
buffers menu resorted to removing all buffer menus and re-add the
buffers after doing a sort, per each buffer addition. This was quite
slow because if Vim is trying to load in multiple buffers at once (e.g.
when loading a session) this scales in O(n^2) and Vim can freeze for
dozens of seconds when adding a few hundred buffers.

related: vim/vim#17405
related: vim/vim#17928
fixes: vim/vim#17897

cda0d17f59

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-08-10 09:11:13 +00:00
zeertzjq
22d90217c6 vim-patch:partial:fc3c204: runtime(doc): Fix style and typos in builtin.txt and usr_41.txt (#35286)
- Reformat parts to fit into 80 column window.
- Fix example with mandatory call with a range.
  https://github.com/vim/vim/discussions/17950#discussioncomment-14055687
- Remove some duplicate information

closes: vim/vim#17949

fc3c204bbe

Function list changes only.

Co-authored-by: veotos <veotos@users.noreply.github.com>
2025-08-10 08:23:48 +00:00
zeertzjq
dae79f2b67 vim-patch:9.1.1619: Incorrect E535 error message (#35285)
Problem:  Incorrect E535 error message (after 9.1.1603).
Solution: Don't use transchar(), as the character is always printable
          (zeertzjq).

closes: vim/vim#17948

b362995430
2025-08-10 16:22:43 +08:00
zeertzjq
f0d8341984 vim-patch:9.1.1618: completion: incorrect selected index returned from complete_info() (#35284)
Problem:  completion: incorrect selected index returned from
          complete_info()
Solution: Return the index into "items" and restore the previous
          behaviour (Robert Muir).

complete_info() returned an incorrect selected index after
0ac1eb3555445f4c458c06cef7c411de1c8d1020 (Patch v9.1.1311). Effectively
it became an index into "matches" instead of "items". Return the index
into "items" by default to restore the previous behavior, unless
"matches" was requested.

closes: vim/vim#17952

8e2a229189

Co-authored-by: Robert Muir <rmuir@apache.org>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-10 16:21:47 +08:00
bfredl
72969f1301 Merge pull request #35263 from bfredl/zig15
fix(build): remove deprecated aliases in build.zig removed for zig 0.15
2025-08-10 09:24:27 +02:00
zeertzjq
74511a98fd Merge pull request #35278 from zeertzjq/vim-9.1.1612
vim-patch:9.1.{1612,1613}
2025-08-10 09:05:41 +08:00
zeertzjq
9e8d551b1e vim-patch:9.1.1613: tests: test_search leaves a few swapfiles behind
Problem:  tests: test_search leaves a few swapfiles behind
Solution: Use :bw! instead of :close to close the swapfile at the end of
          the test.

related: vim/vim#17933

a2bb21a895

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-10 08:25:23 +08:00
zeertzjq
1eca030fb2 vim-patch:9.1.1612: Ctrl-G/Ctrl-T do not ignore the end search delimiter
Problem:  Ctrl-G/Ctrl-T does not ignore the end search delimiter
          (irisjae)
Solution: Check if the pattern ends with a search delimiter and ignore
          it, unless it is part of the pattern.

fixes: vim/vim#17895
closes: vim/vim#17933

c03990d30f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-10 08:24:55 +08:00
zeertzjq
f79430e2ce vim-patch:9.1.1615: diff format erroneously detected (#35276)
Problem:  diff format erroneously detected
          (Tomáš Janoušek)
Solution: Make the regex to detect normal diff format a bit stricter,
          while at it, fix wrong test content from patch v9.1.1606

fixes: vim/vim#17946

887b4981e7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-08-09 23:27:53 +00:00
zeertzjq
77500c5ad5 vim-patch:9.1.1611: possible undefined behaviour in mb_decompose() (#35275)
Problem:  possible undefined behaviour in mb_decompose(), when using the
          same pointer as argument several times
Solution: use separate assignments to avoid reading and writing the same
          object at the same time (Áron Hárnási)

closes: vim/vim#17953

c43a0614d4

Co-authored-by: Áron Hárnási <aron.harnasi@gmail.com>
2025-08-10 07:23:59 +08:00
Evgeni Chasnovski
acff86601e feat(pack): allow skip install confirmation in add()
Problem: No way to skip install confirmation in `add()`. Having install
  confirmation by default is a more secure design. However, users are
  usually aware of the fact that plugin will be installed and there is
  currently no way to skip confirmation.

  Plus it can introduce inconvenience on the clean config initialization
  if it is modularized with many `vim.pack.add()` calls (leads to
  confirming installation many times in a row).

Solution: Add `opts.confirm` option that can skip install confirmation.
2025-08-09 17:54:39 +03:00
Evgeni Chasnovski
dd828690c7 feat(pack): allow function opts.load in add()
Problem: No way to have full control over how plugin is loaded.
  Although `:packadd!` has small side effects (only adds plugin
  directory to 'runtimepath'; and maybe its 'after/' subdirectory), it
  still has side effects. For example, 'plugin/' directories are still
  loaded during startup (as part of `:h load-plugins`).

Solution: Allow function `opts.load` that has full control over how
  plugin is loaded.
2025-08-09 17:36:15 +03:00
Evgeni Chasnovski
b337c6e0fc fix(pack): update add() to have default load=false during startup
Problem: the `load=true` in `vim.pack.add()` means that `:packadd` is
  executed even during startup. This leads to force source of 'plugin/',
  which breaks the intended loading order (`:h load-plugins`) and
  results into sourcing them twice. This also makes it ignore
  `--noplugin` argument.

  Using `:packadd!` during startup is more appropriate, while `:packadd`
  afterwards is still more favorable to actually force 'plugin/' source
  (as there is no pre-defined mechanism that will load them later).

Solution: have `load=false` default during startup, `true` - afterwards.
2025-08-09 17:36:15 +03:00
zeertzjq
e3913c0fc2 vim-patch:9.1.1606: filetype: a few more files are not recognized (#35268)
Problem:  filetype: a few more files are not recognized
Solution: guess Mail, Info and Terminfo files by its content
          (lacygoill)

closes: vim/vim#17880

eb2aebeb79

Co-authored-by: lacygoill <lacygoill@lacygoill.me>
2025-08-09 13:38:20 +00:00
zeertzjq
f7e8efd2e9 Merge pull request #35267 from zeertzjq/vim-7132935
vim-patch: runtime updates
2025-08-09 21:31:26 +08:00
zeertzjq
7a07454867 vim-patch:3be4ad7: runtime(optwin): Fix E94 when searching for the option-window
Problem:  When the parameter debug=msg is set and the command :option is
          entered, error E94 will be displayed.
Solution: Add a check for the existence of the buffer before getting the
          buffer number “option-window”.

Reproduce:

vim --clean -c "set debug=msg" -c "option"

    Error detected while processing command line..script D:\Programs\Vim\vim91\optwin.vim:
    line 9: E94: No matching buffer for option-window

closes: vim/vim#17927

3be4ad76df

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2025-08-09 21:04:28 +08:00
zeertzjq
acc55f6fed vim-patch:7132935: runtime(java): Manage byte limits for variable-width lookbehind assertions
Raise the byte limits from 80 to 120 for "javaFuncDef" and
"java*CommentTitle"; and support selecting other arbitrary
values with
------------------------------------------------------------
	let g:java_lookbehind_byte_counts = {
		\ 'javaMarkdownCommentTitle': 240,
	\ }
------------------------------------------------------------

for related groups of syntax definitions, referring to their
names with dictionary keys.

Over-80-Byte-Limit Lookbehind Examples:
https://raw.githubusercontent.com/openjdk/jdk/refs/tags/jdk-24%2B36/src/java.base/share/classes/sun/security/x509/NamedX509Key.java [Lines 43 & 44]
https://raw.githubusercontent.com/openjdk/jdk/refs/tags/jdk-24%2B36/src/jdk.compiler/share/classes/com/sun/tools/javac/util/GraphUtils.java [Line 154]

closes: vim/vim#17921

7132935413

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-08-09 21:03:56 +08:00
bfredl
a2b0be19bf fix(build): remove deprecated aliases in build.zig removed for zig 0.15
This makes the zig build compatible with the upcoming zig 0.15 release,
while still supporting the current stable 0.14 release still used in CI.
2025-08-09 12:02:07 +02:00
zeertzjq
2c3929624a Merge pull request #35260 from zeertzjq/vim-9.1.1603
vim-patch:9.1.{1603,1609}
2025-08-09 11:20:35 +08:00
zeertzjq
5f23aaba00 vim-patch:9.1.1609: complete: Heap-buffer overflow with complete function
Problem:  complete: Heap-buffer overflow with complete function
          (zeertzjq)
Solution: Do not let startcol become negative (Girish Palya).

fixes: vim/vim#17907
closes: vim/vim#17934

761ea77670

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-09 10:58:51 +08:00
zeertzjq
b1e35cbd7b vim-patch:9.1.1603: completion: cannot use autoloaded funcs in 'complete' F{func}
Problem:  completion: cannot use autoloaded funcs in 'complete' F{func}
          (Maxim Kim)
Solution: Make it work (Girish Palya)

fixes: vim/vim#17869
closes: vim/vim#17885

1bfe86a7d3

Cherry-pick Test_omni_autoload() from patch 8.2.3223.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-09 10:58:51 +08:00
Mathias Fußenegger
1968029003 fix(snippet): sync tabstop text also if pmenu is visible (#35250)
Using a snippet like:

    ${1:name} :: ${2}\n${1:name} ${3}= ${4:undefined}${0}

The text for `${1:name}` stopped syncing if the completion popup menu
showed up. E.g. typing `par` where the `a` triggered completion resulted
in:

    pat ::
    pa = undefined

Instead of:

    pat ::
    pat = undefined
2025-08-08 18:56:54 -07:00
zeertzjq
fa92a0b9fe fix(cmdline): completion for command after :restart (#35256) 2025-08-09 01:25:14 +00:00
zeertzjq
5977bdba05 fix(cmdline): trigger CmdlineChanged after command preview (#35254) 2025-08-09 01:16:13 +00:00
zeertzjq
b2828af5b5 Merge pull request #35252 from zeertzjq/vim-9.1.1608
vim-patch:9.1.{0748,1608}
2025-08-09 08:25:09 +08:00
zeertzjq
fe42c81f2e vim-patch:9.1.1608: No command-line completion for :unsilent {command}
Problem:  No command-line completion for :unsilent {command}.
Solution: Add missing command arg completion (Doug Kearns).
          (author)

Add completion tests for all command modifiers.

closes: vim/vim#17524

126731c8fd

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-08-09 08:03:25 +08:00
zeertzjq
70bb7999f7 vim-patch:9.1.0748: :keep* commmands are sometimes misidentified as :k
Problem:  The :keep{alt,jumps,marks,patterns} commmands are sometimes
          misidentified as :k.
Solution: Make sure one_letter_cmd() only returns true for :k and not
          other :keep* commands (Doug Kearns).

This currently manifests as missing completion for :keep* commands and
incorrect results from fullcommand().

E.g., fullcommand("keepmarks") returns "k" rather than "keepmarks".

The correct command, however, is executed as command modifiers are
handled specially in do_one_cmd() rather than using find_ex_command().

Fix exists(':k') so that it returns 2 for a full match.

closes: vim/vim#15742

ea84202372

Cherry-pick Test_ex_command_completion() from patch 9.1.0624.

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-08-09 08:03:25 +08:00
Gregory Anders
a0d94ac469 docs(lsp): add reference to progress indicator protocol (#35215) 2025-08-08 09:59:14 -05:00
zeertzjq
1969f685af vim-patch:9.1.1610: completion: hang or E684 when 'tagfunc' calls complete() (#35243)
Problem:  completion: hang (after 9.1.1471) or E684 (after 9.1.1410)
          when 'tagfunc' calls complete().
Solution: Check if complete() has been called immediately after getting
          matches instead of in the next loop iteration (zeertzjq).

related: vim/vim#1668
related: neovim/neovim#34416
related: neovim/neovim#35163
closes: vim/vim#17929

982cda6976
2025-08-08 14:40:56 +00:00
zeertzjq
e7dfbf1343 vim-patch:9.1.1607: :apple command detected as :append (#35237)
Problem:  :apple command detected as :append (dai475694450)
Solution: Disallow to define a custom command with lower-case letter,
          correctly detect :insert/:change/:append ex commands
          (Hirohito Higashi).

fixes: vim/vim#17893
closes: vim/vim#17930

efd83d441b

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-08 13:58:55 +00:00
zeertzjq
798cb0f19a vim-patch:9.1.1605: cannot specify scope for chdir() (#35239)
Problem:  Cannot specify scope for chdir()
Solution: Add optional scope argument (kuuote)

closes: vim/vim#17888

8a65a49d50

Co-authored-by: kuuote <znmxodq1@gmail.com>
2025-08-08 13:50:41 +00:00
zeertzjq
36361d6e4a vim-patch:9.1.1604: completion: incsearch highlight might be lost (#35236)
Problem:  completion: incsearch highlight might be lost after search
          completion (Hirohito Higashi)
Solution: Restore incsearch highlight after dismissing pum with Ctrl-E
          (Girish Palya)

related: vim/vim#17870
closes: vim/vim#17891

04c9e78cd3

This change actually isn't needed as Nvim doesn't call update_screen()
to redraw pum, but it doesn't hurt either.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-08 13:18:21 +00:00
zeertzjq
75d38bb844 vim-patch:d82c918: runtime(doc): Improve doc for cmdline-autocomplete (#35235)
Maybe this was unnecessary, but saw this:
https://github.com/vim/vim/issues/17854

d82c918e2f

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-08 21:01:54 +08:00
Gregory Anders
b1679f0ab6 fix(tui): do not remove SIGWINCH handler when resize events are enabled (#35221)
When Nvim is started in one terminal emulator,
suspended, and later resumed in a different terminal emulator (as can
happen when using e.g. a multiplexer), the new terminal emulator will
not have all of the same modes enabled that the original terminal
emulator had. This is a problem in particular for in-band resize events
because we were disabling the SIGWINCH signal handler when we determined
that the terminal supported this mode.

However, if the new terminal does not support this mode then the
SIGWINCH handler remains disabled, and Neovim no longer properly
resizes. Instead of disabling the SIGWINCH handler, we track the state
of the resize events mode internally. If the mode is enabled then we
return early from the SIGWINCH handler before performing any ioctls or
other system calls. But if the mode is not enabled we proceed as normal.
2025-08-08 07:51:22 -05:00
Phạm Bình An
69cc16d917 vim-patch:adfea9b: runtime(help): Unset 'comments' and 'cms' options (#35232)
Problem:  Vim's help file doesn't have any syntax for comments, but
          'comments' and 'commentstring' are still set in the help
          buffer.
Solution: Unset 'comments' and 'cms' in help buffer

closes: vim/vim#17889

adfea9b4e6
2025-08-08 09:31:47 +00:00
Christian Clason
ffeb334da0 vim-patch:66d8d28: runtime(typescript): Add syntax support for defer and arbitrary module identifiers
closes: vim/vim#17911

66d8d286cd

Co-authored-by: rhysd <lin90162@yahoo.co.jp>
2025-08-08 10:57:07 +02:00
Christian Clason
62f2b10db3 vim-patch:9.1.1602: filetype: requirements-*.txt files are not recognized
Problem:  filetype: requirements-*.txt files are not recognized
Solution: Detect requirements-*.txt files as requirements filetype
          (Xudong Zheng).

References:
- https://github.com/search?q=path%3Arequirements-*.txt&type=code
- https://github.com/zephyrproject-rtos/zephyr/tree/v4.2.0/scripts

closes: vim/vim#17894

d305729bc5

Co-authored-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-08-08 10:23:45 +02:00
Maria José Solano
9139c4f90f fix(lsp): update capability maps (#35227) 2025-08-07 19:33:52 -07:00
zeertzjq
038eb01b41 Merge pull request #35225 from zeertzjq/vim-8.1.0425
vim-patch:{8.1.0425,9.1.1601}
2025-08-08 07:42:34 +08:00
zeertzjq
7230296bdb vim-patch:9.1.1601: Patch v8.1.0425 was wrong
Problem:  Patch v8.1.0425 was wrong
Solution: Revert that patch (Hirohito Higashi)

This is because the root cause was fixed in 8.1.0786 and a regression
occurred elsewhere.

related: vim/vim#3455
related: vim/vim#3830
fixes: vim/vim#11558
closes: vim/vim#17899

6abe5e4904

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-08 06:49:22 +08:00
zeertzjq
c6f0a19206 vim-patch:8.1.0425: ml_get error and crash with appendbufline()
Problem:    ml_get error and crash with appendbufline(). (Masashi Iizuka)
Solution:   Set per-window buffer info. (Hirohito Higashi, closes vim/vim#3455)

9cea87c577

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-08 06:49:22 +08:00
zeertzjq
53ac2ad20a vim-patch:9.1.1599: :bnext doesn't go to unlisted help buffers (#35216)
Problem:  :bnext doesn't go to unlisted help buffers when cycling
          through help buffers (after 9.1.0557).
Solution: Don't check if a help buffer is listed (zeertzjq).

From <https://github.com/vim/vim/issues/4478#issuecomment-498831057>:

> I think we should fix that, since once you get to a non-help buffer
> all unlisted buffers are skipped, thus you won't encounter another
> help buffer.

This implies that cycling through help buffers should work even if help
buffers are unlisted. Otherwise this part of :bnext isn't really useful,
as :h makes help buffers unlisted by default.

related: vim/vim#4478
related: vim/vim#15198
closes: vim/vim#17913

9662f33480
2025-08-07 15:57:55 +00:00
zeertzjq
52c2519095 vim-patch:9.1.1600: using diff anchors with hidden buffers fails silently (#35218)
Problem:  diff: using diff anchors with hidden buffers fails silently
Solution: Give specific error message for diff anchors when using hidden
          buffers (Yee Cheng Chin).

Diff anchors currently will fail to parse if a buffer used for diff'ing
is hidden. Previously it would just fail as the code assumes it would
not happen normally, but this is actually possible to do if `closeoff`
and `hideoff` are not set in diffopt. Git's default diff tool "vimdiff3"
also takes advantage of this.

This fix this properly would require the `{address}` parser to be
smarter about whether a particular address relies on window position or
not (e.g. the `'.` address requires an active window, but `'a` or `1234`
do not). Since hidden diff buffers seem relatively niche, just provide a
better error message / documentation for now. This could be improved
later if there's a demand for it.

related: vim/vim#17615
closes: vim/vim#17904

cad3b2421d

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-08-07 15:56:10 +00:00
Christian Clason
d994be44d7 vim-patch:93f6454: runtime(openscad): add a filetype plugin
closes: vim/vim#17902

93f6454724

Co-authored-by: Squibid <me@zacharyscheiman.com>
2025-08-07 17:16:22 +02:00
Christian Clason
6502dd43c4 vim-patch:589aa28: runtime(javascript): add "as" as a reserved keyword to syntax script
closes: vim/vim#17912

589aa284f6

Co-authored-by: Nir Lichtman <nir@lichtman.org>
2025-08-07 17:10:44 +02:00
Christian Clason
1f7ab25915 vim-patch:9.1.1598: filetype: waybar config file is not recognized
Problem:  filetype: waybar config file is not recognized
Solution: Detect */waybar/config file as jsonc filetype
          (Furkan Sahin)

closes: vim/vim#17915

a6e28b1d05

Co-authored-by: Furkan Sahin <furkan-dev@proton.me>
2025-08-07 16:35:48 +02:00
zeertzjq
7dbf347dda vim-patch:9c4de84: runtime(doc): Update ft-vim-syntax documentation (#35212)
g:vimsyn_folding and g:vimsyn_embed regexps need to match case.

closes: vim/vim#17914

9c4de84b2d

Co-authored-by: veotos <veotos@users.noreply.github.com>
2025-08-07 22:31:18 +08:00
zeertzjq
5aaee7d2af vim-patch:9.1.1596: tests: Test_search_wildmenu_iminsert() depends on help file (#35210)
Problem:  tests: Test_search_wildmenu_iminsert() depends on help file
          (after 9.1.1594).
Solution: Set buffer text using setline() instead of loading help file.
          Add a test for another bug fixed by 9.1.1594 (zeertzjq).

related: vim/vim#17870
closes: vim/vim#17922

615ad4ced1
2025-08-07 13:38:45 +00:00
zeertzjq
e12bfb4c70 vim-patch:54fb7ba: runtime(doc): remove mentioning of netrwSettings.vim (#35209)
closes: vim/vim#17925

54fb7ba256

Co-authored-by: Lane East <laneast@laneast.com>
2025-08-07 13:30:38 +00:00
zeertzjq
5f9f706462 fix(ui): check for cmdline mode properly (#35202) 2025-08-07 04:22:01 +00:00
github-actions[bot]
c47a69c1a6 docs: update version.c #35024
vim-patch:8.1.0710: when using timers may wait for job exit quite long
vim-patch:8.1.0969: message written during startup is truncated
vim-patch:8.1.1043: Lua interface does not support Blob
vim-patch:8.1.1389: changes are not flushed when end and start overlap
vim-patch:8.1.1395: saving for undo may access invalid memory
vim-patch:8.1.1534: modeless selection in popup window selects too much
vim-patch:8.1.1571: textprop highlight starts too early if just after a tab
vim-patch:8.1.1573: textprop test fails if screenhots do not work
vim-patch:8.1.1663: compiler warning for using size_t
vim-patch:8.1.1866: modeless selection in GUI does not work properly
vim-patch:8.1.1871: modeless selection in GUI still not correct
vim-patch:8.1.2085: MS-Windows: draw error moving cursor over double-cell char
vim-patch:8.1.2107: various memory leaks reported by asan
vim-patch:8.1.2146: build failure
vim-patch:8.1.2296: text properties are not combined with syntax by default
vim-patch:8.1.2299: ConPTY in MS-Windows 1909 is still wrong
vim-patch:8.1.2337: double-click time sometimes miscomputed

vim-patch:8.2.0300: Vim9: expression test fails without channel support
vim-patch:8.2.0414: channel connect_waittime() test is flaky
vim-patch:8.2.0501: Vim9: script test fails when channel feature is missing
vim-patch:8.2.0508: Vim9: func and partial types not done yet
vim-patch:8.2.0527: Vim9: function types insufficiently tested
vim-patch:8.2.0565: Vim9: tests contain superfluous line continuation
vim-patch:8.2.0640: Vim9: expanding  does not work
vim-patch:8.2.0700: Vim9: converting error message to exception not tested
vim-patch:8.2.0701: Vim9 test fails without job feature
vim-patch:8.2.1481: Vim9: line number reported with error may be wrong
vim-patch:8.2.1609: Vim9: test fails when build without +channel
vim-patch:8.2.1724: Vim9: assignment tests spread out
vim-patch:8.2.1759: Vim9: Some tests are still using :let
vim-patch:8.2.1865: Vim9: add() does not check type of argument
vim-patch:8.2.1867: Vim9: argument to add() not checked for blob
vim-patch:8.2.1965: Vim9: tests fail without the channel feature
vim-patch:8.2.2301: Vim9: cannot unlet a dict or list item
vim-patch:8.2.2304: Vim9: no test for unletting an imported variable
vim-patch:8.2.3006: crash when echoing a value very early
vim-patch:8.2.3007: Vim9: test for void value fails
vim-patch:8.2.3008: startup test may hang
vim-patch:8.2.3009: startup test may hang
vim-patch:8.2.3181: Vim9: builtin function test fails without channel feature
vim-patch:8.2.3242: Vim9: valgrind reports leaks in builtin function test
vim-patch:8.2.3382: crash when getting the type of a NULL partial
vim-patch:8.2.3845: Vim9: test fails when the channel feature is missing
vim-patch:8.2.4407: Vim9: some code not covered by tests
vim-patch:8.2.4410: Vim9: some code not covered by tests

vim-patch:9.0.0563: timer_info() test fails
vim-patch:9.0.2080: vim9_script test too large

vim-patch:9.1.1541: Vim9: error when last enum value ends with a comma
2025-08-06 20:26:50 -07:00
skewb1k
d26db4bfbf feat(lsp): improve signature help display #35190
- Add delimiter between function signature and documentation, matching hover formatting
- Show title only if there are multiple clients or multiple signatures
- Avoid duplicating the title inside the window if it's already shown in the border
2025-08-06 19:56:02 -07:00
skewb1k
d73f2d9657 build(emmyrc.json): use StyLua formatter in .emmyrc.json #35196 2025-08-06 19:52:46 -07:00
dependabot[bot]
c04e40d9f4 ci: bump actions/download-artifact from 4 to 5 (#35188)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 19:30:34 -07:00
zeertzjq
e40199c6c6 vim-patch:9.1.1594: completion: search completion throws errors (#35198)
Problem:  completion: search completion throws errors, wrong placement
          of pum menu with 'imi'=1 (berggeist)
Solution: Fix those errors (Girish Palya)

fixes: vim/vim#17858
closes: vim/vim#17870

66467cf5d8

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-06 23:56:58 +00:00
zeertzjq
c46641fea1 Merge pull request #35197 from zeertzjq/vim-bb0860a
vim-patch: doc updates
2025-08-07 07:15:25 +08:00
zeertzjq
654cde369d vim-patch:f7deb81: runtime(doc): fix typo at :h cmdline-autocompletion
The '?' needs to be escaped, because the autocommand is using
file-patterns (glob like) and not a regex). See :h file-pattern

closes: vim/vim#17890

f7deb815b0

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-07 06:33:51 +08:00
zeertzjq
cc25cd2cb7 vim-patch:bb0860a: runtime(doc): tweak option name notation further
related: vim/vim#17857
closes: vim/vim#17917

bb0860abc9

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-07 06:33:21 +08:00
bfredl
bc0b3f271c Merge pull request #35129 from bfredl/nopreproc
refactor(build): don't use the preprocessor when generating headers
2025-08-06 21:58:20 +02:00
glepnir
5b1b46ea5a fix(lsp): show title when global winborder is set (#35181)
Problem: make_floating_popup_options only shows when opts.border is explicitly set, ignoring global winborder setting

Solution: check both opts.border and vim.o.winborder when determining whether to show title
2025-08-06 08:25:55 -05:00
bfredl
79c8159f41 refactor(build): don't use the preprocessor when generating headers
Using the preprocessor before generating prototypes provides some
"niceties" but the places that rely on these are pretty few.
Vastly simplifying the BUILD SYSTEM is a better trade-off.

Unbalancing { } blocks due to the preprocessor is cringe anyway (think
of the tree-sitter trees!), write these in a different way.

Add some workarounds for plattform specific features.

INCLUDE_GENERATED_DECLARATIONS flag is now technically redundant,
but will be cleaned up in a follow-up PR as it is a big mess.
2025-08-06 15:10:25 +02:00
zeertzjq
b4c092a092 Merge pull request #35187 from zeertzjq/vim-85cd509
vim-patch: doc updates
2025-08-06 20:51:14 +08:00
Gregory Anders
851a622806 docs(lsp): include snippet to display progress using native indicator (#35176) 2025-08-06 07:31:02 -05:00
zeertzjq
5b3606b2c4 vim-patch:067adc1: runtime(doc): add back bars for the '' mark
this was erroneously changed in commit
85cd509885a05c3a6bb029fb378b1295f107f8f6

related: vim/vim#17857

067adc1ff2
2025-08-06 20:25:29 +08:00
zeertzjq
60dca47ae4 vim-patch:85cd509: runtime(doc): Use correct option-name tags
closes: vim/vim#17857

85cd509885

Omit 'completepopup' and v:colornames.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-06 20:25:29 +08:00
zeertzjq
a3921d2be6 vim-patch:3769100: runtime(doc): fix mismatch between 'backspace' and |i_backspacing| (#35185)
closes: vim/vim#17867

3769100a8e

Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-08-06 11:41:43 +00:00
zeertzjq
72d3ffd716 vim-patch:a7a2a2b: runtime(doc): Tweak documentation style (#35184)
closes: vim/vim#17862

a7a2a2b5ae

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-08-06 10:52:53 +00:00
zeertzjq
0fa81578af Merge pull request #35174 from janlazo/vim-8.2.0512
vim-patch:8.2.{307,512,1123,1555,1912,3602},9.0.1689
2025-08-06 14:19:53 +08:00
Jan Edmund Lazo
b869cf8ddc vim-patch:9.0.1689: python 3.12 produces warnings and fails test
Problem: python 3.12 produces warnings and fails test
Solution: Make use of raw strings in python3 tests

closes: vim/vim#12765

288bf26c53

Co-authored-by: Zdenek Dohnal <zdohnal@redhat.com>
2025-08-06 01:09:05 -04:00
Jan Edmund Lazo
cba2f65ee4 vim-patch:8.2.3602: Python3 test fails with Python 3.10 on MS-Windows
Problem:    Python3 test fails with Python 3.10 on MS-Windows.
Solution:   Adjust the expected error. (Ken Takata, closes vim/vim#9118)

1be7e21583

Co-authored-by: K.Takata <kentkt@csc.jp>
2025-08-06 01:07:11 -04:00
skewb1k
820fb89172 fix(lsp): make thematic break parsing conform to GFM spec (#35162)
- Support for '_' and '*' as delimiters
- Allow spaces between delimiters
- Use more efficient implementation
2025-08-05 16:34:14 -04:00
Jan Edmund Lazo
7ae8860674 vim-patch:8.2.1912: with Python 3.9 some tests fail
Problem:    With Python 3.9 some tests fail.
Solution:   Take into account the different error message. (James McCoy,
            closes vim/vim#7210)

68a48ee55e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:59 -04:00
Jan Edmund Lazo
b95413f601 vim-patch:8.2.1555: not all tests are executed on Github Actions
Problem:    Not all tests are executed on Github Actions.
Solution:   Copy "src" to "src2" earlier. Recognize "src2" in a couple more
            places.  Add two tests to the list of flaky tests. (Ken Takata,
            closes vim/vim#6798)

7d6979608e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:52 -04:00
Jan Edmund Lazo
474c477134 vim-patch:8.2.1123: Python 3 test is old style
Problem:    Python 3 test is old style.
Solution:   Turn into new style test. (Yegappan Lakshmanan, closes vim/vim#6385)

effb0cd75d

Neovim has Lua context that conflict with asserted error message.
Disable incompatible tests due to unsupported features from
python3 provider (ie. LegacyVim bindings, vim.bindeval).

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:44 -04:00
Jan Edmund Lazo
d632ffa243 vim-patch:8.2.0307: Python 3 vim.eval not well tested
Problem:    Python 3 vim.eval not well tested.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#5680)

026270c01d

Amend float values to pass on Ubuntu.
Comment out failing cases (ie. v:none, blob).

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:10 -04:00
Jan Edmund Lazo
2a267d1cbf vim-patch:partial:8.2.1328: no space allowed before comma in list
Problem:    No space allowed before comma in list.
Solution:   Legacy Vim script allows it. (closes vim/vim#6577)

4d4d1cd5c8

Partial port to guard against v8.2.1326 regression.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:33:03 -04:00
Jan Edmund Lazo
758e6db06c vim-patch:8.2.0512: Vim9: no optional arguments in func type
Problem:    Vim9: no optional arguments in func type.
Solution:   Check for question mark after type.  Find function reference
            without function().

5deeb3f1f9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-05 13:32:03 -04:00
Maria José Solano
a9a4c271b1 revert(lsp): compare to vim.NIL in lsp/buf.lua (#35156)
revert(lsp): "compare to `vim.NIL` in `lsp/buf.lua` #35154"

This reverts commit a5c598871b.
2025-08-03 18:20:17 -07:00
Maria José Solano
a5c598871b fix(lsp): compare to vim.NIL in lsp/buf.lua #35154 2025-08-03 15:39:49 -07:00
Maria José Solano
54bfd0de4f docs(lsp): mention default enablement of document colors (#35153) 2025-08-03 15:03:14 -07:00
Maria José Solano
c789d79966 fix(lsp): check if buffer is valid when resolving code lenses (#35092) 2025-08-03 14:11:18 -07:00
TheBlob42
ecded994c1 fix(snippet): early return for final tabstop #35115
The cursor movement autocommand can not detect when the final tabstop $0
is directly adjacent to another tabstop, which prevents ending the
snippet session. The fix is an early return when jumping.
2025-08-03 19:52:09 +00:00
Yi Ming
7ed8cbd095 feat(lua): vim.list.bisect() #35108 2025-08-03 07:45:49 -07:00
skewb1k
40aef0d02e fix(lsp): decode 'null' in server responses as vim.NIL #34849
Problem:
Previously, 'null' value in LSP responses were decoded as 'nil'.
This caused ambiguity for fields typed as '? | null' and led to
loss of explicit 'null' values, particularly in 'data' parameters.

Solution:
Decode all JSON 'null' values as 'vim.NIL' and adjust handling
where needed. This better aligns with the LSP specification,
where 'null' and absent fields are distinct, and 'null' should
not be used to represent missing values.

This also enables proper validation of response messages to
ensure that exactly one of 'result' or 'error' is present, as
required by the JSON-RPC specification.
2025-08-03 07:42:44 -07:00
bfredl
2ef48fc65c Merge pull request #35130 from bfredl/cringe
fix(options): make 'cdhome' take effect on any platform
2025-08-03 10:19:11 +02:00
bfredl
9910445125 fix(options): make 'cdhome' take effect on any platform
Platform specific options are cringe and should either be fixed or
deleted.

In this case, the platform difference can trivially be implemented
using a conditional default value. If the user overrides the value,
then it is because the user wants that value, regardless of the
corporation who manufactured the OS that the user is running.

Possible alternative: delete the option by making it always on.
2025-08-03 09:42:35 +02:00
Sathya Pramodh
78f4994627 feat: ":restart [cmd]" can run commands #35045
Problem:
Not easy for a user to tell ":restart" to "run this command(s) after restarting".

Solution:
All ":restart" args following the optional +cmd arg are treated as a big cmdline that is passed as a "-c" CLI arg when restarting nvim.
2025-08-02 22:50:45 -07:00
Justin M. Keyes
39e402caa5 docs: reorder sections #35140
Problem:
Generated docs sections are ordered randomly. This matters when showing
an outline or table of contents (e.g. `gO`).

Solution:
Specify which sections have an intentional ordering; sort the rest by
name.
2025-08-03 05:03:09 +00:00
zeertzjq
e23794b090 vim-patch:3add0d5: runtime(ccomplete): use complete_check() in ccomplete plugin (#35142)
Add complete_check() to ccomplete completion script to avoid UI hangs
and keep Vim responsive as ccomplete can be slow on huge files.

closes: vim/vim#17826

3add0d5e75

vim-patch:44309b9: runtime(ccomplete): return partial results on complete_check()

closes: vim/vim#17838

44309b9d08

Co-authored-by: Maxim Kim <habamax@gmail.com>
2025-08-03 11:49:13 +08:00
zeertzjq
f7af0cff35 vim-patch:9.1.1590: cannot perform autocompletion (#35141)
Problem:  cannot perform autocompletion
Solution: Add the 'autocomplete' option value
          (Girish Palya)

This change introduces the 'autocomplete' ('ac') boolean option to
enable automatic popup menu completion during insert mode. When enabled,
Vim shows a completion menu as you type, similar to pressing |i\_CTRL-N|
manually. The items are collected from sources defined in the
'complete' option.

To ensure responsiveness, this feature uses a time-sliced strategy:

- Sources earlier in the 'complete' list are given more time.
- If a source exceeds its allocated timeout, it is interrupted.
- The next source is then started with a reduced timeout (exponentially
  decayed).
- A small minimum ensures every source still gets a brief chance to
  contribute.

The feature is fully compatible with other |i_CTRL-X| completion modes,
which can temporarily suspend automatic completion when triggered.

See :help 'autocomplete' and :help ins-autocompletion for more details.

To try it out, use :set ac

You should see a popup menu appear automatically with suggestions. This
works seamlessly across:

- Large files (multi-gigabyte size)
- Massive codebases (:argadd thousands of .c or .h files)
- Large dictionaries via the `k` option
- Slow or blocking LSP servers or user-defined 'completefunc'

Despite potential slowness in sources, the menu remains fast,
responsive, and useful.

Compatibility: This mode is fully compatible with existing completion
methods. You can still invoke any CTRL-X based completion (e.g.,
CTRL-X CTRL-F for filenames) at any time (CTRL-X temporarily
suspends 'autocomplete'). To specifically use i_CTRL-N, dismiss the
current popup by pressing CTRL-E first.

---

How it works

To keep completion snappy under all conditions, autocompletion uses a
decaying time-sliced algorithm:

- Starts with an initial timeout (80ms).
- If a source does not complete within the timeout, it's interrupted and
  the timeout is halved for the next source.
- This continues recursively until a minimum timeout (5ms) is reached.
- All sources are given a chance, but slower ones are de-prioritized
  quickly.

Most of the time, matches are computed well within the initial window.

---

Implementation details

- Completion logic is mostly triggered in `edit.c` and handled in
  insexpand.c.

- Uses existing inc_compl_check_keys() mechanism, so no new polling
  hooks are needed.

- The completion system already checks for user input periodically; it
  now also checks for timer expiry.

---

Design notes

- The menu doesn't continuously update after it's shown to prevent
  visual distraction (due to resizing) and ensure the internal list
  stays synchronized with the displayed menu.

- The 'complete' option determines priority—sources listed earlier get
  more time.

- The exponential time-decay mechanism prevents indefinite collection,
  contributing to low CPU usage and a minimal memory footprint.

- Timeout values are intentionally not configurable—this system is
  optimized to "just work" out of the box. If autocompletion feels slow,
  it typically indicates a deeper performance bottleneck (e.g., a slow
  custom function not using `complete_check()`) rather than a
  configuration issue.

---

Performance

Based on testing, the total roundtrip time for completion is generally
under 200ms. For common usage, it often responds in under 50ms on an
average laptop, which falls within the "feels instantaneous" category
(sub-100ms) for perceived user experience.

| Upper Bound (ms) | Perceived UX
|----------------- |-------------
| <100 ms          | Excellent; instantaneous
| <200 ms          | Good; snappy
| >300 ms          | Noticeable lag
| >500 ms          | Sluggish/Broken

---

Why this belongs in core:

- Minimal and focused implementation, tightly integrated with existing
  Insert-mode completion logic.
- Zero reliance on autocommands and external scripting.
- Makes full use of Vim’s highly composable 'complete' infrastructure
  while avoiding the complexity of plugin-based solutions.
- Gives users C native autocompletion with excellent responsiveness and
  no configuration overhead.
- Adds a key UX functionality in a simple, performant, and Vim-like way.

closes: vim/vim#17812

af9a7a04f1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-08-03 11:48:42 +08:00
Maria José Solano
26cc42e426 fix(lsp): handle nil response in references request #35139 2025-08-02 19:58:58 -07:00
glepnir
22df649210 fix(api): nvim_create_user_command addr option should allow ranges #35077
Problem: Using `addr` without `range` in nvim_create_user_command gives
"No range allowed" error, inconsistent with `:command -addr` behavior.

Solution: Set EX_RANGE flag when `addr` option is specified to match
`:command` behavior.
2025-08-02 19:52:54 -07:00
Justin M. Keyes
93f5bd0caf Merge #35052 test(pack): vim.pack 2025-08-02 19:35:42 -04:00
Phạm Bình An
3f416ef524 build: bump lua-bitop to 1.0.3 #35063
Source: https://bitop.luajit.org/download.html
2025-08-02 15:58:11 -07:00
Evgeni Chasnovski
6e27200901 test(pack): add vim.pack tests 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
52a596b0aa ci: enable integration tests on Release builds 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
2e62f3576f fix(pack): open confirmation buffer in tabpage after the current one 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
d3bea4ace9 fix(pack): ensure consistent order of changelog during update
Problem: Left (`<` prefix) and right (`>` prefix) parts of update
  changelog come in not fixed order: it can be left-right or right-left.

Solution: Ensure left-right order.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
89a72f11e5 fix(pack): make newer version suggestions more robust
Problem: New version suggestions in update confirmation buffer might
  include semver tags that were committed later but for versions that
  are not greater than current. Like if versions committed in order
  `v0.2.0` - `v0.3.0` - `v0.2.1` - `v0.3.1`, then when on `v0.3.0` both
  `v0.2.1` and `v0.3.1` are suggested, but only the latter is newer as
  a version. This is because those tags are computed with post-processed
  `git tag --list --contains HEAD`.

Solution: Compute all semver tags and filter only those greater than the
  latest version available at HEAD.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
6721128cc8 refactor(pack): use vim.cmd methods with structured input 2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
ed73ed8283 fix(pack): ensure explicit default version in events (where possible)
Problem: Both `PackChangedPre` and `PackChanged` contain |event-data|
  with plugin's `spec`. It looks like a good idea to have all its
  triggers contain the same format across all kinds ("install",
  "update", "delete"). There are several choices:
    - Have it be as verbatim as supplied to `vim.pack.add()`, i.e. can
      be either string or table. A bit too ambiguous.
    - Have it be table with `src` and `name` inferred. This requires
      less work for "install", but more work for "update" and "delete"
      (since they use `vim.pack.get()` which already infers default
      `version`).
    - Have it be table with *all* defaults made explicit. This looks
      like the best approach, but requires extra care to only infer
      default `version` when needed (i.e. avoid inferring during regular
      load) because it is costly in terms of startup time.
      This might also introduce inconsistency when dealing with
      lockfile(s) as information there should be as close to what user
      supplied as possible. Address that when dealing with lockfile.

Solution: Ensure explicit `version` in all events where possible.
2025-08-02 15:00:42 +03:00
Evgeni Chasnovski
8200223ee7 fix(pack): use vim.pack: as message/progress prefix 2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
267bbe64cb fix(pack): validate installed plugins in update() and del()
Problem: Currently `update()` and `del()` silently ignore input plugin
  names that are not for already installed plugin. This might lead to
  confusion because they are not explicitly reported.

Solution: Check that all input names are for installed plugins and error
  otherwise.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
a203961535 feat(pack): use colored nvim_echo chunks to show progress report
Problem: using `print()` to show progress report writes to `stdout` when
  in `--headless` mode (interferes with the testing output) and doesn't
  allow coloring.

Solution: use `nvim_echo` with colored chunks.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
3f34f083db fix(pack): ignore 'loadplugins' when sourcing 'after/plugin' scripts
Problem: Sourcing of 'after/plugin' scripts depends on the value of
  'loadplugins' option. It is redundant, as it has effect only during
  startup, while it is combined with `vim.v.vim_did_enter == 1` (i.e.
  "it is after starting up") condition.

Solution: Ignore it.
2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
28e2a5c151 fix(pack): improve vim.pack.add() input validation 2025-08-02 15:00:41 +03:00
Evgeni Chasnovski
1ee18b4061 fix(pack): use 'coxpcall.lua' on non-LuaJIT
Problem: `attempt to yield across metamethod/C-call boundary` error when
  trying to use `vim.pack.add()`.

Solution: use `pcall()` variant from 'coxpcall' on non-LuaJIT version of
  Lua.
2025-08-02 15:00:41 +03:00
zeertzjq
1240d29f8f vim-patch:b88f9e4: runtime(vim): Update base syntax, fix :map termination in :command RHS (#35131)
Ensure :map (and :abbreviate) terminate at | when included in :command
replacement strings containing commands separated by line continuations.

b88f9e4a04

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-08-02 19:35:21 +08:00
bfredl
94d09d6627 Merge pull request #35135 from bfredl/lazystatus
fix(statusline): don't require'vim.diagnostic' unless already used
2025-08-02 11:51:41 +02:00
bfredl
1af5ec5b51 fix(statusline): don't require'vim.diagnostic' unless already used
This workarounds a bug likely in nvim__get_runtime, and fixes #35124

Though I'd argue it is more correct anyway as the point of
vim.SUBMODULE lazy loading is "only pay for what you use". If no one
has require'vim.diagnostic' yet in LSP or otherwise, there cannot
be any diagostics available and loading the lua module is wasteful.
2025-08-02 11:26:35 +02:00
Eisuke Kawashima
68eece8b84 fix(diagnostic): check if the buffer is loaded #35125
fix #35116

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-07-31 19:53:53 -07:00
Anton Kastritskii
c3a4d12529 fix(statusline): check buf valid before redraw #35123
fixes #35116
2025-07-31 13:03:45 -07:00
Anton Kastritskii
b79ff967ac feat(statusline): vim.diagnostic.status() #33723
Problem:
Not easy to get a status string for diagnostics.

Solution:
- Add vim.diagnostic.status().
- Add it to the default 'statusline'.
2025-07-29 18:53:57 -07:00
Shadman
807a65b2da fix(prompt): cursor on prompt line, disallow ":edit" #34736
* fix: ensure :edit can not be use on prompt buffer
* fix: starting editing on prompt-line doesn't put cursor at the end
2025-07-29 18:36:01 -07:00
luukvbaal
1256daeead fix(extui): ensure windows are valid in scheduled on_key (#35106) 2025-07-29 23:03:38 +00:00
glepnir
15d57ab0ba fix(api): single-line visual block insert triggers extra on_lines #35098
Problem: Visual block insert on a single line incorrectly triggers two
on_lines callbacks - one for the correct line (0-indexed) and another
for a non-existent additional line.

Solution: Only call changed_lines() in block_insert() when additional
lines beyond the first were actually modified (start.lnum < end.lnum).
2025-07-29 06:24:44 -07:00
Justin M. Keyes
029b7a149f Merge #35000 docs: lsp, ui events, dev guidance 2025-07-28 22:23:07 -04:00
Justin M. Keyes
dc3a30cfbb fix(messages): 'exrc' / secure messages 2025-07-28 22:00:25 -04:00
Justin M. Keyes
c81dc320b0 docs: vim.pack 2025-07-28 22:00:25 -04:00
Justin M. Keyes
56a4ef3c21 docs: lsp, ui events, dev guidance, osc7
fix #34981
2025-07-28 22:00:25 -04:00
nyngwang
dc67ba948e feat(exrc): user must view and explicitly run ":trust" #35069
Problem:
It's relatively easy to mispress key `a` to (a)llow arbitrary execution
of 'exrc' files. #35050

Solution:
- For exrc files (not directories), remove "allow" menu item.
  Require the user to "view" and then explicitly `:trust` the file.
2025-07-28 13:11:58 -07:00
Lewis Russell
cf9b36f3d9 feat(lua): add vim.list.unique()
Problem:
No way to deduplicate values in a list in-place

Solution:
Add `vim.list.unique()`
2025-07-28 09:34:06 +01:00
Sergei Slipchenko
7a051a4c38 fix(diagnostics): avoid jumping to diagnostics in deleted ranges #35088
Problem:
diagnostic extmark used for positioning continues to exist after
deleting a range containing it, so it's possible to jump to a
next/previous diagnositc, which isn't visible in any way, including not
being shown via `open_float`.

Solution:
enable `invalidate` flag when setting an extmark to be able to filter
out diagnostics based on `invalid` flag when looking for next/previous
diagnostic to jump to.
2025-07-28 05:24:10 +00:00
Siddhant Agarwal
5151f635ca feat: serverlist({peer=true}) returns peer addresses #34806
Problem:
serverlist() only lists servers that were started by the current Nvim.

Solution:
Look for other Nvim servers in stdpath("run").
2025-07-27 21:40:04 -07:00
Maria José Solano
d08b265111 feat(lsp): enable document_color by default #35086 2025-07-27 17:11:28 -07:00
TheBlob42
628d569a59 fix(snippet): jumping backwards to choice node (#35062)
Avoid duplicate text when jumping back to a choice node. Set cursor to
end of tabstop range and prioritize current choice in completion items.
2025-07-27 16:10:00 -04:00
TheBlob42
dff78f580d fix(snippet): setting end_right_gravity (#35061)
When right_gravity is set to true for deactivating tabstop expansion we
have to set end_right_gravity to false to avoid expanding the tabstop
region on the right side. Vice versa for activating tabstop expansion
again.
2025-07-27 12:19:01 -07:00
Maria José Solano
afebbd0f34 fix(lsp): don't override config.title in vim.lsp.buf.signature_help() #35075 2025-07-26 19:47:28 -07:00
Jaehwang Jung
b4ba27c238 fix(lsp): codelens extmark line out of range (#35070)
Problem:
When setting extmark for a codelens after it's asynchronously resolved,
the line may have been removed, raising "invalid 'line': out of range"
error. This is a regression from #34888.

Solution:
Re-introduce the line count check.
2025-07-26 12:58:51 -07:00
Christian Clason
8a7bfdc079 build(deps): bump luajit to 871db2c84 2025-07-26 11:54:09 +02:00
bfredl
af5ac7c7ea fix(unittests): use -1ULL to mean UNSIGNED MATH.MAX 2025-07-26 11:54:09 +02:00
zeertzjq
5de2ec76a3 fix(cmdline): :checkhealth completion with multiple args (#35060) 2025-07-26 07:04:32 +08:00
Sergei Slipchenko
0a113013fb fix(diagnostics): position diagnostics using extmarks #34014
Problem:
Diagnostic positions are not being updated after text changes, which
means `vim.diagnostic.open_float` and `vim.diagnostic.jump` will work
with outdated positions when text is changed until diagnostics are
updated again (if ever).

Solution:
Create extmarks in `vim.diagnostic.set` and use their positions for
`vim.diagnostic.open_float` and `next_diagnostic` (used by
`vim.diagnostic.jump`, `vim.diagnostic.get_next` and
`vim.diagnostic.get_prev`).
2025-07-25 07:56:50 -07:00
Mike
e4a100a1e1 fix(diagnostics): extend conversion support from/to quickfix format (#34006)
Use uppercase to check severity
Mark quickfix items as valid when converting from diagnostics
Support nr/code attribute between formats
2025-07-25 08:14:00 -05:00
zeertzjq
1f7432a272 vim-patch:714671d: runtime(misc): use :hor :term to ensure new term window is split horizontally (#35064)
Problem:  :term splits new window above in vim, but in nvim it change
          the buffer for current window
Solution: :hor term to ensure consistent splitting for Vim and Neovim

closes: vim/vim#17822

714671de35

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-07-25 18:44:56 +08:00
phanium
e512efe369 fix(extui): attempt to perform arithmetic on field 'last_emsg' (#35047)
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-07-24 11:45:41 +00:00
zeertzjq
6190b6bc1d Merge pull request #35023 from janlazo/vim-9.1.1453
vim-patch:8.2.{2905,2906,2927},9.0.{2023,2042},9.1.{63,1453}
2025-07-24 12:29:07 +08:00
Jan Edmund Lazo
3e655d3e42 vim-patch:9.1.0063: GTK code can be improved
Problem:  GTK code can be improved
Solution: Improve GTK code for initial Wayland support
          (lilydjwg)

related: vim/vim#9639

94ff09a093

vim-patch:9.1.1453: tests: Test_geometry() may fail

Problem:  tests: Test_geometry() may fail
          (Gary Johnson)
Solution: allow a slightly smaller value when checking the number of
          lines.

fixes: vim/vim#17491

e965b7ac5f

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: lilydjwg <lilydjwg@gmail.com>
2025-07-23 23:35:44 -04:00
Yochem van Rosmalen
35af766de6 refactor(lua): use vim.system #34707 2025-07-23 20:03:30 -07:00
Sathya Pramodh
54b8c99e51 feat: ":restart +cmd" #34788
Problem:
":restart" always executes ":qall" to exit the server.

Solution:
Support ":restart +cmd" so the user can control the command
used to exit the server.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-07-23 19:45:31 -07:00
Yochem van Rosmalen
0dcdd65dcc fix(shada): check return value is 0
Problem:
Vimscript functions return number to signal ok/error. Lua doesn't
convert these to be falsey.

Solution:
Explicitly check if the return value is 0.
2025-07-23 13:57:27 +02:00
Yochem van Rosmalen
61c4a6b3a9 refactor(shada): switch plugin/shada.vim to Lua #34725 2025-07-23 04:04:05 -07:00
zeertzjq
95dfb063da fix(clipboard): correct blockwise register width computation (#35038) 2025-07-23 10:46:15 +08:00
glepnir
4fe51dfdae fix(iter): ArrayIter:last returns nil when filtered to empty #34697
Problem: After filtering out all elements, ArrayIter:last still returns a stale element.
Solution: Add check for self._head == self._tail and return nil early.

Fix #34696
2025-07-22 17:40:24 -07:00
zeertzjq
1685c44dd4 Merge pull request #35032 from zeertzjq/vim-61cec2e
vim-patch: doc updates
2025-07-23 06:57:37 +08:00
zeertzjq
e28aee0c72 vim-patch:774fe9d: runtime(doc): remove mention of ftp.vim.org
fixes: vim/vim#17819

774fe9d8fc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-23 06:28:35 +08:00
zeertzjq
d6704148bc vim-patch:5711d76: runtime(doc): Tweak documentation style
closes: vim/vim#17824

5711d76818

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-23 06:28:35 +08:00
zeertzjq
c93091395b vim-patch:61cec2e: runtime(doc): Fix typo in :help help-summary
fixes: vim/vim#17816
closes: vim/vim#17823

61cec2e761

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Alain Mosnier <alain@wanamoon.net>
2025-07-23 06:28:35 +08:00
Phạm Bình An
d591275db7 docs: update usr_02.txt #35031
Problem:
- There is reference to gVim in the usr_02.txt file, even though Nvim
  has no built-in GUI.
- `:h help-summary` has a section about optional features (e.g.
  `+conceal`) even though such thing does not exist in Nvim (`:h
  +conceal` will give E149 error).

Solution:
- Remove reference to gVim.
- Replace the section about optional features with a section about Lua.
2025-07-22 15:27:36 -07:00
zeertzjq
9377db2545 vim-patch:9.1.1576: cannot easily trigger wildcard expansion (#35022)
Problem:  cannot easily trigger wildcard expansion
Solution: Introduce wildtrigger() function
          (Girish Palya)

This PR introduces a new `wildtrigger()` function.

See `:h wildtrigger()`

`wildtrigger()` behaves like pressing the `wildchar,` but provides a
more refined and controlled completion experience:

- Suppresses beeps when no matches are found.
- Avoids displaying irrelevant completions (like full command lists)
  when the prefix is insufficient or doesn't match.
- Skips completion if the typeahead buffer has pending input or if a
  wildmenu is already active.
- Does not print "..." before completion.

This is an improvement on the `feedkeys()` based autocompletion script
given in vim/vim#16759.

closes: vim/vim#17806

b486ed8266

While at it, also make Ctrl-Z trigger search completion.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-23 06:12:50 +08:00
Riley Bruins
8b5d8dfc73 fix(lsp): support containerName in symbol requests #35029
The field is present for SymbolInformation and WorkspaceSymbol.
2025-07-22 17:30:16 +00:00
luukvbaal
9fc985bc98 feat(ui2): more predictable routing #35028
Problem:  Routing based on message kinds can be perceived as unpredictable.
Solution: Implement phase 1 of #34281, always showing the full message
          in a window dismissed on any user input when it does not fit
          in the 'cmdheight'. Also show spill "[+n]" indicator if needed.
2025-07-22 15:32:17 +00:00
Sean Dewar
4fadc21e38 fix(window): disallow closing autocmd window in other tabpage
Problem: unlike win_close, win_close_othertab could be used to close the
autocommand window from a different tabpage. This causes aucmd_restbuf to close
the wrong window, potentially causing a crash.

Solution: disallow closing it. Also replace a deprecated use of exc_exec in the
test file.

Fixes #21409.
2025-07-22 13:36:33 +01:00
Sean Dewar
0bef1c88f3 fix(api): do not allow opening float to closing buffer
Problem: no check for nvim_open_win opening a new floating window into a closing
buffer, which can lead to crashes.

Solution: call check_split_disallowed; opening a new float semantically splits
from a window, so the same problems as regular splits apply. Also restore the
error if switch_win_noblock in win_set_buf fails (may not be possible to hit
this, but win_set_buf can silently succeed there since #31595).

As the lock check applies to curbuf (not the target buffer) this may feel a bit
restrictive, though this isn't different to how things like ":split" or
nvim_open_win with "split = true" works when targeting a different buffer. Only
checking the target buffer's lock will cause issues if win_set_buf doesn't end
up in the target buffer for whatever reason.

Maybe we could consider checking the lock of the buffer after win_set_buf and
close the window if it's locked (maybe a bit fiddly, especially as closing a
window can fail...), or make the open + switch operation more atomic, like how
Vim does for its popup windows..?

It also used to be the case that win_set_buf would set an error if autocommands
sent us to a different buffer than what was requested, but #31595 appears to
have also changed that... I haven't touched that here.
2025-07-22 13:36:33 +01:00
Sean Dewar
9813c00dd3 fix(window): restore b_nwindows if win_close_othertab keeps window
Problem: can't accurately know if close_buffer directly (e.g: not via autocmds)
decremented b_nwindows. This can cause crashes if win_close_othertab decides to
keep the window after calling close_buffer (if it did not free the buffer), as
b_nwindows may remain out-of-sync.

Solution: change the return value of close_buffer to accurately depict whether
it decremented b_nwindows. Check it in win_close_othertab to avoid a crash.

Similar issues may exist in other places that call close_buffer, but I've not
addressed those here (not to mention only one other place even checks its return
value...)
2025-07-22 13:36:33 +01:00
Sean Dewar
1d2d6e31a7 test(tabclose): remove deprecated calls, use testnvim helpers 2025-07-22 13:36:33 +01:00
Sean Dewar
05a83265f9 fix(autocmd): fire TabClosed after freeing tab page
Problem: TabClosed is fired after close_buffer is called (after b_nwindows is
decremented) and after the tab page is removed from the list, but before it's
freed. This causes inconsistencies such as the removed tabpage having a valid
handle and functions like nvim_tabpage_get_number returning nonsense.

Solution: fire it after free_tabpage. Try to maintain the Nvim-specific
behaviour of setting `<amatch>` to the old tab page number, and the
(undocumented) behaviour of setting `<abuf>` to the buffer it was showing
(close_buffer sets w_buffer to NULL if it was freed, so it should be OK pass it
to apply_autocmds_group, similar to before).
2025-07-22 13:36:33 +01:00
Sean Dewar
3a36df9b13 fix(window): handle closing the only non-float in other tabpage
Problem: No check for closing the only non-floating window in a non-current
tabpage that contains floats. This can lead to a tabpage that contains only
floats, causing crashes.

Solution: Copy the relevant check from win_close to win_close_othertab. Fix some
uncovered issues.

Closes #34943
Fixes #31236

Co-authored-by: glepnir <glephunter@gmail.com>
2025-07-22 13:36:33 +01:00
Justin M. Keyes
b0e8b0a35f Merge #34853 from ribru17/diag_related_docs
feat(lsp): diagnostic related documents support
2025-07-22 00:38:46 -04:00
Jan Edmund Lazo
7c38f428f4 vim-patch:9.0.2023: need more tests for :cq
Problem:  need more tests for :cq
Solution: Add more tests, including wraparound on linux

ba9aed4497

vim-patch:9.0.2042: Test_cq_zero_exmode fails without channel feature

Problem:  Test_cq_zero_exmode fails without channel feature
Solution: Make the test check the channel feature

closes: vim/vim#13365

c290009e99

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-21 21:33:01 -04:00
Jan Edmund Lazo
9a5b3a39f3 vim-patch:8.2.2905: no error when defaults.vim cannot be loaded
Problem:    No error when defaults.vim cannot be loaded.
Solution:   Add an error message. (Christian Brabandt, closes vim/vim#8248)

1d3a14ecf0

Neovim doesn't support defaults.vim.
N/A test but this should "help" reduce patch rejections.

vim-patch:8.2.2906: ASAN reports errors for test_startup

Problem:    ASAN reports errors for test_startup for unknown reasons.
Solution:   Temporarily disable the new test.

a5787c3742

vim-patch:8.2.2927: test commented out because it fails with ASAN

Problem:    Test commented out because it fails with ASAN.
Solution:   Only skip the test when running with ASAN.

a83d06026d

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-21 21:33:01 -04:00
Riley Bruins
371aa1c566 feat(lsp): diagnostic related documents support 2025-07-21 16:11:24 -07:00
Riley Bruins
1d8e9b5d07 fix(lsp): store result id for unchanged diagnostic reports
**Problem:** For unchanged document diagnostic reports, the `resultId`
is ignored completely, even though it should still be saved for the
request (in fact, the spec marks it as mandatory for unchanged reports,
so it should be extra important).

**Solution:** Always store the `resultId`.
2025-07-21 16:11:15 -07:00
zeertzjq
ea2d226df6 Merge pull request #34894 from janlazo/vim-8.1.0857
vim-patch:8.1.{770,857,914,977,1004,1526,1551,1565,1584,1629,1641,1703,1728,1730,1736,1802,1853,1891,2127,2200},8.2.3922,9.0.{546,928},9.1.1382
2025-07-21 12:02:05 +08:00
zeertzjq
8ee82da3cf vim-patch:1f6faff: runtime(doc): mention the "pipefail" shell option (#35016)
related: vim/vim#17787

1f6faff912

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-21 07:54:31 +08:00
zeertzjq
2795df7aac Merge pull request #35015 from zeertzjq/vim-9.1.1571
vim-patch:9.1.{1571,1573}: CmdlineChanged triggered to often
2025-07-21 07:53:54 +08:00
zeertzjq
22d1fb8c01 vim-patch:9.1.1573: Memory leak when pressing Ctrl-D in cmdline mode
Problem:  Memory leak when pressing Ctrl-D in cmdline mode
          (after 9.1.1571).
Solution: Free prev_cmdbuff before assigning to it.
          (zeertzjq).

Existing tests already cover this. This change fixes the CI failure.

closes: vim/vim#17807

c02bef26fd
2025-07-21 07:16:55 +08:00
zeertzjq
bbc368dfce vim-patch:9.1.1571: CmdlineChanged triggered to often
Problem:  The CmdlineChanged event was firing unnecessarily, even when
          the command line's content hadn't actually changed.

Solution: I've added a check to compare the command-line buffer's state
          before and after key processing. The `CmdlineChanged` event
          now only triggers if the buffer's contents are genuinely
          different (Girish Palya).

closes: vim/vim#17803

239c4e4abe

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-21 07:15:51 +08:00
Jan Edmund Lazo
85bd0b6a03 vim-patch:8.1.1891: functions used in one file are global
Problem:    Functions used in one file are global.
Solution:   Add "static". (Yegappan Lakshmanan, closes vim/vim#4840)

5843f5f37b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
f2d92ba6ca refactor: fixup! vim-patch:8.1.0877: new buffer
https://github.com/neovim/neovim/pull/9674 removed switch_to_win_for_buf().
This vim-patch removed the last relevant usage of find_win_for_buf()
Vim uses switch_to_win_for_buf() only for if_py_both.
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
b79ed66e4a vim-patch:8.1.1736: viminfo support is spread out
Problem:    Viminfo support is spread out.
Solution:   Move more viminfo code to viminfo.c. (Yegappan Lakshmanan,
            closes vim/vim#4717)  Reorder code to make most functions static.

c3328169d5

735aa4c4c8 was the partial port for
the typedefs.
This patch completes the viminfo->shada port.

- get_shada_parameter()
- find_shada_parameter()

Other patches below are N/A.

vim-patch:8.1.1728: wrong place for command line history viminfo support

Problem:    Wrong place for command line history viminfo support.
Solution:   Move it to viminfo.c.

5f32ece459

vim-patch:8.1.1730: wrong place for mark viminfo support

Problem:    Wrong place for mark viminfo support.
Solution:   Move it to viminfo.c. (Yegappan Lakshmanan, closes vim/vim#4716)

1e78e69680

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:37:33 -04:00
Jan Edmund Lazo
6a97eb332a refactor: fixup! vim-patch:8.2.4881: "P" in Visual
7978660efb removed all uses of ff:

```diff
-yankreg_T *get_y_previous(void)
-{
-  return y_previous;
-}
-
-void set_y_previous(yankreg_T *yreg)
-{
-  y_previous = yreg;
-}
```
2025-07-20 18:37:13 -04:00
Jan Edmund Lazo
4765d4e059 vim-patch:8.1.1584: the evalfunc.c file is getting too big
Problem:    The evalfunc.c file is getting too big.
Solution:   Move channel and job related functions to channel.c.

0a1f56fcfe

---

N/A patches below:

vim-patch:8.1.0770: inconsistent use of ELAPSED_FUNC

Problem:    Inconsistent use of ELAPSED_FUNC.
Solution:   Consistently use ELAPSED_FUNC.  Also turn ELAPSED_TYPE into a
            typedef. (Ozaki Kiichi, closes vim/vim#3815)

1ac56c2d11

vim-patch:8.1.0914: code related to findfile() is spread out

Problem:    Code related to findfile() is spread out.
Solution:   Put findfile() related code into a new source file. (Yegappan
            Lakshmanan, closes vim/vim#3934)

5fd0f5052f

vim-patch:8.1.1004: function "luaV_setref()" not covered with tests

Problem:    Function "luaV_setref()" not covered with tests.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#4089)

e165f63598

vim-patch:8.1.1551: warning for shadowing popup_dragwin

Problem:    Warning for shadowing popup_dragwin. (Dominique Pelle)
Solution:   Add missing change.

6c17543b56

vim-patch:8.1.1629: terminal function help is in the wrong file

Problem:    Terminal function help is in the wrong file.
Solution:   Move the function details to terminal.txt.

6bf2c6264b

vim-patch:8.1.1641: garbage collection may run at a wrong moment

Problem:    Garbage collection may run at a wrong moment. (Trygve Aaberge)
Solution:   Postpone garbage collection while parsing messages. (closes vim/vim#4620)

6cc7e21412

vim-patch:8.1.1703: breaking out of loop by checking window pointer insufficient

Problem:    Breaking out of loop by checking window pointer is insufficient.
Solution:   Check the window ID and the buffer number. (closes vim/vim#4683)

6138640806

vim-patch:8.1.1802: missing change to call_callback()

Problem:    Missing change to call_callback().
Solution:   Add missing change.

b2129068a5

vim-patch:8.1.1853: timers test is still flaky

Problem:    Timers test is still flaky.
Solution:   Compute the time to sleep more accurately.

52953194af

---
Seems N/A now because of commit 09370eae77
---

vim-patch:8.1.2200: crash when memory allocation fails

Problem:    Crash when memory allocation fails.
Solution:   Check for NULL curwin and curbuf. (Christian Brabandt,
            closes vim/vim#4839)

1cac70953d

vim-patch:8.2.3922: cannot build with dynamic Ruby 3.1

Problem:    Cannot build with dynamic Ruby 3.1.
Solution:   Add "_EXTRA" variables for CI.  Add missing functions. (Ozaki
            Kiichi, closes vim/vim#9420)

8bb3fe4d4d

vim-patch:9.0.0546: supporting Ruby 1.8 makes code complicated

Problem:    Supporting Ruby 1.8 makes code complicated.
Solution:   Drop Ruby 1.8 support, it is ancient. (Ken Takata, closes vim/vim#11195)

236ccbf6f8

vim-patch:9.0.0928: using Ruby LDFLAGS may cause build problems

Problem:    Using Ruby LDFLAGS may cause build problems.
Solution:   Do not add Ruby LDFLAGS to Vim's LDFLAGS. (Zdenek Dohnal,
            closes vim/vim#11592)

1d822afaf6

vim-patch:9.1.1382: if_ruby: unused compiler warnings from ruby internals

Problem:  if_ruby: unused compiler warnings from ruby internals
Solution: disable -Wunused-parameter for if_ruby internal code
          (Philip H.)

closes: vim/vim#17297

411730e277

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:36:39 -04:00
Jan Edmund Lazo
00c2e7d89c vim-patch:8.1.1526: no numerical value for the patchlevel
Problem:    No numerical value for the patchlevel.
Solution:   Add v:versionlong.

37df9a4401

Restore "highest_patch()" solely for "v:versionlong".
Copy/paste Test_vvar_scriptversion2() from patch 9.1.1540.
It works without ":scriptversion 2".
In general, if Vim's test works with ":scriptversion 1", just port it
for additional coverage.

---

vim-patch:8.1.1565: MS-Windows: no sound support

Problem:    MS-Windows: no sound support.
Solution:   Add sound support for MS-Windows. (Yasuhiro Matsumoto, Ken Takata,
            closes vim/vim#4522)

9b283523f2

----

"sound" feature is N/A now but this updates "v:versionlong" docs.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:36:39 -04:00
Jan Edmund Lazo
1e81b54075 vim-patch:8.1.0977: blob not tested with Ruby
Problem:    Blob not tested with Ruby.
Solution:   Add more test coverage.  fixes a crash. (Dominique Pelle,
            closes vim/vim#4036)

0d13cce345

-----

https://github.com/neovim/neovim/pull/15211 ports Blob type.
"Test_ruby_Vim_blob()" was already committed.
Skipped because "ruby provider" did not implement Blob API.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:36:39 -04:00
Jan Edmund Lazo
fadbc0e717 vim-patch:8.1.2127: the indent.c file is a bit big
Problem:    The indent.c file is a bit big.
Solution:   Move C-indent code a a new cindent.c file.  Move other
            indent-related code to indent.c. (Yegappan Lakshmanan,
            closes vim/vim#5031)

14c01f8348

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:36:38 -04:00
Jan Edmund Lazo
441d222c0d vim-patch:8.1.0857: indent functionality is not separated
Problem:    Ignore functionality is not separated.
Solution:   Move indent functionality into a new file. (Yegappan Lakshmanan,
            closes vim/vim#3886)

4b47162cce

----

Partial port of v8.1.2127 by porting directly to indent_c.c,
not indent.c.

----

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-20 18:36:38 -04:00
Maria José Solano
c3991b8ef4 fix(lsp): show notification with empty hover response (#35014) 2025-07-20 16:58:40 -04:00
Justin M. Keyes
2495015455 Merge #35002 refactor(lsp): extract Client._on_detach to reduce duplicated code 2025-07-20 12:41:35 -04:00
zeertzjq
b6b793634a vim-patch:9.1.1572: expanding $var does not escape whitespace for 'path' (#35010)
Problem:  expanding $var does not escape whitespace for 'path'
Solution: Escape whitespace when expanding 'path' option.
          (Miguel Barro)

closes: vim/vim#17801

8b004081c4

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2025-07-20 15:16:10 +00:00
zeertzjq
c556c6677b vim-patch:31ec664: runtime(doc): Update help syntax, match :autocmd options (#35008)
- Match :autocmd options and special buffer pattern.
- Normalise ellipsis (three dots) in Ex command argument lists.

closes: vim/vim#17793

31ec66403d

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-20 14:11:30 +00:00
Yi Ming
6831c7de65 refactor(lsp): inline on_client_exit 2025-07-20 22:09:27 +08:00
zeertzjq
4962c60c6f vim-patch:partial:d3170f5: runtime(doc): Tweak documentation about tab pages (#35007)
closes: vim/vim#17799

d3170f59e0

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-20 22:05:46 +08:00
Yi Ming
5400df0f7f refactor(lsp): track clients in all_clients once initialized 2025-07-20 22:05:03 +08:00
zeertzjq
0f9b5dd0b4 vim-patch:9.1.1570: Copilot suggested some improvements in cmdexpand.c (#35006)
Problem:  Copilot suggested some improvements in cmdexpand.c
          (after v9.1.1556)
Solution: Use better variable names and comments
          (John Marriott).

closes: vim/vim#17795

88b735973c

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-07-20 21:29:35 +08:00
zeertzjq
b91613f42c vim-patch:9.1.1567: crash when using inline diff mode (#35005)
Problem:  Crash when using inline diff mode
          (Ilya Grigoriev)
Solution: Set tp_diffbuf to NULL when skipping a diff block
          (Yee Cheng Chin).

Fix an array out of bounds crash when using diffopt+=inline:char when 4
or more buffers are being diff'ed. This happens when one of the blocks
is empty. The inline highlight logic skips using that buffer's block,
but when another buffer is used later and calls diff_read() to merge the
diff blocks together, it could erroneously consider the empty block's
diff info which has not been initialized, leaving to diff numbers that
are invalid. Later on the diff num is used without bounds checking which
leads to the crash.

Fix this by making sure to unset tp_diffbuf to NULL when we skip a
block, so diff_read() will not consider this buffer to be used within
inline diff. Also, add more bounds checking just to be safe.

closes: vim/vim#17805

c8b99e2d13

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-07-20 21:11:43 +08:00
Christian Clason
14cafbcc85 vim-patch:1afe8c3: runtime(rust): improve loading time
fixes: vim/vim#17745
closes: vim/vim#17749

1afe8c3a4d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-20 13:27:55 +02:00
Christian Clason
8dfad04ce9 vim-patch:a2578e0: runtime(uc): include uc filetype plugin
closes: vim/vim#17802

a2578e08d5

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-07-20 13:27:55 +02:00
Yi Ming
8f75c0b586 refactor(lsp): extract Client._on_detach to reduce duplicated code 2025-07-20 15:09:38 +08:00
Peter Cardenas
e5c2ce5905 fix(treesitter): ":EditQuery [lang]" with injected languages #34914
Problem:
`:EditQuery` command accepts a language argument, but it doesn't
highlight properly for injected languages.

Solution:
- Fully parse with the root language and then filter the query on the
  child trees that are of the language requested.
- Also support completion (`EditQuery <tab>`).
2025-07-19 11:36:51 -07:00
Riley Bruins
c5167ffc18 feat(lsp): support linked editing ranges #34388
ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_linkedEditingRange
2025-07-19 10:54:49 -07:00
Phạm Bình An
db1542af3d fix(tutor): use legacy syntax for lesson 3.1 #34996
Problem:
- Extmark breaks lesson 3.1 of vim-01-beginner.tutor because when users
  delete the line and put it elsewhere, the extmark doesn't move to the
  put location.
- This doesn't mean the extmark implementation is bad though (note that
  thanks to extmark, for the first time, we can make lesson 2.6 really
  interactive), it's just that the tutor format has never been made for
  kinds of lessons like lesson 3.1, which is why all "expected" in that
  lesson are -1, which also means that lesson is not interactive in the
  first place. Also see lesson 2.1.3 in vim-02-beginner, where the mark
  is just used to mark the first line of the exercise, which also prove
  my point.

Solution:
- For a not-really-interactive lesson like lesson 3.1, just use legacy
  syntax. I borrow the old vimtutor's `--->` to mark the exercises of
  the lesson.
- Less redundant interactive marks also make the json files smaller and
  more maintainable.
2025-07-19 08:31:37 -07:00
Christian Clason
f21ada30e1 vim-patch:ba3a5a7: runtime(sh): properly delete shell commands in syntax file
closes: vim/vim#17785

ba3a5a7372

Co-authored-by: Christoffer Aasted <chr.aasted@gmail.com>
2025-07-19 11:19:40 +02:00
Christian Clason
b21c357b9c vim-patch:a2fff3f: runtime(lf): update syntax to support lf version r36
Adds the lf release 36 specific syntax highlighting changes.

related: andis-sprinkis/lf-vim#22 by @CatsDeservePets

closes: vim/vim#17792

a2fff3fb94

Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
Co-authored-by: CatsDeservePets <145048791+CatsDeservePets@users.noreply.github.com>
2025-07-19 11:19:40 +02:00
György Andorka
46648c3867 fix(pack): close confirmation buffer's tabpage by ID #34971
Problem: On canceling the update (triggering `WinClosed`), the tab page
will most probably be closed too. Closing some other tab page while the
confirmation buffer is open also changes tab page numbers. We are trying
to close the wrong tab page in both cases.

Solution: save the tab page ID, and attempt to get the tab page number
from the ID when closing the buffer.
2025-07-18 18:40:16 -07:00
zeertzjq
3a140ddbc6 Merge pull request #34995 from zeertzjq/vim-97501af
vim-patch: Vim syntax updates
2025-07-19 06:31:38 +08:00
zeertzjq
10a0c59487 vim-patch:2f7c957: runtime(vim): Update base syntax and generator, improve command/function distinction
- Match Ex command modifiers and functions with the same name correctly.
  E.g., :browse and browse().
- Match full :eval command.

closes: vim/vim#17789

2f7c957c8d

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-19 06:06:52 +08:00
zeertzjq
73943eb0d1 vim-patch:97501af: runtime(vim): Update base syntax, match "any" type distinctly
Allow for special highlighting of the "any" Vim9 type.

Addresses comment
https://github.com/vim/vim/pull/17722#issuecomment-3075531052

closes: vim/vim#17769

97501afda3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-19 06:01:17 +08:00
Phạm Bình An
f2691199fa fix(tutor): use invalidate field in nvim_buf_set_extmark() #34989
Problem:
If users delete a line containing extmark, it will move to the next
line, which could highlight the next line in an unwanted way.

Solution:
- Use `invalidate` field in `nvim_buf_set_extmark()` to prevent the
extmark from moving.
- Also save from "priority" hacking, since we can check if the extmark
  is valid in `nvim_buf_get_extmarks()` now.
2025-07-18 13:02:09 -07:00
Justin M. Keyes
26bbeadda3 Merge #34991 pack.txt help file 2025-07-18 13:54:14 -04:00
Phạm Bình An
f5829957f2 feat(env): remove VIM_VERSION_NODOT macro #34890
Problem:
- The VIM_VERSION_NODOT macro maintained support for legacy Vim
  version-specific runtime directories (e.g., "vim82") which I believe
  have never been relevant for Neovim

Solution:
- Remove it
- Rename `vim_version_dir()` to `vim_runtime_dir()`
2025-07-18 10:46:33 -07:00
Evgeni Chasnovski
586e6d427a docs: fix help tag link #34988 2025-07-18 10:45:35 -07:00
Evgeni Chasnovski
a3cfdcebb9 docs: move *packages* and *package-create* into 'pack.txt' 2025-07-18 17:43:41 +03:00
Evgeni Chasnovski
538c945fdf docs(pack): move vim.pack documentation into a separate file 2025-07-18 17:39:23 +03:00
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
Yi Ming
7e8aa0585e refactor(lsp): rename vim.lsp.semantic_tokens start/stop to enable() 2025-07-13 11:03:22 +08:00
Yi Ming
a8d9f3331e test(lsp): remove the deprecated feed_command 2025-07-13 11:03:22 +08:00
Yi Ming
7ac4cbcd2e refactor(lsp): utility functions for enable()/is_enabled() 2025-07-13 11:03:22 +08:00
Jaehwang Jung
4778a4c201 fix(lsp): prevent flicker in codelens virtual text #34888
Problem:
Calling lsp.codelens.refresh() causes transient visual flicker because
codelens virtual texts are briefly replaced with "Unresolved lens ..."
before being resolved and redrawn. Since refresh() is triggered
frequently (e.g., on CursorHold or InsertLeave), this leads to redundant
and noisy virtual text updates, even when the final text hasn't changed.

Solution:
Do not update virtual text for a line if some lenses for that line are
not resolved yet.

A trade-off is that the user may temporarily see outdated virtual text.
However, that's preferable to spamming updates on every refresh.
2025-07-12 16:55:58 -07:00
Justin M. Keyes
815916b450 test: zig build thread_spec.lua failure after vim.text.diff rename
Problem:
Since renaming `vim.diff` to `vim.text.diff`, `thread_spec.lua` fails in
the zig build. Is `vim.text.diff` not available in the thread context?
Why does it only fail in the zig build?

    FAILED   ./test/functional/lua/thread_spec.lua @ 217: thread vim.* diff
    ./test/functional/lua/thread_spec.lua:229: Expected objects to be the same.
    Passed in:
    (nil)
    Expected:
    (table: 0x7f221d392218) {
      [1] = 'notification'
    E5113: Lua chunk:
      [2] = 'result'
      [3] = {
        [1] = '@@ -1 +1 @@
    -Hello
    +Helli
    ' } }

    stack traceback:
            ./test/functional/lua/thread_spec.lua:229: in function <./test/functional/lua/thread_spec.lua:217>

    FAILED   ./test/functional/lua/thread_spec.lua @ 372: threadpool vim.* work
    ./test/functional/lua/thread_spec.lua:384: Expected objects to be the same.
    Passed in:
    (table: 0x7f2225be2c30) {
      [1] = 'notification'
      [2] = 'result'
     *[3] = {
       *[1] = vim.NIL } }
    Expected:
    (table: 0x7f2225be25c0) {
      [1] = 'notification'
      [2] = 'result'
     *[3] = {
       *[1] = '@@ -1 +1 @@
    -Hello
    +Helli
    ' } }

    stack traceback:
            ./test/functional/lua/thread_spec.lua:384: in function <./test/functional/lua/thread_spec.lua:372>

Solution:
Use `vim._diff` in the test, until a root cause is found.
2025-07-12 18:58:17 -04:00
Justin M. Keyes
f3a54e7ccf refactor(lua): rename vim.diff => vim.text.diff #34864
Problem:
`vim.diff()` was introduced before we had the `vim.text` module, where
it obviously belongs.

Solution:
Move it.
2025-07-12 22:36:07 +00:00
Justin M. Keyes
430be9d01d ci(test): use ARM ubuntu linux for more CI jobs #34908
Problem:
We temporarily disabled linux arm ci because of stability issues with
the runner. #32339 Since then, the hardware was changed, so we can try
re-enabling ARM linux CI. https://github.com/actions/partner-runner-images/issues/47#issuecomment-2678170225

Solution:
- re-enable arm linux ci. reverts 8e4b77134a
- also use arm image for these jobs, where arm seems to run much faster:
- `lint` (step: `clang-tidy`)
    - master: 1m5s
    - this pr (linux ARM): 37s
- `clang-analyzer` (step: `cmake --build ...`)
    - master: 10m
    - this pr (linux ARM) 5m 55s
- `with-external-deps` (step: `Build`)
    - master: 26s
    - this pr (linux ARM): 21s
2025-07-12 14:32:59 -07:00
Christian Clason
3812cb1cd1 build(deps): bump tree-sitter to v0.25.7 2025-07-12 21:29:41 +02:00
Justin M. Keyes
2422fbdd5f fix(health): bad format() call #34904
Problem:
Bad format() call on PUC Lua #34901

    Error: Failed to run healthcheck for "vim.health" plugin. Exception:
    runtime/lua/vim/health/health.lua:89: bad argument #1 to 'format' (string expected, got nil)

Solution:
Avoid passing nil.
2025-07-12 11:27:51 -07:00
Christian Clason
eb5b4b9e57 build(deps): bump tree-sitter-vim to v0.7.0 2025-07-12 18:57:52 +02:00
luukvbaal
d2098057a7 docs(autocmd): generate events enum type #34883 2025-07-12 07:46:13 -07:00
Travis Finkenauer
34fbfa3586 refactor(build): use consistent cmake names #34893
CMake is functions/macros are case-insensitive (unlike variables), but
names differing only by case (e.g. "BuildLuaJit" instead of
"BuildLuajit") may look the same at a glance. This can be confusing if
you do a case-sensitive search, such as by using the * key in neovim to
search for other instances of the word under the cursor.
2025-07-12 07:00:36 -07:00
Phạm Bình An
f1babb322b refactor(qf): move syntax code for qf-toc to qf.lua #34879 2025-07-11 18:13:20 -07:00
luukvbaal
8c6ea76ebc fix(extui): disable cmdline highlighter when showing a message (#34887)
Problem:  When message is moved from message window to cmdline,
          the cmdline highlighter is not disabled.
Solution: Disable the highlighter (and only scroll to bottom when
          message was moved to pager).
2025-07-12 01:15:31 +02:00
zeertzjq
d4074b812d vim-patch:9.1.1538: tests: string options in gen_opt_test.vim not fully sorted (#34891)
Problem:  tests: string options in gen_opt_test.vim aren't fully sorted.
Solution: Sort the string options alphabetically.  Also make description
          of 'maxsearchcount' start with lower-case for consistency with
          other options, update documentation for searchcount().

closes: vim/vim#17720

7306e8fcdb
2025-07-11 22:56:43 +00:00
luukvbaal
7f5b5d34cf fix(window): don't store invalid height in window config (#34885)
Problem:  When 'winminheight' is zero and the window height is set to
          zero, the actual height is clamped whereas the stored config
          value is not. Reciprocal window configuration through
          nvim_win_get_config() then results in an error.
Solution: Also clamp the stored dimensions in the window config.
2025-07-11 16:53:30 +00:00
Tomasz N
9e968635ef fix(extui): check if buffers/windows exist before deleting (#34886)
Problem: Disabling vim._extui may try to delete non-existent windows/buffers.
Solution: Check that window/buffer is valid before deleting.
2025-07-11 17:31:30 +02:00
Justin M. Keyes
4f3aa7bafb Merge #34558 docs 2025-07-10 22:36:16 -04:00
jade
7a69fefdb9 fix(vim.json): loss of precision on integers >14 digits #34876
Problem: multiple DAP servers keep assuming they can have internal IDs
         up to 2**52, which get corrupted by the Neovim JSON encoder.
Solution: change (1) constant and add a test so nobody breaks it while
          updating the library.

Fixes: https://github.com/neovim/neovim/issues/24532
Fixes: https://github.com/mfussenegger/nvim-dap/issues/1534
Fixes: https://github.com/facebook/buck2/issues/1032
2025-07-10 19:07:56 -07:00
Justin M. Keyes
c3e2926f17 docs: deprecate :ownsyntax 2025-07-10 21:50:46 -04:00
Justin M. Keyes
e78c877688 docs: rename ui.txt => api-ui-events.txt 2025-07-10 21:50:46 -04:00
Justin M. Keyes
58df501913 docs: api, pack, events, develop 2025-07-10 21:50:46 -04:00
zeertzjq
00f8f94d5b vim-patch:9.1.1535: the maximum search count uses hard-coded value 99 (#34873)
Problem:  The maximum search count uses a hard-coded value of 99
          (Andres Monge, Joschua Kesper)
Solution: Make it configurable using the 'maxsearchcount' option.

related: vim/vim#8855
fixes: vim/vim#17527
closes: vim/vim#17695

b7b7fa04bf

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-11 09:17:05 +08:00
luukvbaal
54cde0674b test(ui/{cmdline,message}2_spec): reduce flakiness/runtime #34875
Problem:  Storing the configured 'cmdheight' value is scheduled and
          may happen after cmdline2_spec already entered block_mode.
          Excessive wait time for expected screen state due to delayed
          ruler after an error message.
Solution: Only schedule storing the user configured 'cmdheight' if
          v:vim_did_enter is unset. Use regular message instead of error.
2025-07-10 17:52:50 -07:00
zeertzjq
9809ce8b47 vim-patch:6ac2e4a: runtime(vim): Update base syntax, improve function call highlighting (#34874)
- Match more function calls.
- Contain function call syntax groups.
- Improve differentiation between Ex commands and builtin functions with
  the same name.  Remove special cases.  Command modifiers are not
  currently well differentiated from functions.

closes: vim/vim#17712

6ac2e4aa0a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-11 07:20:25 +08:00
Riley Bruins
68e316e3f9 feat(diagnostic): jump to related info location from open_float #34837
This commit allows users to jump to the location specified in a
diagnostic's `relatedInformation`, using `gf` from within the
`open_float` window. The cursor need only be on line that displays the
related info.
2025-07-10 11:24:17 -07:00
Riley Bruins
7bd4dfd209 refactor(lsp): simplify multiline semantic token logic #34698
This commit makes it so that only one call to `vim.str_byteindex` is
needed, at the end of the `end_line`, `end_col` calculations.
2025-07-10 11:12:18 -07:00
Maria José Solano
4745270bf1 feat(lsp): support textDocument/colorPresentation (#34823)
feat(lsp): support for `textDocument/colorPresentation`
2025-07-10 08:51:26 -07:00
Sebastian Lyng Johansen
213360c389 fix(lsp): custom 'winborder' in make_floating_popup_options() #34868 2025-07-10 05:51:13 -07:00
glepnir
5803994a1c fix(highlight): preserve bg transparency with winblend=100 #34825
Problem: When winblend=100 is set on floating windows with transparent
background, the desktop background is not visible through the window.

Solution: Add special case to preserve transparency (-1) when blend
ratio is 100% and background was originally transparent.
2025-07-10 05:42:45 -07:00
Lewis Russell
e644038f06 docs: move vim.system to own section 2025-07-10 13:34:58 +01:00
zeertzjq
7f18811668 vim-patch:32a1b26: runtime(filetype): improve asm heuristics and move into FTasmsyntax() (#34863)
fixes: vim/vim#17474
closes: vim/vim#17683

32a1b26ef3

vim-patch:41ee98c: runtime(filetype): fix incorrect pattern and break early

- Using `\n` is incorrect, as result of getline() does not contain line
  breaks and only uses `\n` for NUL bytes.
- Return when b:asmsyntax is set, like many other filetypes.

closes: vim/vim#17706

41ee98c3c5

Co-authored-by: Wu Yongwei <wuyongwei@gmail.com>
2025-07-10 20:30:39 +08:00
Christian Clason
fccd016a0f vim-patch:bda55df: Revert "runtime(haskell): Add single quote to iskeyword in ftplugin (vim/vim#8191)"
This reverts commit 5e6e4042b1c9685bce86493e3ee6fe916a7f221c.

related: vim/vim#8191

bda55df3b8

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-10 09:29:15 +02:00
zeertzjq
e65c0a0810 fix(tui): check for title support correctly (#34866) 2025-07-10 14:17:20 +08:00
glepnir
fb0dc825e9 feat(option): custom chars in 'winborder' #33772
Problem: winborder option only supported predefined styles and lacked support for custom border characters.

Solution: implement parsing for comma-separated list format that allows specifying 8 individual border characters (topleft, top, topright, right, botright, bottom, botleft, left).
2025-07-09 18:15:08 -07:00
Sebastian Lyng Johansen
7526fb449d feat(extui): use winborder for msg window #34859
Problem:  The message window is essentially a regular floating window
          but does not use 'winborder'.
          Still some "scratch" buffer options unset after it was removed
          from its window.
Solution: Do not set the border when opening the window message.
          Forego passing `scratch = true` when opening a buffer,
          set the options manually when necessary.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-07-09 17:42:47 -07:00
zeertzjq
8aed423072 vim-patch:3987eac: runtime(doc): clarify how ex ranges are adjusted when acting on folds (#34862)
closes: vim/vim#17696

3987eac572

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-09 22:55:35 +00:00
Gregory Anders
977e91b424 feat(tui): use DA1 response to determine OSC 52 support
Many terminals now include support for OSC 52 in their Primary Device
Attributes (DA1) response. This is preferable to using XTGETTCAP because
DA1 is _much_ more broadly supported.
2025-07-09 14:03:03 -05:00
phanium
76f6868e0a fix(runtime): no conceal in qf on :lopen #34854
Problem:
No conceal in qf on `lopen` since 74fcc945. Repro:

    nvim --clean +'tab Man ls' +'norm gO' +lclose +lopen

Solution:
Consider "Table of contents" title.
2025-07-09 09:36:10 -07:00
Leonhard Kipp
840cdb9589 feat(shada): shada should not store nobuflisted buffers #21818
Problem:  Shada jumplist entries still include entries from e.g. 'nobuflisted' buffers.
Solution: Check `ignore_buf()` before adding jumplist entries, followup to b98eefd8.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2025-07-09 09:33:20 -07:00
luukvbaal
3a3484be29 test(messages/cmdline_spec): convert highlight IDs to name and format (#34845)
Problem:  Hardcoded highlight IDs for ext_messages/cmdline output need
          to be adjusted everytime a builtin highlight group is added.
Solution: Store a global map of default highlights through nvim_get_hl()
          and fetch missing (custom) highlight groups through synIDattr().
          Use more compact formatting for screen:expect().
2025-07-09 09:33:19 +00:00
luukvbaal
3c9484b550 feat(extui): show dismissed message in cmdline (#34745)
Problem:  An accidental key press can dismiss a routed message to be
          shown in full before the user was able to read it.
          'verbose' message routing based on an outdated condition results
          in "last_set" messages being separated from its message pair.
Solution: Show a message to be shown in full in the cmdline window instead
          of the pager. Keep it there and update the spill indicator when
          the message is dismissed.
          Remove the 'verbose' message routing.
2025-07-09 11:17:18 +02:00
Justin M. Keyes
88774965e5 feat(api): relax contract, allow return-type void => non-void #34811
Allow changing return-type from `void => non-void`.
2025-07-09 02:40:08 +00:00
zeertzjq
96aef50624 Merge pull request #34852 from zeertzjq/vim-9.1.1526
vim-patch:9.1.{1526,1528}
2025-07-09 08:55:08 +08:00
zeertzjq
5fe310c5e6 vim-patch:9.1.1528: completion: crash with getcompletion()
Problem:  completion: crash with getcompletion()
          (zeertzjq)
Solution: Don't set may_expand_pattern in f_getcompletion(),
          unset may_expand_pattern() once it is not longer needed
          (Girish Palya).

fixes: vim/vim#17680
closes: vim/vim#17686

f2ec8d4afc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-09 08:06:23 +08:00
zeertzjq
ef0ec7edac vim-patch:9.1.1526: completion: search completion match may differ in case
Problem:  completion: search completion match may differ in case
          (techntools)
Solution: add "exacttext" to 'wildoptions' value (Girish Palya)

This flag does the following:

exacttext
      When this flag is present, search pattern completion
      (e.g., in |/|, |?|, |:s|, |:g|, |:v|, and |:vim|)
      shows exact buffer text as menu items, without
      preserving regex artifacts like position
      anchors (e.g., |/\<|). This provides more intuitive
      menu items that match the actual buffer text. However,
      searches may be less accurate since the pattern is not
      preserved exactly.
      By default, Vim preserves the typed pattern (with
      anchors) and appends the matched word. This preserves
      search correctness, especially when using regular
      expressions or with 'smartcase' enabled. However, the
      case of the appended matched word may not exactly
      match the case of the word in the buffer.

fixes: vim/vim#17654
closes: vim/vim#17667

93c2d5bf7f

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-09 08:06:23 +08:00
zeertzjq
db7c2acbc6 vim-patch:9.1.1532: termdebug: not enough ways to configure breakpoints (#34851)
Problem:  termdebug: not enough ways to configure breakpoints
Solution: add the termdebug_config['signs'] config setting, rework the
          termdebug test cases (Dimitry Ishenko)

Allow to configure custom breakpoint signs so one can do something like
this:

```vim
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5', '>6', '>7', '>8', '>9']
let g:termdebug_config['sign'] = '>>'
```

where the first 9 breakpoints will have their own signs and the rest
will be the same (>>).

While at it, rework the test for the termdebug plugin:

- Added test for g:termdebug_config['signs'].
- Added test for g:termdebug_config['sign'].
- Moved test for g:termdebug_config['sign_decimal'] into
  Test_termdebug_basic()

closes: vim/vim#17694

c4bca1de0b

Co-authored-by: Dimitry Ishenko <dimitry.ishenko@gmail.com>
2025-07-08 22:38:58 +00:00
Phạm Bình An
435f03ee10 docs: tag of :EditQuery #34844
Problem:
- Running `:h :EditQuery` throws error `E149: Sorry, no help for
  :EditQuery`
- vim_diff.txt miss an entry for `:EditQuery`

Solution:
- Make tag `[:EditQuery]()` right-aligned, similar to command `:Open`
- Update vim_diff.txt
2025-07-08 05:28:12 -07:00
PilgrimLyieu
bb6422f1ad docs(tutor): Chinese (zh-CN) translation #34803
Co-authored-by: glepnir <glephunter@gmail.com>
2025-07-08 05:26:39 -07:00
glepnir
28b7c2df52 fix(health): floating window closes when opening TOC (gO) #34794
Problem: Health check floating window gets closed when pressing 'gO' to show TOC because LSP floating preview system auto-closes on BufEnter events triggered by :lopen.

Solution: Temporarily disable BufEnter event for the current window during TOC operations and adjust window layout to prevent overlap.
2025-07-08 05:21:09 -07:00
luukvbaal
f68a5c40f0 feat(messages): add "prev_cmd" argument to msg_history_show (#34779)
Problem:  Unable to tell whether msg_history_show event is emitted for a
          :messages or g< command.
Solution: Add "prev_cmd" argument that is set to true for g<.
2025-07-08 11:19:02 +02:00
phanium
f576b59a09 docs: type fixes #34831 2025-07-07 18:56:22 -07:00
Mathias Fußenegger
bf9d3e4bf8 fix(prompt): lnum update via nvim_buf_set_lines if buf != curbuf #34833
Fixes the case from https://github.com/neovim/neovim/issues/34561#issuecomment-3031536581
2025-07-07 17:42:45 -07:00
Phạm Bình An
d88bebfbc7 docs: misc #34834
Problems:
- Miss some entries in `vim_diff.txt` and `index.txt`.
- I want to learn about Vim register, but when I type `:h register`, it
  shows sponsor information instead. Note that unlike Nvim, Vim has a
  separate session for `*register*`

Solution:
- Add missing commands to `index.txt`, `vim_diff.txt`
- Remove tag `register` from `index.txt`
2025-07-07 17:31:37 -07:00
zeertzjq
27daeb0d68 vim-patch:9.1.1520: completion: search completion doesn't handle 'smartcase' well (#34840)
Problem:  When using `/` or `?` in command-line mode with 'ignorecase' and
          'smartcase' enabled, the completion menu could show items that
          don't actually match any text in the buffer due to case mismatches

Solution: Instead of validating menu items only against the user-typed
          pattern, the new logic also checks whether the completed item
          matches actual buffer content. If needed, it retries the match
          using a lowercased version of the candidate, respecting
          smartcase semantics.

closes: vim/vim#17665

af22007784

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-08 08:07:42 +08:00
zeertzjq
ed8b022633 Merge pull request #34841 from zeertzjq/vim-9.1.0877
vim-patch:9.1.{0877,1519}
2025-07-08 08:06:34 +08:00
zeertzjq
842ca1fd5c vim-patch:9.1.1519: tests: Test_termdebug_decimal_breakpoints() may fail
Problem:  Test_termdebug_decimal_breakpoints() fails with List index out
          of range, because when adding the second breakpoint, the
          cursor is still on the very first line (a header include line)
          and therefore gdb refuses to set the breakpoint with:
          `msg="No compiled code for line 1 in file XTD_decimal.c"`
Solution: Run the program, so that it will break at the very first
          defined breakpoint and then once we are in the program,
          set further breakpoints

closes: vim/vim#17689

faed074ab7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-08 07:22:25 +08:00
zeertzjq
62822d750d vim-patch:9.1.0877: tests: missing test for termdebug + decimal signs
Problem:  tests: missing test for termdebug + decimal signs
Solution: Add a termdebug test (Ubaldo Tiberi)

closes: vim/vim#16081

b5c1557323

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
2025-07-08 07:22:25 +08:00
zeertzjq
5fd386a893 Merge pull request #34828 from ncrpy/fix-get_keymap-lhsrawalt
fix(api): populate `lhsrawalt` in `nvim_get_keymap` response
2025-07-08 07:22:02 +08:00
zeertzjq
0c973bf442 test(api): nvim_get_keymap returns correct lhsraw and lhsrawalt 2025-07-08 06:40:07 +08:00
ncrpy
d523750de0 fix(api): populate lhsrawalt in nvim_get_keymap response
Problem:
The `nvim_get_keymap()` function is missing the `lhsrawalt` field in its response for mappings with an alternate key representation. This makes its return value inconsistent with its documented `maparg()`-like structure and its formal type definition.

Solution:
Corrects the `keymap_array` function to pass the alternate mapping keys (`current_maphash->m_alt->m_keys`) to `mapblock_fill_dict`. The argument responsible for this was previously hardcoded to `NULL`.

For example, for a mapping of `<C-x>`, the API will now correctly return both `lhsraw` (`<80><fc>^DX`) and `lhsrawalt` (the alternate form, e.g., `^X`).
2025-07-08 06:40:07 +08:00
zeertzjq
c3c8d25293 vim-patch:9.1.1521: completion: pum does not reset scroll pos on reopen with 'noselect' (#34836)
Problem:  When 'wildmode' is set to include "noselect", the popup menu (pum)
          incorrectly retained its scroll position when reopened. This
          meant that after scrolling down through the menu with `<C-n>`,
          reopening the menu (e.g., by retyping the command and
          triggering completion again) would show the menu starting from
          the previously scrolled position, rather than from the top.
          This could confuse users, as the first visible item would not
          be the first actual match in the list.

Solution: Ensure that the popup menu resets its scroll position to the
          top when reopened (Girish Palya).

closes: vim/vim#17673

0cd7f3536b

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-08 06:37:30 +08:00
Riley Bruins
2031287e93 feat(lsp): support diagnostic related information (#34474) 2025-07-07 13:05:02 -04:00
Christian Clason
0d9bf5b89f vim-patch:244198f: runtime(autopkgtest): add ftplugin file for autopkgtest
closes: vim/vim#17679

244198f039

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-07-07 11:24:04 +02:00
Christian Clason
4310f3f580 vim-patch:e9d331d: runtime(autopkgtest): add syntax file for autopkgtest
related: vim/vim#17679

e9d331d173

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-07-07 11:24:04 +02:00
Christian Clason
d73788fad2 vim-patch:48c823c: runtime(debcontrol): move kernel/architecture definitions to shared/debarchitectures.vim
related: vim/vim#17679

48c823ca01

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-07-07 11:24:04 +02:00
Christian Clason
3177841bdf vim-patch:9.1.1517: filetype: autopkgtest files are not recognized
Problem:  filetype: autopkgtest files are not recognized
Solution: detect */debian/tests/control files as autopkgtest filetype
          (James McCoy)

Autopkgtest is a Debian tool for testing installed versions of packages
when other, related packages are updated.

Reference:
- https://www.debian.org/doc/debian-policy/autopkgtest.txt

related: vim/vim#17679

5bcc492649

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-07-07 11:24:04 +02:00
Yi Ming
8d5452c46d refactor(lsp): stateful data abstraction, vim.lsp.Capability #34639
Problem:
Closes #31453

Solution:
Introduce `vim.lsp.Capability`, which may serve as the base class for
all LSP features that require caching data. it
- was created if there is at least one client that supports the specific method;
- was destroyed if all clients that support the method were detached.

- Apply the refactor for `folding_range.lua` and `semantic_tokens.lua`.
- Show active features in :checkhealth.

Future:
I found that these features that are expected to be refactored by
`vim.lsp.Capability` have one characteristic in common: they all send
LSP requests once the document is modified. The following code is
different, but they are all for this purpose.

- semantic tokens:
fb8dba413f/runtime/lua/vim/lsp/semantic_tokens.lua (L192-L198)
- inlay hints, folding ranges, document color
fb8dba413f/runtime/lua/vim/lsp/inlay_hint.lua (L250-L266)

I think I can sum up this characteristic as the need to keep certain
data synchronized with the latest version computed by the server.
I believe we can handle this at the `vim.lsp.Capability` level, and
I think it will be very useful.

Therefore, my next step is to implement LSP request sending and data
synchronization on `vim.lsp.Capability`, rather than limiting it to the
current create/destroy data approach.
2025-07-07 03:51:30 +00:00
Yi Ming
55e3a75217 fix(lsp): convert the encoded position to line byte (#34824) 2025-07-06 20:39:05 -07:00
Shadman
5973328eda feat(options): per-buffer 'busy' status #34493
Problem:
Plugins cannot mark a buffer as "busy".

Solution:
- Add a buffer-local 'busy' option.
- Show a busy indicator in the default 'statusline'.
2025-07-06 16:17:06 -07:00
zeertzjq
6fd2a3040f vim-patch:9.1.1518: getcompletiontype() may crash (#34819)
Problem:  getcompletiontype() crashes when no completion is available
          (after v9.1.1509).
Solution: Don't call set_expand_context() (zeertzjq)

fixes: vim/vim#17681
closes: vim/vim#17684

e2c0f81dd0
2025-07-06 22:46:05 +00:00
Maria José Solano
2e2ac49c57 refactor(lsp): narrower hierarchy argument type (#34799) 2025-07-06 15:12:01 -07:00
zeertzjq
86a2ebd5fe vim-patch:f79695c: runtime(doc): fix a few typos introduced in 0ae9e19540dda5d (#34818)
f79695c2d8

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-07 06:01:51 +08:00
Artem
18e0301e1f fix(treesitter): inconsistent highlight of multiline combined injection #32619
Problem:
Combined injections not entirely highlighted.

Solution:
Reapply layer highlights on each line.
2025-07-06 11:05:41 -07:00
Phạm Bình An
12689c73d8 fix(vim.pack): add() stops unexpectedly on package load error #34787
Problem:
Error when adding a plugin will make all following plugins not
`:packadd`ed

Solution:
- add() should handle errors from :packadd with pcall()

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-07-06 11:04:03 -07:00
Maria José Solano
957093da0d feat(lsp): handle deprecated document symbols (#34751) 2025-07-06 09:39:37 -07:00
Maria José Solano
580b8cfac7 refactor(lsp): consistent usage of vim.notify #34802 2025-07-06 07:07:30 -07:00
zeertzjq
4f141dca8c vim-patch:0ae9e19: runtime(doc): add a section for options influencing search (#34810)
0ae9e19540

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-06 20:47:11 +08:00
glepnir
09f9d72c24 fix(runtime): coverity STRING_NULL #569464 (#34795)
Problem:
Coverity reports string null termination issue:

    *** CID 569464:  Memory - string handling  (STRING_NULL)
    /src/nvim/runtime.c: 1374 in ExpandRTDir_int()
    1372         if (flags & DIP_START) {
    1373           memcpy(tail - 15, "pack/*/start/*/", 15);  // NOLINT
    >>>     CID 569464:  Memory - string handling  (STRING_NULL)
    >>>     Passing unterminated string "tail - 15" to "globpath", which expects a null-terminated string.
    1374           globpath(p_pp, tail - 15, gap, glob_flags, expand_dirs);

    Similar issues occur at lines 1376, 1381, and 1383 where memcpy()
    constructs strings passed to globpath() without null termination.

Solution:
Replace dangerous pointer arithmetic and memcpy() with direct snprintf()
construction of complete search paths. This eliminates the need for
buffer reuse through pointer offsets and ensures all strings passed to
globpath() are properly null-terminated.

vim-patch:9.1.1515: Coverity complains about potential unterminated strings
2025-07-06 20:27:20 +08:00
zeertzjq
cf5506f0fd vim-patch:9.1.1516: tests: no test that 'incsearch' is updated after search completion (#34808)
Problem:  tests: no test that 'incsearch' is updated after accepting
          search completion.
Solution: Add a test case (zeertzjq).

closes: vim/vim#17682

08e5b128b8
2025-07-06 09:41:59 +00:00
zeertzjq
5335d9991f Merge pull request #34807 from zeertzjq/vim-9.1.1511
vim-patch:{9.1.1511,7a734b7}
2025-07-06 17:35:05 +08:00
zeertzjq
8a4977e286 vim-patch:7a734b7: tests: fix typo in comment (after v9.1.1511)
related: vim/vim#17660

7a734b7148
2025-07-06 17:10:11 +08:00
zeertzjq
11e967d5af vim-patch:9.1.1511: tests: two edit tests change v:testing from 1 to 0
Problem:  tests: two edit tests change v:testing from 1 to 0.
Solution: Don't change v:testing in these two tests, since it's already
          set to 1 in runtest.vim (zeertzjq).

closes: vim/vim#17660

96076bf41e
2025-07-06 17:10:11 +08:00
zeertzjq
025c070312 Merge pull request #34801 from zeertzjq/vim-9.1.1505
vim-patch:9.1.{1505,1509}
2025-07-06 09:51:38 +08:00
zeertzjq
9c04eb02ad vim-patch:9.1.1509: patch 9.1.1505 was not good
Problem:  Patch 9.1.1505 was not good
Solution: Revert "patch 9.1.1505: not possible to return completion type
          for :ex command" and instead add the getcompletiontype()
          function (Hirohito Higashi).

related: vim/vim#17606
closes: vim/vim#17662

96b3ef2389

Cherry-pick Test_multibyte_expression() from Vim, as it passes.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2025-07-06 08:55:32 +08:00
zeertzjq
6ebcb4a4d6 vim-patch:9.1.1505: not possible to return completion type for :ex command
Problem:  not possible to return command-line completion type for :ex
          command
Solution: make getcmdcompltype() accept an optional and return the
          command-line completion for that arg (Shougo Matsushita).

closes: vim/vim#17606

5d2354fc07

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2025-07-06 08:41:08 +08:00
zeertzjq
8fe4e120a2 Merge pull request #34800 from zeertzjq/vim-a9b5e4a
vim-patch: Vim syntax updates
2025-07-06 07:18:46 +08:00
zeertzjq
55f003671d vim-patch:5911ac5: runtime(vim): Update base-syntax, match :filetype in functions
closes: vim/vim#17671

5911ac5023

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-06 06:46:37 +08:00
zeertzjq
728b3e3d50 vim-patch:a8b8660: runtime(vim): Update base-syntax, match escape sequences in :command blocks
- Match escape sequences in :command replacement blocks.
- Match :substitute after escape sequences (a temporary fix until Ex
  commands are contained).

fixes: vim/vim#17326
closes: vim/vim#17663

a8b86605f3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-06 06:45:13 +08:00
zeertzjq
0ea7a65299 vim-patch:c233c2e: runtime(vim): Update base-syntax and generator, match all default highlight groups
- Match Conceal, ComplMatchIns, MsgArea, Terminal, and User[1-9]
  highlight groups.
- Generate the vimGroup syntax group from runtime/syncolor.vim.
- Match :SynColor and :SynLink as special user commands.

fixes vim/vim#17467
closes: vim/vim#17556

c233c2e6a5

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-06 06:43:47 +08:00
zeertzjq
518f95e27e vim-patch:a9b5e4a: runtime(vim): Update base-syntax and generator, generate command modifiers
Generate Ex command modifiers from the modifier table in src/ex_docmd.c

closes: vim/vim#17564

a9b5e4af43

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-06 06:34:53 +08:00
zeertzjq
85e6feedb0 vim-patch:9.1.1512: completion: can only complete from keyword characters (#34798)
Problem:  completion: can only complete from keyword characters
Solution: remove this restriction, allow completion functions when
          called from i_CTRL-N/i_CTRL-P to be triggered from non-keyword
          characters (Girish Palya)

Previously, functions specified in the `'complete'` option were
restricted to starting completion only from keyword characters (as
introduced in PR 17065). This change removes that restriction.

With this change, user-defined functions (e.g., `omnifunc`, `userfunc`)
used in `'complete'` can now initiate completion even when triggered
from non-keyword characters. This makes it easier to reuse existing
functions alongside other sources without having to consider whether the
cursor is on a keyword or non-keyword character, or worry about where
the replacement should begin (i.e., the `findstart=1` return value).

The logic for both the “collection” and “filtering” phases now fully
respects each source’s specified start column. This also extends to
fuzzy matching, making completions more predictable.

Internally, this builds on previously merged infrastructure that tracks
per-source metadata. This PR focuses on applying that metadata to
compute the leader string and insertion text appropriately for each
match.

Also, a memory corruption has been fixed in prepare_cpt_compl_funcs().

closes: vim/vim#17651

ba11e78f1d

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-06 06:09:28 +08:00
Christian Clason
887255362f vim-patch:f9d87fa: runtime(go): fix b:undo_ftplugin
last `unmap` can cause the error "E31: No such mapping" when
`doaudocmd FileType go` if appending other commands to `b:undo_ftplugin` i.e.
the space and the next bar as `let b:undo_ftplugin .= ' | setl ...'`.

closes: vim/vim#17664

f9d87fa6ba

Co-authored-by: ichizok <gclient.gaap@gmail.com>
2025-07-05 16:51:53 +02:00
zeertzjq
c3f35a38fe Merge pull request #34761 from zeertzjq/vim-9.1.1490
vim-patch:9.1.{1490,1493,1510}: search completion
2025-07-05 22:48:23 +08:00
zeertzjq
46727a7feb vim-patch:9.1.1510: Search completion may use invalid memory
Problem:  Search completion may use invalid memory (after 9.1.1490).
Solution: Don't get two line pointers at the same time (zeertzjq).

closes: vim/vim#17661

5e34eec6f8
2025-07-05 21:58:38 +08:00
zeertzjq
9a44bbd574 vim-patch:9.1.1493: manually comparing positions on buffer
Problem:  manually comparing positions on buffer
          (after v9.1.1490)
Solution: use the LTOREQ_POS() macro, fix a few other minor style issues
          (glepnir)

closes: vim/vim#17629

7cf35bc1be

Co-authored-by: glepnir <glephunter@gmail.com>
2025-07-05 21:58:38 +08:00
zeertzjq
dd707246fd vim-patch:9.1.1490: 'wildchar' does not work in search contexts
Problem:  'wildchar' does not work in search contexts
Solution: implement search completion when 'wildchar' is typed
          (Girish Palya).

This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:

- '/' and '?' search commands
- ':s', ':g', ':v', and ':vim' commands

Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.

---

**Use Case**

While searching (using `/` or `?`) for lines containing a pattern like
`"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by
a trigger key (`wildchar`) to open a **popup completion menu** showing
all matching words.

This offers two key benefits:

1. **Precision**: Select the exact word you're looking for without
typing it fully.
2. **Memory aid**: When you can’t recall a full function or variable
name, typing a few letters helps you visually identify and complete the
correct symbol.

---

**What’s New**

Completion is now supported in the following contexts:

- `/` and `?` search commands
- `:s`, `:g`, `:v`, and `:vimgrep` ex-commands

---

**Design Notes**

- While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have
to use `<CTRL-V><Tab>` or "\t" to search for a literal tab.
- **Responsiveness**: Search remains responsive because it checks for
user input frequently.

---

**Try It Out**

Basic setup using the default `<Tab>` as the completion trigger:

```vim
set wim=noselect,full wop=pum wmnu
```

Now type:

```
/foo<Tab>
```

This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type `/\<foo<Tab>`.

---

**Optional: Autocompletion**

For automatic popup menu completion as you type in search or `:`
commands, include this in your `.vimrc`:

```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu

autocmd CmdlineChanged [:/?] CmdComplete()

def CmdComplete()
  var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(),
expand('<afile>') == ':']
  var trigger_char = '\%(\w\|[*/:.-]\)$'
  var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$'  # Exclude numeric range
  if getchar(1, {number: true}) == 0  # Typehead is empty, no more
pasted input
      && !wildmenumode() && curpos == cmdline->len() + 1
      && (!cmdmode || (cmdline =~ trigger_char && cmdline !~
not_trigger_char))
    SkipCmdlineChanged()
    feedkeys("\<C-@>", "t")
    timer_start(0, (_) => getcmdline()->substitute('\%x00', '',
'ge')->setcmdline())  # Remove <C-@>
  endif
enddef

def SkipCmdlineChanged(key = ''): string
  set ei+=CmdlineChanged
  timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
  return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef

**Optional: Preserve history recall behavior**
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")

**Optional: Customize popup height**
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10,
winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&
```

closes: vim/vim#17570

6b49fba8c8

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-05 21:58:38 +08:00
zeertzjq
cc83854036 Merge pull request #34626 from zeertzjq/vim-74f0a77
vim-patch: :uniq Ex command
2025-07-05 21:56:11 +08:00
zeertzjq
023f157a60 vim-patch:26ebe21: runtime(doc): mismatch between the :uniq document's description and examples
closes: vim/vim#17612

26ebe21caa

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-05 21:36:45 +08:00
zeertzjq
3564e62426 vim-patch:1c471ac: runtime(doc): update description of :uniq command
The examples mention the [u] flag, so at least the [u] flag should be
introduced before the examples.

Slightly reword the sentence about trailing/leading white space.

closes: vim/vim#17604

1c471ac548

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-05 21:36:45 +08:00
zeertzjq
3bf27b2c74 vim-patch:9.1.1481: gcc complains about uninitialized variable
Problem:  gcc complains about uninitialized variable
          (Tony Mechelynck, after v9.1.1476)
Solution: initialize variable

42d2c5e803

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-07-05 21:36:45 +08:00
zeertzjq
d574f9479d vim-patch:ca793e6: runtime(vim): Update base-syntax, match :uniq command
closes: vim/vim#17601

ca793e60db

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-07-05 21:36:45 +08:00
zeertzjq
11f8e8eb63 vim-patch:9.1.1478: Unused assignment in ex_uniq()
Problem:  Unused assignment in ex_uniq() (after v9.1.1476)
Solution: Remove the assignment and the wrong comments above
          (zeertzjq).

closes: vim/vim#17596

fc378a88d8
2025-07-05 21:36:45 +08:00
zeertzjq
7138cdaef8 vim-patch:9.1.1477: no easy way to deduplicate text
Problem:  no easy way to deduplicate text
Solution: add the :uniq ex command
          (Hirohito Higashi)

closes: vim/vim#17538

74f0a77bb9

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-07-05 21:36:45 +08:00
Maria José Solano
d9465e984b Merge pull request #34789 from MariaSolOs/extra-notify
fix(lsp): consistent use of `vim.notify` in `lsp/buf.lua`
2025-07-04 14:46:14 -07:00
Maria José Solano
c30b93db93 ci: add Riley to Treesitter reviewers (#34791) 2025-07-04 14:44:04 -07:00
zeertzjq
0c02c9c70b refactor(getchar): rename test variable (#34769)
Also, test_disable_char_avail() is superseded by test_override() in Vim,
so remove that from vim_diff.txt.
2025-07-05 05:36:01 +08:00
Maria José Solano
52b9bab340 ci: LSP reviewers #34790 2025-07-04 14:30:52 -07:00
Maria José Solano
3342aead1d fix(lsp): consistent use of vim.notify/logging with unsupported methods 2025-07-04 14:15:23 -07:00
Maria José Solano
285ea2525f fix(lsp): remove extra notify on empty hover 2025-07-04 14:12:06 -07:00
Lewis Russell
e34e2289c2 fix(diagnostic): fix flaky error 2025-07-04 18:03:41 +01:00
Justin M. Keyes
cbfc3d1cdc Merge #34009 vim.pack 2025-07-04 06:32:55 -07:00
Evgeni Chasnovski
d21b8c949a feat(pack): add built-in plugin manager vim.pack
Problem: No built-in plugin manager

Solution: Add built-in plugin manager

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2025-07-04 15:56:28 +03:00
Lewis Russell
cf0f90fe14 feat(async): add vim._async
Problem: no easy built-in way to do async

Solution: add `vim._async`
2025-07-04 15:53:29 +03:00
zeertzjq
3694fcec28 vim-patch:8.2.1983: ml_get error when using <Cmd> to open a terminal (#34759)
Problem:    ml_get error when using <Cmd> to open a terminal.
Solution:   If the window changed reset the incsearch state. (closes vim/vim#7289)

f4d61bc559

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-07-04 07:30:34 +00:00
Christian Clason
16001b4d84 vim-patch:0d50d60: runtime(postscr): Correct some standard font names in syntax
closes: vim/vim#17647

0d50d6089d

Co-authored-by: Mike Williams <mrmrdubya@gmail.com>
2025-07-04 08:55:53 +02:00
glepnir
bb75610d99 vim-patch:9.1.1507: symlinks are resolved on :cd commands (#34758)
Problem:  File paths change from symlink to target path after :cd command
          when editing files through symbolic links
Solution: Add "~" flag to 'cpoptions' to control symlink resolution.
          When not included (default), symlinks are resolved maintaining
          backward compatibility. When included, symlinks are preserved
          providing the improved behavior. (glepnir)

related: neovim/neovim#15695
closes: vim/vim#17628

4ade668fb6
2025-07-04 05:44:39 +00:00
zeertzjq
c48dea20f5 vim-patch:9.1.1508: string manipulation can be improved in cmdexpand.c (#34755)
Problem:  String manipulation can be improved in cmdexpand.c
Solution: Refactor cmdexpand.c to remove calls to
          STRLEN()/STRMOVE()/STRCAT() (John Marriott)

This commit does the following:

In function nextwild():
  - slightly refactor the for loop to remove an array access
  - call STRLEN() and store it's result for reuse
  - move some variables closer to where they are used, renaming some on
    the way

In function ExpandOne():
  - move some calculations outside of the for loops
  - factor out calls to STRCAT() (which has an inherent STRLEN() call) in
    the for loop
  - move some variables closer to where they are used

In function expand_files_and_dirs():
  - factor out calls to STRMOVE() (which has an inherent STRLEN() call)

In function get_filetypecmd_arg():
  - move declarations of the string arrays into the blocks where they are
    used

In function get_breakadd_arg():
  - move declaration of the string array into the block where it is
    used

In function globpath():
  - factor out calls to STRLEN() and STRCAT()
  - move some variables closer to where they are used

And finally some minor cosmetic style changes

closes: vim/vim#17639

a494ce1c64

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-07-04 12:12:41 +08:00
zeertzjq
5db833b475 Merge pull request #34744 from zeertzjq/test-override
test(old): emulate test_override('char_avail') using FFI
2025-07-04 12:07:15 +08:00
zeertzjq
f348c0ebba fix(incsearch): include compsing characters with Ctrl-L
Cherry-picked from Vim patch 8.1.0579.
2025-07-04 11:00:14 +08:00
zeertzjq
c925e7b8ba test(old): emulate test_override('char_avail') using FFI
Add a non-static variable for this, otherwise it'll be really hacky.
This avoid having to rewrite many incsearch tests in Lua.
2025-07-04 11:00:14 +08:00
zeertzjq
bfffe0d214 test(ui/messages_spec): fix flakiness (#34754) 2025-07-04 10:59:41 +08:00
zeertzjq
17ecb2b988 test(editor/defaults_spec): fix flakiness (#34752) 2025-07-04 10:35:15 +08:00
Luca Saccarola
14d8d11671 vim-patch:ba47934: runtime(netrw): remove netrwSettings.vim (#34747)
relevant commits:
- distribution: remove NetrwSettings.vim

closes: vim/vim#17635

ba479348d4
2025-07-03 22:47:34 +00:00
zeertzjq
eef62e815d vim-patch:9.1.1506: tests: missing cleanup in Test_search_cmdline_incsearch_highlight() (#34748)
Problem:  tests: missing cleanup test_override('char_avail', 0) in
          Test_search_cmdline_incsearch_highlight().
Solution: Add the missing cleanup (zeertzjq).

closes: vim/vim#17655

29b29c6b30
2025-07-04 06:28:55 +08:00
Mart-Mihkel Aun
f01419f3d5 feat(runtime): accept predicates in take and skip (#34657)
Make `vim.iter():take()` and `vim.iter():skip()`
optionally accept predicates to enable takewhile
and skipwhile patterns used in functional
programming.
2025-07-03 08:12:24 -05:00
zeertzjq
715c28d67f test(old): emulate test_override('starting') with FFI (#34742)
I was initially trying to port several cmdline tests from Vim involving
test_override('char_avail') without having to rewrite entire tests in
Lua, but haven't figured out a good way achieve that yet. Nevertheless
emulating test_override('starting') is easier.
2025-07-03 19:21:58 +08:00
Lewis Russell
ac75de0d2a test: add more structure to vim.bo/wo tests 2025-07-03 11:05:08 +01:00
Lewis Russell
a5e582dab6 test: move lua option/variable tests to a separate file 2025-07-03 11:05:08 +01:00
Lewis Russell
0a6a73fd25 refactor: option tests 2025-07-03 11:05:08 +01:00
Christian Clason
fc1be07d28 vim-patch:9.1.1504: filetype: numbat files are not recognized
Problem:  filetype: numbat files are not recognized
Solution: detect *.nbt files as numbat filetype (0xadk)

References:
- https://github.com/sharkdp/numbat
- https://github.com/sharkdp/numbat/tree/master/numbat/modules

closes: vim/vim#17643

20eb68a8f2

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
Christian Clason
0a14ac3261 vim-patch:9.1.1503: filetype: haxe files are not recognized
Problem:  filetype: haxe files are not recognized
Solution: detect *.hx files as haxe filetype (0xadk)

References:
- https://haxe.org/
- https://code.haxe.org/category/beginner/hello-world.html

closes: vim/vim#17644

b46e3aa0fa

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
Christian Clason
18cfbf8fb2 vim-patch:9.1.1502: filetype: quickbms files are not recognized
Problem:  filetype: quickbms files are not recognized
Solution: detect *.bms files as quickbms filetype
          (0xadk)

Reference:
- https://aluigi.altervista.org/quickbms.htm

closes: vim/vim#17645

fdcdded4d5

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
Christian Clason
da42f99eb4 vim-patch:9.1.1501: filetype: flix files are not recognized
Problem:  filetype: flix files are not recognized
Solution: detect *.flix files as flix filetype
          (0xadk)

References:
- https://flix.dev/
- https://doc.flix.dev/introduction.html

closes: vim/vim#17646

b211916e0a

Co-authored-by: 0xadk <0xadk@users.noreply.github.com>
2025-07-03 09:18:18 +02:00
Christian Clason
535e292436 vim-patch:5ecee30: runtime(go): add section movement mappings to ftplugin
closes: vim/vim#17641

5ecee30dcd

Co-authored-by: Rob B <github@0x7e.net>
2025-07-03 00:28:39 +02:00
Rodrigodd
168bf0024e fix(treesitter): ensure TSLuaTree is always immutable
Problem:

The previous fix in #34314 relies on copying the tree in `tree_root` to
ensure the `TSNode`'s tree cannot be mutated. But that causes the
problem where two calls to `tree_root` return nodes from different
copies of a tree, which do not compare as equal. This has broken at
least one plugin.

Solution:

Make all `TSTree`s on the Lua side always immutable, avoiding the need
to copy the tree in `tree_root`, and make the only mutation point,
`tree_edit`, copy the tree instead.
2025-07-02 17:05:17 +01:00
Rodrigodd
94f44d58fd test(treesitter): test tree:root() is idempotent
Test for regression #34605
2025-07-02 17:05:17 +01:00
Lewis Russell
4eebc46930 fix(vim.system): env=nil passes env=nil to uv.spawn
731e616a79 made it so passing `{env = nil, clear_env = true }` would
pass `{env = {}}` to `vim.uv.spawn`.

However this is not what `clear_env` is (arguably) supposed to do.
If `env=nil` then that implies the uses wants `vim.uv.spawn()` to use
the default environment. Adding `clear_env = true` simply prevents
`NVIM` (the base environment) from being added.

Fixes #34730
2025-07-02 17:01:29 +01:00
Alex Díaz
e91224bfaa build: support static build #34728 2025-07-02 07:54:17 -07:00
Maria José Solano
807bc00dd6 fix(lsp): use vim.notify with action-less showMessage requests (#34720) 2025-07-01 17:13:58 +00:00
Lewis Russell
38aac21083 fix: type of nvim_echo 2025-07-01 12:57:37 +01:00
Justin M. Keyes
f731766474 Merge #34715 vim.version improvements 2025-07-01 04:19:42 -07:00
Yochem van Rosmalen
99873296be test(exrc): lua exrc knows its location #34713
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-07-01 03:51:48 -07:00
zeertzjq
66f02ee1fe vim-patch:9.1.1498: completion: 'complete' funcs behave different to 'omnifunc' (#34718)
Problem:  completion: Functions specified in the 'complete' option did
          not have the leader string removed when called with findstart = 0,
          unlike 'omnifunc' behavior
Solution: update behaviour and make behaviour consistent (Girish Palya)

closes: vim/vim#17636

fa16c7ab3f

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-30 23:58:06 +00:00
zeertzjq
af6b3d6fec vim-patch:a5b744e: runtime(vim): Update base-syntax, improve :syn-sync line defaults (#34719)
Set minlines and maxlines to 100 and 200 respectively.  Set these after
the script interface syntax files have been loaded to ensure the values
set in those are overridden.

fixes vim/vim#17580
closes: vim/vim#17614

a5b744ef93

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-30 23:29:54 +00:00
Evgeni Chasnovski
773075b2bc feat(vim.version): add vim.version.intersect()
Problem: No way to compute intersection of two version ranges, which is
useful when computing version range that fits inside several reference
ranges.

Solution: Add `vim.version.intersect()`.
2025-06-30 20:59:44 +03:00
Evgeni Chasnovski
649ff924d9 fix(vim.version): improve construction of '<=a.b.c' and '>a.b.c' ranges
Problem: `vim.version.range('<=a.b.c')` is not precise when it comes to
its right hand side. This is due to version ranges using exclusive right
hand side. While `vim.version.range('>a.b.c')` is not precise when it
comes to its left hand side because left hand sides are inclusive.

Solution: For '>=a.b.c' increase `to` from 'a.b.c' to the smallest
reasonable version that is bigger than 'a.b.c'. For '<a.b.c' do the same
for `from`.
More proper solution is an explicit control over inclusivity of version
range sides, but it has more side effects and requires design decisions.
2025-06-30 20:59:12 +03:00
James Trew
4034476dd3 doc(vim.version): options formatting #34716 2025-06-30 09:55:29 -07:00
Gabriel Ford
d6d1bfd20d fix(term): terminal attr index may exceed TERM_ATTRS_MAX #34318
Problem: Currently terminal highlight attribute buffers are statically allocated
be the size of `TERM_ATTRS_MAX`. This unique case isn't respected in
some places in the ui_compositor. Due to this, when a terminal window
has lines longer them `TERM_ATTRS_MAX`, the compositor will go past the
end of the buffer causing a crash due to out of bounds access.

Solution: Add check to ensure we don't query terminal highlight attrs
past `TERM_ATTRS_MAX` in `win_line()`.

Fixes #30374
2025-06-30 06:22:42 -07:00
Evgeni Chasnovski
aeb8bca12d feat(vim.version): make tostring() return human-readable version range
Problem: `tostring()` applied to version range doesn't return
human-readable text with information about the range.

Solution: Add `__tostring()` method.
2025-06-30 16:08:56 +03:00
Evgeni Chasnovski
561021bacd docs(vim.version): document vim.VersionRange as a dedicated class 2025-06-30 16:08:30 +03:00
Shadman
ed7ff848a0 fix(prompt): prompt mark not placed after text edits correctly #34671 2025-06-30 03:19:43 -07:00
Yochem van Rosmalen
f7c939fa7a fix(exrc): exrc knows its own location (#34638)
fix(exrc): lua exrc files know their location

Problem:
'exrc' files are inherently bound to their location / workspace and
therefore require to "know" their location on the filesystem. However,
currently using `debug.getinfo(1, 'S')` returns `"<nvim>"`.

Solution:
Include the filepath as chunkname in `loadstring()` and `nlua_exec()`.
2025-06-29 10:19:10 -05:00
Tom Ampuero
2f95abddfa refactor(health): use vim.system():wait() #34702
Problem:
- The ripgrep probe still used the legacy `vim.fn.system()`

Solution:
- Replace `vim.fn.system()` with `vim.system({rg_path, '-V'}):wait()`
2025-06-29 14:56:44 +00:00
phanium
1c52e90cd5 fix(help): :help can focus unfocusable/hide window #34442
Problem:
:help/:helpgrep/:lhelpgrep can focus unfocusable/hide window

Solution:
Ignore unfocusable/hidden window when reusing help buffer.
2025-06-29 14:44:17 +00:00
zeertzjq
63a7b92e58 vim-patch:1fa3f0c: runtime(doc): fix :vmap example to avoid unwanted spaces with JJ (#34695)
fixes: vim/vim#17621
closes: vim/vim#17623

1fa3f0c215

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-29 08:01:12 +08:00
Gabriel Ford
331de6afa6 fix(tui): don't crash when nvim__screenshot() is called with bad path (#34594)
Problem: Currently `vim.api.nvim__screenshot()` crashes when called with an
invalid path. This is because we don't check if `fopen()` returns a null
pointer.

Solution: Bail out if `fopen()` returns a null pointer.

Fixes: https://github.com/neovim/neovim/issues/34593
2025-06-28 23:12:42 +00:00
luukvbaal
10a03e83e3 fix(messages): only msg_clear for UPD_CLEAR #34688
Problem:  "msg_clear" is emitted after resizing the screen and during startup.
Solution: Only emit "msg_clear" when `redraw_type == UPD_CLEAR`.
2025-06-28 10:37:21 -07:00
Phạm Bình An
bff7d3fd9f fix(tutor): cannot find tutors in pack/*/start/* #34689
Problems:
- Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`)
- This means that the tutor plugin cannot find the tutors in pack/*/start/*

Solution:
- Use nvim_list_runtime_paths() instead of &rtp
2025-06-28 09:40:24 -07:00
Phạm Bình An
f1f106be3d vim-patch:9.1.1421: tests: need a test for the new-style tutor.tutor (#34267)
Problem:  tests: need a test for the new-style tutor.tutor, patch
          9.1.1384 broke the expected positions for the signs
Solution: Update all number keys in tutor.tutor.json to match the
          correct line numbers in tutor.tutor, replace tabs by spaces,
          add a screen-dump test to verify it does not regress
          (Pham Bình An)

closes: vim/vim#17416

a541f1de2b
2025-06-28 07:42:51 +00:00
Christian Clason
c752016976 vim-patch:0312527: runtime(pandoc): sync syntax script with upstream
closes: vim/vim#17598

03125277e9

Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com>
2025-06-28 00:13:57 +02:00
Zie Mcdowell
4ee2e365a5 fix(lsp): fix workspace diagnostic request to follow spec (#34674)
* fix(lsp): fix workspace diagnostic request to follow spec

* refactor(lsp): add type annotation
2025-06-27 19:17:41 +00:00
luukvbaal
f2988e05db feat(extui): don't enter pager for routed message #34679
Problem:  Messages routed to the pager to be shown in full, enter the
          pager automatically, yielding another "press-q-prompt".

Solution: Only enter the pager when requested explicitly. Otherwise,
          close the pager on the next typed mapping, unless that mapping
          entered the pager.
2025-06-27 12:13:01 -07:00
luukvbaal
bfe42c84de perf(extui): delay creating windows, buffers and parser (#34665)
Problem:  vim._extui unconditionally creates windows, buffers and the
          Vimscript cmdline highlighter when it is first loaded.
Solution: Schedule first creation of the window so that first redraw
          happens sooner (still need to create at least the cmdline
          window asap as it can have a different highlight through
          hl-MsgArea; thus further delaying until the first event that
          needs a particular target seems redundant). Load the cmdline
          highlighter on the first cmdline_show event.
2025-06-27 15:54:32 +02:00
glepnir
64753b5c37 fix(highlight): spurious underline in 'winblend' floating window #34614
Problem: When a floating window with high winblend uses a highlight group
         with underline (but without guisp), the underline appears red.

Solution: Only blend the special color (for underline/undercurl) if the
          foreground highlight actually has underline or undercurl set.
          Otherwise, ignore the special color.
2025-06-27 02:52:28 -07:00
luukvbaal
0b91e9f83b vim-patch:9.1.1482: scrolling with 'splitkeep' and line() (#34670)
Problem:  Topline is preemptively updated by line() in WinResized
          autocmd with 'splitkeep' != "cursor".
Solution: Set `skip_update_topline` when 'splitkeep' != "cursor".
          (Luuk van Baal)

fe803c8c04
2025-06-27 11:16:23 +02:00
Christian Clason
e518666f1d vim-patch:5d14da3: runtime(diff): fix regex for matching no-eol match
closes: vim/vim#17610

5d14da3690

Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
2025-06-27 09:56:07 +02:00
luukvbaal
2b4c1127ad feat(ui): emit "msg_clear" event after clearing the screen (#34035)
Problem:  ext_messages cannot tell when the screen was cleared, which is
          needed to clear visible messages. An empty message is also
          never emitted, but clears messages from the message grid.
Solution: Repurpose the "msg_clear" event to be emitted when the screen
          was cleared. Emit an empty message with the `empty` kind to
          hint to a UI to clear the cmdline area.
2025-06-26 22:27:21 +00:00
Maria José Solano
6005bc68b2 fix(lsp): include context for each client in multi-handler results (#34669) 2025-06-26 15:18:20 -04:00
Gregory Anders
f0c0c24ed7 fix(lsp/health): always use vim.inspect to show root_markers (#34667)
In https://github.com/neovim/neovim/pull/34092 we changed the
healthcheck to display root markers as a concatenated list if the first
item in root_markers is a string (not a table). However, this does not
solve the general case, because root_markers can contain a string as the
first element, but a table as the 2nd element.

Because root_markers has a more complex structure we should always just
display it using vim.inspect, rather than adding a special case for when
all items are a string.
2025-06-26 10:22:45 -05:00
Caleb White
5d06eade25 feat(defaults): map "grt" to LSP type_definition #34642 2025-06-26 06:24:13 -07:00
Lewis Russell
76de3e2d07 docs(api): document types using LuaCATS types
- Render Lua types in api.txt.

- Added `DictAs(name)` API type which acts the same as `Dict` (no parens)
  when generating the dispatchers, but acts the same as `Dict(name)`
  when generating docs.

- Added `Tuple(...)` API type which is the treated the as `Array` for
  generating the dispatchers, but is used to document richer types.

- Added `Enum(...)` API type to better document enums

- Improve typing of some API functions.

- Improve c_grammar to properly parse API types and replace string pattern
  logic in the parsers.

- Removed all the hardcoded type overrides in gen_eval_files.lua
2025-06-26 13:54:04 +01:00
Maria José Solano
3eaa6c5a66 fix(lsp): add RequestFailed error code constant #34645
Also remove `serverErrorStart/End` as [the spec](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#errorCodes)
says that they're deprecated and don't even represent a real error code.
2025-06-26 02:23:31 -07:00
zeertzjq
b40e658717 fix(column): missing redraw with virt_lines_leftcol (#34650)
Problem:  Missing number column redraw with virt_lines_leftcol.
Solution: Set virt_line_index to -1 when skipping a virtual line.
2025-06-26 05:16:19 +00:00
Justin M. Keyes
f0757ee590 refactor(ui.c): deduplicate validation logic #34647 2025-06-26 00:15:04 +00:00
zeertzjq
e5dae58704 vim-patch:037c32e: runtime(vim): Update base-syntax, match unamed register alias (#34648)
The unamed register may be referenced as both @" and @@.

Remove the unused vimPlainRegister syntax group.

fixes: vim/vim#17603.
closes: vim/vim#17605

037c32e428

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-26 00:14:31 +00:00
zeertzjq
c730374d44 vim-patch:fa0b069: runtime(doc): improve documentation style in editing.txt (#34646)
Usually, Vim's document provides example code after explanations.
However some part of the editing.txt doesn't follow the style, therefore
this commit modifies it so that it follows the usual style.

closes: vim/vim#17607

fa0b069728

Co-authored-by: mityu <mityu.mail@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-26 00:02:53 +00:00
Birdee
731e616a79 fix(vim.system): clear_env=true gives an invalid env to uv.spawn #33955
Problem:
In setup_env, some needed logic is bypassed when clear_env=true.

Solution:
Drop the early return in setup_env().

Co-authored-by: BirdeeHub <birdee@localhost>
2025-06-25 15:15:19 -07:00
luukvbaal
4369d7d9a7 fix(ui)!: decouple ext_messages from message grid #27963
Problem:  ext_messages is implemented to mimic the message grid
          implementation w.r.t. scrolling messages, clearing scrolled
          messages, hit-enter-prompts and replacing a previous message.
          Meanwhile, an ext_messages UI may not be implemented in a way
          where these events are wanted. Moreover, correctness of these
          events even assuming a "scrolled message" implementation
          depends on fragile "currently visible messages" global state,
          which already isn't correct after a previous message was
          supposed to have been overwritten (because that should not only
          happen when `msg_scroll == false`).

Solution: - No longer attempt to keep track of the currently visible
            messages: remove the `msg_ext(_history)_visible` variables.
            UIs may remove messages pre-emptively (timer based), or never
            show messages that don't fit a certain area in the first place.
          - No longer emit the `msg(_history)_clear` events to clear
            "scrolled" messages. This opens up the `msg_clear` event to
            be emitted when messages should actually be cleared (e.g.
            when the screen is cleared). May also be useful to emit before
            the first message in an event loop cycle as a hint to the UI
            that it is a new batch of messages (vim._extui currently
            schedules an event to determine that).
          - Set `replace_last` explicitly at the few callsites that want
            this to be set to true to replace an incomplete status message.
          - Don't store a "keep" message to be re-emitted.
2025-06-25 08:25:40 -07:00
phanium
0694ca8822 fix: map wincmd instead of remap #34635
Same issue: a59b052857
2025-06-25 06:33:58 -07:00
Christian Clason
684be736c1 ci: bump luals to 3.15.0 2025-06-25 12:27:00 +02:00
Shadman
5ae41ddde3 feat(prompt): prompt_getinput() gets current input #34491
Problem:
Not easy to get user-input in prompt-buffer before the user submits the
input. Under the current system user/plugin needs to read the buffer
contents, figure out where the prompt is, then extract the text.

Solution:
- Add prompt_getinput().
- Extract prompt text extraction logic to a separate function
2025-06-24 12:42:16 -07:00
luukvbaal
efd0fa55c8 fix(cmdline): validate 'incsearch' cursor for "cmdline_show" redraw (#34630)
Problem:  "cmdline_show" event may be emitted with an invalid cursor
          position, causing a redraw that will clear the match highlight.
Solution: Mark the cursor position as valid so that a "cmdline_show"
          callback that updates the screen does not clear the match highlight.
2025-06-24 16:37:51 +02:00
Shadman
25000be845 fix(prompt): "%" prefix repeated on newlines with formatoptions+=r #34584
Problem:
With `formatoptions+=r`, the prompt prefix "%" is treated as
comment-start (because of global default 'comments' option contains
"%"), so it gets added to the start of the line when a new line
is input in a prompt.

Solution:
Unset the 'comments' option in prompt buffers by default.
2025-06-24 06:52:24 -07:00
luukvbaal
5871d26779 fix(autocmd): 'cmdheight' OptionSet with valid window grids (#34619)
Problem:  OptionSet autocmd emitted with invalid grids after entering
          tabpage with different 'cmdheight'.
Solution: First call `tabpage_check_windows()` before changing 'cmdheight'.
          Add a test that exercises the `vim._extui` cmdline.
2025-06-24 10:25:46 +02:00
Christian Clason
6b6a4518c2 vim-patch:159d392: runtime(java): Complement the recognition of type parameter sections
In addition to matching type parameter sections of generic
classes and records and interfaces, match such sections of
generic methods and constructors.  As before, opt for it by
defining "g:java_highlight_generics"; the diamond form still
does not qualify for this kind of recognition.

And make section patterns agree with one another in syntax
items.

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.5
https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.4.4
https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.8.4

159d392427

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-06-24 10:23:00 +02:00
zeertzjq
7f3249fa0d vim-patch:9.1.1476: missing out-of-memory checks in cmdexpand.c (#34624)
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add missing out-of-memory checks, re-order code
          (John Marriott)

This commit does the following:
- in cmdline_pum_create() add out-of-memory check call of ALLOC_MULT()
- in expand_cmdline() move check for out-of-memory to cover both
  assignments of file_str
- in nextwild() don't free `p2` until after it's last use.

closes: vim/vim#17592

1be5b375c4

N/A patch:
vim-patch:9.1.1474: missing out-of-memory check in mark.c

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-06-24 07:51:20 +08:00
glepnir
69c379dc44 fix(quickfix): use correct lnume when appending (#34611)
Problem: ml_get error when updating quickfix buffer with nvim_buf_attach
Solution: use correct lnume parameter in changed_lines for append mode

Fix #34610
2025-06-23 23:48:55 +00:00
zeertzjq
92883b918c vim-patch:a931371: runtime(vim): Update base-syntax, match OR operator in :echo and :execute (#34623)
Don't match the OR operator in expressions as a trailing bar.

closes: vim/vim#17533

a931371694

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 23:17:43 +00:00
Maria José Solano
40c61bf205 refactor(lsp): use vim.lsp.buf_request_all internally (#34604) 2025-06-23 13:15:25 -04:00
Dmytro Meleshko
6942dec9b2 fix(health): highlight group conflicts with help #34616 2025-06-23 09:23:27 -07:00
Axel
fb5a51e775 fix(tui): avoid memory leak and compiler warning on Windows (#34225)
Problem:  On Windows, the value of `term` is overwritten without freeing
          the old allocated value, which may lead to a memory leak.
	  GCC also gives a "incompatible pointer type" warning about
	  passing `*term` to os_tty_guess_term().
Solution: Don't override the old allocated value, and copy the guessed
          value to `term` if its old value is NULL.
2025-06-23 22:07:52 +08:00
Maria José Solano
835f11595f feat(lsp): support annotated text edits (#34508) 2025-06-23 06:30:49 -07:00
glepnir
a5c55d200b fix(cmd): bar "|" not allowed after :fclose #34613
Problem: `:fclose` command failed when used with trailing `|` bar.
Solution: Add `TRLBAR` flag to fclose command to support trailing bar.
2025-06-23 05:41:31 -07:00
zeertzjq
462f7aaa8e vim-patch:a9b95c3: runtime(doc): remove wrong documentation of the :digraph command (#34608)
fixes: vim/vim#17583

a9b95c3d33

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-23 09:06:38 +08:00
zeertzjq
534ec8d447 vim-patch:9.1.1475: completion: regression when "nearest" in 'completeopt' (#34607)
Problem:  completion: regression when "nearest" in 'completeopt'
Solution: fix compare function (Girish Palya)

closes: vim/vim#17577

cd68f21f60

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-23 07:56:47 +08:00
zeertzjq
30f650420b Merge pull request #34606 from zeertzjq/vim-99b9847
vim-patch: Vim syntax updates
2025-06-23 07:44:26 +08:00
zeertzjq
233014f3ed vim-patch:dcff497: runtime(vim): Update base-syntax, match bare mark ranges
Remove unmatchable :normal {mark,register} matches. The arg to :normal
is now handled separately and contained marks and registers are no
longer matched.

closes: vim/vim#17571

dcff497373

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 07:23:21 +08:00
zeertzjq
69ef85a533 vim-patch:99b9847: runtime(vim): Update base-syntax, fix Vim9 :import expression comment handling
The required space in Vim9 continuation comments (#\ comment) was
accidentally removed in commit 6acca4b as trailing whitespace.

closes: vim/vim#17573

99b9847bd8

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-23 07:22:53 +08:00
Luis Calle
cfb4d3d2f2 docs(treesitter): fix parameter list for Query:iter_matches (#34553) 2025-06-22 10:38:00 +00:00
zeertzjq
ee2fc31b36 vim-patch:9.1.1473: inconsistent range arg for :diffget/diffput (#34588)
Problem:  inconsistent range arg for :diffget/diffput
Solution: fix the range specification, place the cursor for :diffput and
          :diffget consistently on the last line (Yee Cheng Chin)

Previously, `:<range>diffget` only allowed using 1 or above in the range
value, making it impossible to use the command for a diff block at the
beginning of the file. Fix the range specification so the user can now
use 0 to specify the space before the first line. This allows
`:0,$+1diffget` to work to retrieve all the changes from the other file
instead of missing the first diff block. Also do this for `:diffput`.

Also, make `:diffput` work more similar to `:diffget`. Make it so that
if the cursor is on the last line and a new line is inserted in the
other file, doing `:diffput` will select that diff block below the line,
just like `:diffget` would.

Also clean up the logic a little bit for edge cases and for handling
line matched diff blocks better.

closes: vim/vim#17579

d75ab0cbf5

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-06-22 08:00:17 +08:00
Gabriel Ford
0980617c0d build(msvc): suppress msvc build warning for different enum types (#34591)
Problem: Currently our CI is failing due to msvc warning 5287. This
warning tells us that we are performing a binary expression with enums
of two different types. In this case however, this is clearly intended
and valid.

Solution: Suppress warning 5287 on the line this occurs.
2025-06-22 06:54:51 +08:00
phanium
d0aedd36df fix(extui): set 'modifiable', 'noswapfile' for buffers (#34582)
Problem:  UI buffers may be 'unmodifiable' and use a 'swapfile'.
Solution: Set the 'modifiable' and 'noswapfile' options.

Co-authored-by:phanium <91544758+phanen@users.noreply.github.com>
2025-06-20 17:32:07 +02:00
Shadman
cacb4ceeb4 test(prompt): nvim_paste in prompt buffer #34583 2025-06-20 07:07:27 -07:00
zeertzjq
927dc3c2c4 vim-patch:476b65e: runtime(doc): mention using <script> instead of <sfile> in :autocmd (#34580)
fixes: vim/vim#17569

476b65ebac
2025-06-19 23:08:01 +00:00
Yi Ming
528381587b refactor(lsp): redesign LSP folding state #34469 2025-06-19 06:23:40 -07:00
Riley Bruins
0dc900d744 fix(lsp): clear document_color autocmds #34573
**Problem:** When enabling document_color multiple times for the same
buffer (or when toggling it on and off), duplicate autocmds are created
since the previous ones are not cleared.

**Solution:** Clear the appropriate buffer-local autocmds when
enabling/disabling document color functionality.
2025-06-19 03:48:12 -07:00
Oskar Haarklou Veileborg
150513a163 fix(lsp) type annotation for vim.lsp.Config.cmd #34574
The type annotation for `vim.lsp.ClientConfig.cmd` was changed,
but the update was not propagated to `vim.lsp.Config`.
2025-06-19 03:35:13 -07:00
Christian Clason
487112d674 vim-patch:9.1.1468: filetype: bright(er)script files are not recognized
Problem:  filetype: bright(er)script files are not recognized
Solution: detect *.bs files as brighterscript filetype and *.brs as
          brightscript filetype, include filetype plugins (Riley Bruins)

closes: vim/vim#17566

03e5ee25fd

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:38 +02:00
Christian Clason
2379fb053a vim-patch:8b92af6: runtime(hgcommit): set comments and commentstring options in filetype plugin
closes: vim/vim#17480

8b92af645c

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:26 +02:00
Christian Clason
255f313cf6 vim-patch:736cd18: runtime(ishd): set comments and commentstring options in filetype plugin
closes: vim/vim#17490

736cd18671

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-19 11:10:26 +02:00
Christian Clason
f038213617 vim-patch:e4c157b: runtime(nroff,groff): update commentstyle in filetype plugins
closes: vim/vim#17516

e4c157b9c1

Co-authored-by: jtmr05 <62111562+jtmr05@users.noreply.github.com>
2025-06-19 11:10:26 +02:00
zeertzjq
fb8dba413f vim-patch:9.1.1467: too many strlen() calls (#34572)
Problem:  too many strlen() calls
Solution: Change expand_env() to return string length
          (John Marriott)

This commit does the following changes:
- In expand_env_esc():
  - return the length of the returned dst string.
  - refactor to remove some calls to STRLEN() and STRCAT()
  - add check for out-of-memory condition.
- Change call sites in various source files to use the return value

closes: vim/vim#17561

fff0132399

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-06-19 02:21:33 +00:00
zeertzjq
8ed6f00ab0 vim-patch:9.1.1471: completion: inconsistent ordering with CTRL-P (#34571)
Problem:  completion: inconsistent ordering with CTRL-P
          (zeertzjq)
Solution: reset compl_curr_match when using CTRL-P (Girish Palya)

fixes: vim/vim#17425
closes: vim/vim#17434

5fbe72edda

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-19 09:24:13 +08:00
zeertzjq
0456d75517 vim-patch:8311e7d: runtime(vim): fix incorrect highlighting of User autocmds (#34570)
There is no pattern after the user event name. The user event name is
the pattern.

closes: vim/vim#17568

8311e7d6b4
2025-06-18 23:49:15 +00:00
Bruce Wen
3594c213a7 fix(diagnostics): validate opts.signs #34565 2025-06-18 10:26:28 -07:00
Phạm Bình An
8e17b72094 docs: vim_diff.txt #34502
Problem:
- Missing some important Vim features
- Since Nvim 0.5, package.path and package.cpath don't include
  `'runtimepath'` (thought `require()` can still find modules in
  `runtimepath`)

Closes #33938

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-06-18 06:19:00 -07:00
Eisuke Kawashima
5cf135f9a0 vim-patch:9.1.1466: filetype: not all lex files are recognized
Problem:  filetype: not all lex files are recognized
Solution: detect *.ll as lex, llvm or lifelines filetype, depending on
          the content (Eisuke Kawashima)

closes: vim/vim#17560

48295111e5

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-18 14:37:06 +02:00
Julian Visser
32f30c4874 feat(lsp): pass resolved config to cmd() #34550
Problem:
In LSP configs, the function form of `cmd()` cannot easily get the
resolved root dir (workspace). One of the main use-cases of a dynamic
`cmd()` is to be able to start a new server  whose binary may be located
*in the workspace* ([example](https://github.com/neovim/nvim-lspconfig/pull/3912)).

Compare `reuse_client()`, which also receives the resolved config.

Solution:
Pass the resolved config to `cmd()`.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-06-18 04:52:17 -07:00
Justin M. Keyes
aa8c86e8f3 Merge #34541 docs 2025-06-18 03:46:28 -07:00
Yi Ming
237bb9cb59 docs(ui): type annotations for options #33983 2025-06-18 03:20:18 -07:00
Justin M. Keyes
cb2367a1e2 docs: api, misc 2025-06-18 12:13:55 +02:00
Justin M. Keyes
c8e54bf49d docs: deprecate <sfile> 2025-06-18 12:12:23 +02:00
luukvbaal
3b85046ed5 fix(messages): "list_cmd" kind for :command, :version (#34529)
Problem:  No ext_messages kind for the :command, :version commands.
          :version is emitted as multiple events.
Solution: Assign them the "list_cmd" kind. Use `msg_put*` to properly
          format the message as a single event.
2025-06-18 07:54:49 +02:00
zeertzjq
8af2aea24f Merge pull request #34492 from nenahp/fix-append-cursor
fix: cursor shape don't resume after `:append`
2025-06-18 06:59:05 +08:00
Riley Bruins
17c18efbe5 fix(lsp): support v:count in selection_range() #34551
Co-authored-by: Yi Ming <ofseed@foxmail.com>
2025-06-17 14:10:57 -07:00
Riley Bruins
b3c78f4b3c test(lsp): return tables instead of deserializing strings #34554 2025-06-17 13:41:49 -07:00
phanium
2c9d21f722 fix: cursor shape don't resume after :append
Problem: cursor shape don't resume after `:append`.
e.g. `seq 1000 | nvim --clean +"se gcr+=c:ver25" -`

Solution: emit missing ui event.
2025-06-18 00:40:22 +08:00
Shadman
286371b4d2 feat(prompt): multiline prompt input #33371
Problem:
Cannot enter multiline prompts in a buftype=prompt buffer.

Solution:
- Support shift+enter (`<s-enter>`) to start a new line in the prompt.
- Pasting multiline text via OS paste, clipboard, "xp, etc.
- A/I in editable region works as usual.
- i/a/A/I outside of editable region moves cursor to end of current
  prompt.
- Support undo/redo in prompt buffer.
- Support o/O in prompt buffer.
- Expose prompt location as `':` mark.
2025-06-17 08:46:57 -07:00
phanium
496691f985 docs: vim.fs.dir.Opts type #34546
Follow the pattern of vim.fs.find.Opts
2025-06-17 07:14:25 -07:00
Maria José Solano
e74753a221 fix(docs): callback annotation for vim.ui.input #34507 2025-06-17 06:37:27 -07:00
glepnir
006361fc6b fix(api): buffer updates in quickfix buffer #31105
Problem: Buffer events (specifically on_bytes callbacks) weren't triggered when the
quickfix list was modified, preventing buffer change notifications.

Solution: Add code to send both bytes and lines change notifications after
quickfix buffer updates to properly trigger all attached callbacks.
2025-06-17 06:31:14 -07:00
someoneinjd
1bf9a07b3e build: slience new clang-tidy warnings #34539
Problem: The new cert-arr39-c and bugprone-tagged-union-member-count
checks introduced in clang-tidy 20 fail on Neovim's codebase, even
though the code is correct.

Solution: Disable these two checks by modifying the .clang-tidy
configuration file.
2025-06-17 02:19:57 -07:00
Christian Clason
6976ff57dd vim-patch:152a450: runtime(sh): reset g:sh_fold_enabled after outputting its value in syntax script
fixes: vim/vim#10701
closes: vim/vim#17557

152a450d88

Co-authored-by: hakkadaikon <hakkadaikon@yahoo.co.jp>
2025-06-17 10:44:37 +02:00
Maria José Solano
cd06e0c9d6 fix(lsp): include client ID when receiving unknown fold kind (#34535) 2025-06-16 19:36:06 -07:00
zeertzjq
ae0981070e vim-patch:9.1.1464: gv does not work in operator-pending mode (#34534)
Problem:  gv does not work in operator-pending mode
          (liushapku)
Solution: remove the check for checkclearop in nv_gv_cmd()
          (phanium)

fixes: vim/vim#3666
closes: vim/vim#17551

cb27992cda

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-06-17 00:27:41 +00:00
zeertzjq
3e984cf02b vim-patch:9.1.1463: Integer overflow in getmarklist() after linewise operation (#34532)
Problem:  Integer overflow in getmarklist() after linewise operation.
Solution: Don't add 1 to MAXCOL (zeertzjq)

related: neovim/neovim#34524
closes: vim/vim#17552

93318a9933
2025-06-16 23:24:52 +00:00
zeertzjq
5647b45e69 refactor(generator): use fmt() for string.format() more (#34528) 2025-06-17 06:50:51 +08:00
zeertzjq
24bb110588 vim-patch:f548ec4: runtime(keymaps): Add Azerbaijani keymap (#34527)
closes: vim/vim#17541

f548ec46e4

Co-authored-by: Rasul Samadzade <rasul.samadzade@protonmail.com>
2025-06-17 06:47:05 +08:00
Riley Bruins
35756022cb fix(lsp): advertise supported fold kinds (#34461)
This commit also makes it so that folds which have an unsupported fold
kind have their `kind` ignored.
2025-06-16 16:05:00 -04:00
Riley Bruins
492ea28612 feat(lsp): handle disabled code actions (#34453)
This commit also makes it so that disabled code actions are not
displayed unless the trigger kind is "Invoked".
2025-06-16 12:41:42 -04:00
Maria José Solano
9f99bf48ea fix(lsp): add missing argument validations (#34519) 2025-06-16 06:19:20 -07:00
someoneinjd
1d7823451e fix(lsp): use vim.notify for all message types #34489
Problem: Currently, vim.notify is only used to display messages when the
message type is Error.

Solution: Use vim.notify to display messages for all message types.
2025-06-16 05:02:59 -07:00
bfredl
6ad2a13054 Merge pull request #34495 from bfredl/debwithrelinfo
fix(build): disable problematic marktree assert in RelWithDebInfo builds
2025-06-16 12:27:41 +02:00
bfredl
576e8f62c2 fix(build): disable problematic marktree assert in RelWithDebInfo builds
Workaround (not a fix) for #27196 and for #33067

Asserts are meant to apply to debug builds but not release
builds for users. However the intermediate RelWithDebInfo
build type is quite often used by end users, so we might
want to disable certain problematic asserts there, while
still preserving them in Debug mode for CI.
2025-06-16 12:03:36 +02:00
luukvbaal
b2722181b0 fix(edit): clear showcmd after clearing last put char (#34517)
Problem:  Screen may be updated by a msg_showcmd event before '"' is
          cleared from the screen with register insertion.
Solution: Emit the msg_showcmd event before clearing the '"'.
2025-06-16 11:03:35 +02:00
Lewis Russell
5fe582448c fix(treesitter): enable a gc for wasmtime 2025-06-16 09:19:17 +01:00
Lewis Russell
8cfb993fdf docs: support overloads and async 2025-06-16 09:18:42 +01:00
zeertzjq
b92e3889fe vim-patch:631a50c: runtime(doc): mention cannot ignored events in eventignorewin (#34522)
closes: vim/vim#17545

631a50ceb9

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-16 02:14:20 +00:00
zeertzjq
4b2c2eb120 docs(meta): fix incorrect bar -> backtick replacement (#34520) 2025-06-16 09:06:07 +08:00
Maria José Solano
00ad477419 fix(lsp): use correct deprecation function (#34518) 2025-06-15 16:15:55 -07:00
luukvbaal
29f2cb89f0 fix(messages): add append parameter to history entries (#34467)
Problem:  The "append" parameter added in abb40ece is missing from
          history entries, resulting in different message formatting
          for "g<".
Solution: Add "append" field to message history entries.

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-06-15 23:36:41 +02:00
Christian Clason
5ea6a022c0 build(deps): bump tree-sitter-query to v0.6.2 2025-06-15 13:37:31 +02:00
luukvbaal
5046ef4c8f fix(extui): clear cmdline buffer for first message (#34490)
Problem:  Cmdline buffer is not cleared for a new message (since c973c7ae),
          resulting in an incorrect spill indicator. When the cmdline
          buffer is cleared, "msg_row" is not invalidated, resulting in
          an error. The extui module is untested.
          Return value of `vim.ui_attach()->callback` is undocumented.
Solution: Clear the cmdline buffer for the first message in an event
          loop iteration. Ensure msg_row passed as end_row does not
          exceed buffer length.
          Add `messages_spec2.lua` to test the extui module, keeping in
          mind that test coverage will greatly increase if this UI is made
          the default. As such, only tests for specific extui functionality
          unlikely to be covered by tests leveraging the current message grid.
          Document the return value of `vim.ui_attach()->callback`, it seems
          to make sense, and is also used to suppress remote UI events in
          `messages_spec2.lua`.
2025-06-15 12:55:01 +02:00
luukvbaal
0d658660c2 fix(window): don't enter unfocusable or hidden prevwin (#34486)
Problem:  When closing a floating window, the next window to be entered
          may be unfocusable or hidden.
Solution: Don't enter prevwin when it is unfocusable or hidden. Enter
          firstwin instead (like for when prevwin is no longer valid).
2025-06-14 23:42:23 +02:00
glepnir
c7f38e3bc8 fix(api): nvim_parse_cmd parses :map incorrectly #34068
Problem: nvim_parse_cmd() incorrectly splits mapping commands like
into three arguments instead of preserving whitespace in the RHS.

Solution: Add special handling for mapping commands to parse them as exactly
two arguments - the LHS and the RHS with all whitespace preserved.
2025-06-14 10:17:56 -07:00
dundargoc
4367441213 docs: misc
Co-authored-by: Jan Weinkauff <jan@weinkauff.cloud>
Co-authored-by: MeanderingProgrammer <meanderingprogrammer@gmail.com>
Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-06-14 17:24:36 +02:00
zeertzjq
1deba926c4 vim-patch:1ded411: runtime(debcontrol): add hurd-amd64 architecture to syntax script (#34496)
closes: vim/vim#17525

1ded411a41

Co-authored-by: Yuqian Yang <crupest@crupest.life>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-14 19:44:46 +08:00
bfredl
17571bc4c0 Merge pull request #34494 from huaxk/update-deps-hash
update deps hash for zig 0.14.0
2025-06-14 11:54:45 +02:00
huaxk
d21e2463fd fix: update deps hash for zig 0.14.0 2025-06-14 17:19:33 +08:00
Riley Bruins
76d213efbe feat(lsp): support multiline semantic tokens #34458 2025-06-13 08:30:08 -07:00
Justin M. Keyes
8001276bd0 docs: vim.fs., diagnostics, lsp #34402 2025-06-13 07:49:21 -07:00
Riley Bruins
1d5b3b5b4c feat(treesitter)!: apply offset! directive to all captures #34383
This commit changes the `offset!` directive so that instead of setting a
`metadata.range` value for the entire pattern, it will set a
`metadata.offset` value. This offset will be applied to the range only
in `vim.treesitter.get_range()`, rather than at directive application
time. This allows the offset to be applied to any and all nodes captured
by the given pattern, and removes the requirement that `#offset!` be
applied to only a single node.

The downside of this change is that plugins which read from
`metadata.range` may be thrown off course, but such plugins should
prefer `vim.treesitter.get_range()` when retrieving ranges anyway.

Note that `#trim!` still sets `metadata.range`, and
`vim.treesitter.get_range()` still reads from `metadata.range`, if it
exists.
2025-06-13 06:42:10 -07:00
Luuk van Baal
9ec6c19c67 docs(extui): rename box->msg, more->pager, prompt->dialog
Includes breaking changes to the `opts` layout. "box" doesn't really
describe anything other than a floating window so was an unwanted synonym.
2025-06-13 14:28:01 +02:00
Luuk van Baal
76f76fb083 fix(extui): only append messages exceeding 'cmdheight' to "more"
Problem:  8defe1a declared the "more" window the most convenient place to
          route messages to if it is already open for msg.pos == 'cmd'.
          In usage, this doesn't appear to be the case. Appending messages
          as added in that commit is still useful, but should only be done
          for messages that spill 'cmdheight'.
Solution: Only append messages exceeding 'cmdheight' to the more window.
          To do this, instead of immediately writing to the more buffer,
          write to the cmd buffer and calculate its height. Then copy the
          text and its highlights to the more buffer.
2025-06-13 14:28:01 +02:00
luukvbaal
3e30323135 fix(coverity/554963): preallocate msg.items to avoid FORWARD_NULL #34484
*** CID 554963:           (FORWARD_NULL)
/src/nvim/memline.c: 3484             in findswapname()
3478                 if (swap_exists_action != SEA_NONE) {
3479                   kv_printf(msg, _("Swap file \""));
3480                   kv_printf(msg, "%s", fhname);
3481                   kv_printf(msg, _("\" already exists!"));
3482                   char *run_but = _("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort");
3483                   char *but = _("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort");
>>>     CID 554963:           (FORWARD_NULL)
>>>     Passing null pointer "msg.items" to "do_dialog", which dereferences it.
3484                   choice = (sea_choice_T)do_dialog(VIM_WARNING, _("VIM - ATTENTION"), msg.items,
3485                                                    proc_running ? run_but : but, 1, NULL, false);
3486
3487                   // compensate for missing "Delete it" button
3488                   choice += proc_running && choice >= 4;
3489                   // pretend screen didn't scroll, need redraw anyway
/src/nvim/memline.c: 3492             in findswapname()
3486
3487                   // compensate for missing "Delete it" button
3488                   choice += proc_running && choice >= 4;
3489                   // pretend screen didn't scroll, need redraw anyway
3490                   msg_reset_scroll();
3491                 } else {
>>>     CID 554963:           (FORWARD_NULL)
>>>     Passing null pointer "msg.items" to "msg_outtrans", which dereferences it.
3492                   msg_outtrans(msg.items, 0, false);
3493                 }
3494                 no_wait_return--;
3495                 kv_destroy(msg);
3496                 xfree(fhname);
3497               }
2025-06-13 05:19:30 -07:00
luukvbaal
29c8dabd41 fix(insexpand): update showmode when updating the screen (#34466)
Problem:  Eagerly calling `showmode()` to update showmode where setting
          `redraw_showmode` to be updated later would suffice.
Solution: Set `redraw_showmode` instead of calling `showmode()` if not
          showing a busy message followed by a `ui_flush()`.
2025-06-13 10:37:19 +02:00
Christian Clason
1ede826e04 vim-patch:d296af9: runtime(masm): set 'com' and 'cms' options in ftplugin
closes: vim/vim#17484

d296af94d0

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-13 09:56:35 +02:00
Christian Clason
beee60f3a0 vim-patch:85f0711: runtime(zimbu): set 'commentstring' option in ftplugin
closes: vim/vim#17478

85f0711b4e

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-13 09:56:35 +02:00
zeertzjq
90b682891d vim-patch:91af4c4: runtime(doc): improve the wording of 'sts', 'varts' and 'varsts' values (#34480)
closes: vim/vim#17522

91af4c4180

Co-authored-by: Damien Lejay <damien@lejay.be>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-13 00:53:48 +00:00
Riley Bruins
82d0883c2d fix(lsp): correct diagnostic data support and related info capabilities (#34454) 2025-06-12 14:00:42 -04:00
Tiago Inaba
7486c2f6aa feat(lsp): <Plug> mapping for signature help cycling #34039
Replace direct function mappings with `<Plug>` mappings for cycling
through overloaded signatures, providing better customization options
for users. This change keeps the default mapping (`<C-s>`) for cycling
if `<Plug>(nvim.lsp.ctrl-s)` is not mapped.
2025-06-12 10:56:39 -07:00
Riley Bruins
f99e3a8a2a feat(lsp): incremental selection via "textDocument/selectionRange" #34011
Select outwards with "an" and inwards with "in" in Visual mode.
Ranges are reset when leaving Visual mode.
2025-06-12 09:25:19 -07:00
Andre Toerien
a9b8a8dc6c fix(lsp): _cancel_all_requests() tries to cancel completed requests #34105
Problem:
The cancel function returned by `vim.lsp.buf_request` tries to cancel
all the requests, including those that have already been completed,
causing "Cannot find request with id ... whilst attempting to cancel"
errors to be logged when it is called.

Solution:
Only cancel the requests that are present in `client.requests`.
2025-06-12 09:21:53 -07:00
Antoine
ac12dc49cc fix(clipboard): enable cache for function providers #34470
Problem:
With these settings, copy/pasting `blockwise-visual` (with `CTRL+V`)
incorrectly pastes as a `linewise` mode because `regtype` is ignored:

    vim.opt.clipboard = 'unnamedplus'
    vim.g.clipboard = 'osc52'

To reproduce: press `CTRL+V` and select some characters press `p` and
observe that it is pasted in `linewise` mode.

Solution:
Enable the [clipboard.vim](https://github.com/neovim/neovim/blob/master/runtime/autoload/provider/clipboard.vim#L281-L283))
cache for function providers, so that `regtype` is maintained for the OSC52
clipboard provider.
2025-06-12 09:18:23 -07:00
luukvbaal
d86d4bacc1 fix(messages): make swapfile attention message part of prompt (#34414)
Problem:  The swapfile attention message is not repeated after clearing
          the screen.
          After clearing the screen `msg_scrolled` is reset without
          clearing other related variables, causing an assert.
Solution: Make the attention message part of the confirm prompt.
          Call `msg_reset_scroll()`.
2025-06-12 11:57:17 +02:00
bfredl
221b6ddf1c Merge pull request #34412 from bfredl/ui_buf
fix(msgpack): flush incomplete big UI event before packing RPC event
2025-06-12 11:35:33 +02:00
bfredl
b8ee354f12 fix(msgpack): flush incomplete big UI event before packing RPC event
This might happen, e.g. if we send a fast RPC reply in a os_breakcheck()
in the middle of redrawing and big ui_ext events are produced.

fixes #31316
2025-06-12 11:05:38 +02:00
luukvbaal
dc05598d02 fix(cmdline): set search cursor after ui_flush() (#34418)
Problem:  vim.ui_attach cmdline events emitted with an ephemeral cursor
          position that is only used as the start of the search.
Solution: Delay setting the cursor position until after ui_flush().
2025-06-12 08:53:10 +02:00
luukvbaal
66e4784f5a fix(float): ensure relative window grid is allocated (#34459)
Problem:  Uninitialized grid for a "win" relative float when redrawing
          just after it has been opened.
Solution: Ensure window grid is allocated or assigned the default grid.
2025-06-12 08:51:29 +02:00
zeertzjq
5f00e6adaf vim-patch:5128920: runtime(vim): Update base-syntax, improve function definition matching (#34463)
- Fix highlighting of function names including /fu\%[nction]/ (E.g.,
  s:func(), foo.fu(), fu.func())
- Match :delfunction argument.

Reported by Aliaksei Budavei.

closes: vim/vim#17428

51289207f8

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-12 08:05:20 +08:00
zeertzjq
3a2ac2300b vim-patch:9.1.1454: tests: no test for pum at line break position (#34462)
Problem:  Missing test case for pum display on a wrapped line.
Solution: Add a test case to cover pum behavior at line break positions.
          (glepnir)

closes: vim/vim#17520

6cc9bd4001

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-12 08:04:36 +08:00
zeertzjq
47df8f5a4b vim-patch:053aee0: runtime(doc): add more pointers to 'completeopt' (#34460)
Before this commit, I had trouble finding information about configuring
the insert mode completion. In particular, it was not clear that the
'wildopt' config that I already had in my vimrc does not apply here.

Also, `insert.txt` barely mentioned 'completeopt' except when
describing popups (I was more interested in bash-like behavior
where the unique prefix of all completions is completed first).

I'm hoping these edits will make the relevant docs easier to find.

closes: vim/vim#17515

053aee01f7

Co-authored-by: Ilya Grigoriev <ilyagr@users.noreply.github.com>
2025-06-12 07:32:07 +08:00
glepnir
6bee2f686f fix(shada): prevent use-after-free when mapping file marks (#34446)
Problem: When ignore_buf skips buffers during initialization,
shada_read_when_writing uses entry.data.filemark.fname directly
as map key, but later frees the entry, leaving dangling pointers.

Solution: Always create independent copies of filenames as map keys
using xstrdup() for new items, and free all keys during cleanup.

Fix #34440
2025-06-11 22:31:48 +00:00
zeertzjq
6a71239cd5 fix(terminal): don't disable scrolloff for non-terminal buffers (#34451) 2025-06-11 14:47:06 +00:00
Gregory Anders
de87ceb3be feat(tui): support APC queries in TermResponse (#34426)
Add support for APC sequences to libtermkey and the TermResponse
autocommand event.
2025-06-11 08:26:58 -05:00
fortime
966b1da183 fix(editorconfig): a custom property is treated as a section (#34445)
Problem: A custom property containing a pair of square brackets will be
treated as a section.
Solution: Change the logic parsing a section, remove the first match
regex `%b[]`.

Signed-off-by: fortime <palfortime@gmail.com>
2025-06-11 08:26:38 -05:00
Christian Clason
7aafbca510 vim-patch:c413ac7: runtime(java): Match raw-, non-generic-, and generic-type names of "java.lang"
And only match innermost element types of parameterised
array types.

References:
https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.8
https://docs.oracle.com/javase/specs/jls/se21/html/jls-6.html#jls-6.1
https://docs.oracle.com/javase/specs/jls/se21/html/jls-10.html

closes: vim/vim#17499

c413ac7068

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-06-11 10:15:16 +02:00
Christian Clason
719c7e2312 vim-patch:138fb95: runtime(reva): set 'cms' option in ftplugin, update URL
closes: vim/vim#17488

138fb951e0

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-11 10:15:16 +02:00
Christian Clason
8cd0ef06bb vim-patch:a0316cd: runtime(abap): set 'comments' and 'commentstring' option in ftplugin
Reference:
https://en.wikipedia.org/wiki/ABAP#Comments

closes: vim/vim#17489

a0316cd299

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-11 10:15:16 +02:00
Christian Clason
b1aed2b40a vim-patch:572d460: runtime(gdshader): add comments and commentstring to ftplugin
closes: vim/vim#17500

572d46035f

Co-authored-by: Maxim Kim <habamax@gmail.com>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-11 10:15:16 +02:00
Christian Clason
677a50bb26 vim-patch:30cf017: runtime(8th): updated 8th syntax script
closes: vim/vim#17505

30cf017f2a

Co-authored-by: Ron Aaron <ron@aaron-tech.com>
2025-06-11 10:15:16 +02:00
Riley Bruins
bac133e4b6 fix(lsp): announce diagnostic tag support (#34436)
This commit also adds a type annotation to the returned client
capabilities table, because without it lua_ls does not provide
autocompletion for the fields within the table.
2025-06-10 21:26:06 -07:00
zeertzjq
fb7a234f01 test: value of has("gui_running") after :restart (#34439) 2025-06-11 10:41:56 +08:00
zeertzjq
37d6ac8a15 test(screen): still match by full row when {MATCH:} is present (#34437)
Add '^' and '$' around the pattern. This makes it less likely to make
mistakes of when writing tests with {MATCH:}, as most such tests have
text before and after {MATCH:}.
2025-06-11 01:56:12 +00:00
zeertzjq
1abcd9fe28 vim-patch:9.1.1452: completion: redundant check for completion flags (#34434)
Problem:  completion: redundant check for completion flags
Solution: refactor code slightly (glepnir)

refactor: nest fuzzy completion logic to avoid duplicate flag checks

- Combine COT_FUZZY checks into single nested condition
- Reduce redundant bitwise operations in ins_compl_new_leader()

closes: vim/vim#17494

ecf8f15884

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-11 00:06:48 +00:00
zeertzjq
79ce71430f vim-patch:bfa1636: runtime(doc): update documentation on tabstop settings (#34433)
Unify the treatment of tabstop, correct errors and deprecate smarttab
usage.

closes: vim/vim#17444

bfa16364f1

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-10 23:53:35 +00:00
zeertzjq
8ea18de959 vim-patch:274efcc: runtime(vim): Update base-syntax, contain let-heredocs (#34431)
Limit heredoc matches to assignment statements.  Matching these at the
top level is very slow.

closes: vim/vim#17473

274efcc7e6

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-10 23:35:59 +00:00
zeertzjq
612f8e7c9e vim-patch:9.1.1450: Session has wrong arglist with :tcd and :arglocal (#34430)
Problem:  Session has wrong arglist with :tcd and :arglocal.
Solution: Also use absolute path for :argadd when there is tabpage-local
          directory (zeertzjq).

related: neovim/neovim#34405
closes: vim/vim#17503

a304e49790
2025-06-10 23:35:42 +00:00
zeertzjq
cbc9d9b9c7 Merge pull request #34429 from zeertzjq/vim-9.1.1447
vim-patch:9.1.{1447,1449}
2025-06-11 07:05:25 +08:00
zeertzjq
5075043823 vim-patch:9.1.1449: typo in pum_display()
Problem:  typo in pum_display()
Solution: update the comment, remove empty new lines
          (glepnir)

closes: vim/vim#17506

ed4eb74f7a

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-11 06:42:32 +08:00
zeertzjq
ac772706cc vim-patch:9.1.1447: completion: crash when backspacing with fuzzy completion
Problem:  completion: crash when backspacing with fuzzy completion
Solution: Don't dereference compl_first_match when it's NULL
          (zeertzjq).

related: neovim/neovim#34419
closes: vim/vim#17511

91782b4aeb
2025-06-11 06:42:28 +08:00
Gregory Anders
b5aef05b8f fix(terminal): fix OSC 8 parsing (#34424)
vterm does not send us the terminator in the string fragment. Our OSC 8
parser assumed that it was and therefore treated short strings as
invalid (as it assumed it was missing a terminator).
2025-06-10 15:52:45 -05:00
zeertzjq
228ff6e547 Merge pull request #34411 from zeertzjq/tui-crash
fix(tui): wait for embedded server's exit code
2025-06-10 23:27:14 +08:00
zeertzjq
c2aa5fd915 test: :restart works on Windows 2025-06-10 23:00:38 +08:00
zeertzjq
2dba5abcb2 fix(tui): wait for embedded server's exit code
Uses the undocumented "error_exit" UI event for a different purpose:
When :detach is used on the server, send an "error_exit" with 0 `status`
to indicate that the server shouldn't wait for client exit.
2025-06-10 23:00:21 +08:00
glepnir
b98eefd803 fix(shada): prevent 'nobuflisted' buffers in v:oldfiles #34373
Problem: 'nobuflisted' buffers are incorrectly added to v:oldfiles.

Solution: Use ignore_buf() consistently in shada_write() for buffer
marks processing.
2025-06-10 06:50:16 -07:00
Christian Clason
93925fe020 vim-patch:446a98f: runtime(rpl): set commentstring option in ftplugin
closes: vim/vim#17487

446a98f0b6

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
Christian Clason
4387c26691 vim-patch:9e9fe66: runtime(postscr): set commentstring option in ftplugin
closes: vim/vim#17486

9e9fe66437

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
Christian Clason
b7cb7fe51c vim-patch:de535cf: runtime(occam): set commentstring option in ftplugin
closes: vim/vim#17485

de535cfe77

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
Christian Clason
5394320a67 vim-patch:df63097: runtime(lprolog): set com, cms options for lambda prolog
closes: vim/vim#17481

df630970bf

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
Christian Clason
2f167c53ac vim-patch:aa9fc8e: runtime(vue): set 'com' and 'cms' options in ftplugin
closes: vim/vim#17479

aa9fc8eb94

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-06-10 09:10:59 +02:00
Christian Clason
2c80b05cbd vim-patch:9.1.1446: filetype: cuda-gdb config files are not recognized
Problem:  filetype: cuda-gdb config files are not recognized
Solution: detect .cuda-gdbinit and cuda-gdbinit files as gdb filetype
          (Wu Zhenyu)

closes: vim/vim#17471

601cfa9a23

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2025-06-10 09:10:47 +02:00
zeertzjq
bcba067dc2 vim-patch:9.1.1445: negative matchfuzzy scores although there is a match (#34409)
Problem:  negative matchfuzzy scores although there is a match
          (Maxim Kim)
Solution: reset the score if a match has been found but the score is
          negative (Girish Palya)

The fuzzy algorithm may miss some matches in long strings due to recursion
limits. As a result, the score can end up negative even when matches exist.
In such cases, reset the score to ensure it is non-negative.

fixes: #vim/vim#17449
closes: vim/vim#17469

328332b0b0

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-10 00:47:14 +00:00
zeertzjq
7a58cf4b96 vim-patch:9.1.1443: potential buffer underflow in insertchar() (#34408)
Problem:  potential buffer underflow in insertchar()
Solution: verify that end_len is larger than zero
          (jinyaoguo)

When parsing the end-comment leader, end_len can be zero if
copy_option_part() writes no characters. The existing check
unconditionally accessed lead_end[end_len-1], causing potential
underflow when end_len == 0.

This change adds an end_len > 0 guard to ensure we only index lead_end
if there is at least one character.

closes: vim/vim#17476

82a96e3dc0

Co-authored-by: jinyaoguo <guo846@purdue.edu>
2025-06-10 08:20:55 +08:00
zeertzjq
78e2f62516 vim-patch:9.1.1442: tests: Test_diff_fold_redraw() is insufficient (#34407)
Problem:  tests: Test_diff_fold_redraw() is insufficient
          (after v9.1.1439, Christ van Willegen)
Solution: improve the test (Gary Johnson)

The original Test_diff_fold_redraw() function, added 2025-06-08 at patch
9.1.1439, had a bug and didn't do a very good job of testing the fold
behavior.  This new version is simpler and more thorough.

The bug was that it checked the fold state of one window twice instead
of checking both windows.

closes: vim/vim#17492

69565e3618

Co-authored-by: Gary Johnson <garyjohn@spocom.com>
2025-06-10 08:20:45 +08:00
zeertzjq
4fb36ea95f Merge pull request #34381 from zeertzjq/vim-9.1.1441
vim-patch:9.1.{1441,1444}
2025-06-10 08:01:50 +08:00
zeertzjq
72f4bb9ae8 vim-patch:9.1.1444: Unused assignment in set_fuzzy_score()
Problem:  Unused assignment in set_fuzzy_score() (after 9.1.1441).
Solution: Remove it (zeertzjq).

closes: vim/vim#17472

de1c7ac432
2025-06-10 07:27:55 +08:00
zeertzjq
bcfc22853a vim-patch:9.1.1441: completion: code can be improved
Problem:  completion: code can be improved
Solution: remove reposition_match() and use mergesort_list(),
          for fuzzy completion, sort by fuzzy score immediately after
          setting a new leader (Girish Palya)

closes: vim/vim#17460

b8ee1cf56e

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-10 07:27:09 +08:00
Maria José Solano
cb4559bc32 feat(lsp): workspace diagnostic support (#34262)
* refactor(lsp): remove underscore prefix from local variables

* feat(lsp): workspace diagnostic support
2025-06-09 13:02:00 -04:00
Maria José Solano
d75ffa5934 feat(lsp): static registration support (#34371) 2025-06-09 13:01:26 -04:00
luukvbaal
a5f236291c fix(messages): single event for multi-expr :echo (#34393)
Problem:  Separate "msg_show" event for each expression in a multi-expr
          :echo(n) command.
Solution: Only set the kind when `atstart == true`.
2025-06-09 18:58:31 +02:00
luukvbaal
e876a739ee fix(messages): recognize cmdline one_key/number prompt State (#34206)
Problem:  Since 48e2a736, prompt messages are handled by an actual
          active cmdline, resulting in `State` no longer being equal
          to `MODE_CONFIRM` which is used in some places. E.g. to
          specify the current `mode()` or to re-emit a confirm message.
Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when
          `ccline.one_key/mouse_used` is set. Use it to avoid clearing
          mouse_used prompt messages, and to re-emit one_key messages
          (when ext_messages is inactive, for which this is unnecessary).
2025-06-09 18:57:28 +02:00
Siddhant Agarwal
2f0fbdaa48 feat(vim.fs): root() can specify "equal priority" #34276 2025-06-09 09:31:37 -07:00
Mtende
2d980e37c8 docs(diagnostics): default keymaps #34400 2025-06-09 08:44:01 -07:00
glepnir
336b46a879 fix(highlight): preserve background transparency in 'winblend' #34302
Problem: When using 'winblend', transparent backgrounds (-1) are forced
to default colors (usually black) during attribute blending, breaking
the transparency effect.

Solution: Check original background colors before blending in
hl_blend_attrs(). If both background and foreground originally had
transparent backgrounds, preserve transparency instead of forcing
default colors.
2025-06-09 08:24:46 -07:00
Justin M. Keyes
8fadb80b3a Merge #34361 skip flaky tests on cirrus CI 2025-06-09 07:05:33 -07:00
glepnir
76d0206342 fix(api): count parameter in nvim_parse_cmd, nvim_cmd #34253
Problem:
- nvim_parse_cmd('copen', {}) returns count: 0, causing nvim_cmd to override default behavior
- nvim_cmd({cmd = 'copen', args = {10}}, {}) fails with "Wrong number of arguments"

Solution:
- Only include count field in parse result when explicitly provided or non-zero
- Interpret single numeric argument as count for count-only commands like copen
2025-06-09 06:50:26 -07:00
Justin M. Keyes
ca9689858d ci: skip flaky fold test on freebsd/cirrus
FAILED
    test/functional/treesitter/fold_spec.lua
     @
    720
    :
    treesitter foldexpr doesn't open folds that are not touched
    test/functional/treesitter/fold_spec.lua:767: Row 1 did not match.
    Expected:
      |*{1:-}^t1                                     |
      |*{1:-}# h2                                   |
      |*{1:│}t2                                     |
      |{3:~                                       }|
      |{3:~                                       }|
      |{3:~                                       }|
      |{3:~                                       }|
      |1 line less; before #2  {MATCH:.*}|
    Actual:
      |*{1: }^t1                                     |
      |*{1:+}{2:+--  2 lines: # h2·····················}|
      |*{3:~                                       }|
      |{3:~                                       }|
      |{3:~                                       }|
      |{3:~                                       }|
      |{3:~                                       }|
      |1 line less; before #2  0 seconds ago   |
    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.
    Snapshot:
    screen:expect([[
      {1: }^t1                                     |
      {1:+}{2:+--  2 lines: # h2·····················}|
      {3:~                                       }|*5
      1 line less; before #2  0 seconds ago   |
    ]])
2025-06-09 15:46:58 +02:00
Justin M. Keyes
cbaca9fee7 ci: skip flaky cursor test on freebsd/cirrus
Problem:
Test often fails on cirrus CI (freebsd):

    buffer cursor position is correct in terminal with number column in a line with single-cell multibyte chars and no trailing spaces, before_each
    test/functional/terminal/cursor_spec.lua:805: Row 5 did not match.
    Expected:
      |{7:  1 }                                                                  |
      |{7:  2 }                                                                  |
      |{7:  3 }                                                                  |
      |{7:  4 }                                                                  |
      |*{7:  5 }Entering Ex mode.  Type "visual" to go to Normal mode.            |
      |{7:  6 }:^                                                                 |
      |{3:-- TERMINAL --}                                                        |
    Actual:
      |{7:  1 }                                                                  |
      |{7:  2 }                                                                  |
      |{7:  3 }                                                                  |
      |{7:  4 }                                                                  |
      |*{7:  5 }                                                                  |
      |{7:  6 }:^                                                                 |
      |{3:-- TERMINAL --}                                                        |

Solution:
Skip it. Ex mode isn't that important.
2025-06-09 15:46:58 +02:00
luukvbaal
6f632a8615 fix(compositor): don't blend uninitialized background cells #34364
Problem:  A 'winblend' window floating over uninitialized cells loses
          its highlighting.

Solution: Return the front attribute for uninitialized background cells.
2025-06-09 05:43:33 -07:00
bfredl
811e12cebc Merge pull request #34217 from bfredl/shadajump
refactor(shada): expand macros taking macros and code fragments
2025-06-09 09:54:30 +02:00
bfredl
680d3770b1 refactor(shada): replace macros taking macros and code fragments
I guess these kinds of DRY techniques are kinda cutesy but unfortunately
I cannot expand macros invoking macros with various kind of syntax
fragments and back-references to local variables, at the same time
as I try to understand what is actually going on when you :wshada or :rshada
your jump marks, some of which having fname:s in them and some not.

This replaces it with four spelled out loops, although it is fine to
keep the memmove() related code generic in the item size just by passing a
runtime parameter (we have generics at home). Galaxy brain -03 -flto compilers
are gonna inline it anyway if it is worth it.
2025-06-09 09:33:20 +02:00
phanium
f2e60d000e fix: fn.exists() typos (#34390)
Problem:  `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive.
Solution:  Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
2025-06-09 09:07:38 +02:00
notomo
58d85cd03d fix(treesitter): ensure window is valid in async parsing #34385
Problem: Error occurs if window is invalid in the middle of parsing.

Solution: Check if window is valid in parsing.

- Error
```
vim.schedule callback: ...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: Invalid window id: 1037
stack traceback:
	[C]: in function 'nvim__redraw'
	...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: in function 'cb'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:494: in function '_run_async_callbacks'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:550: in function <...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:529>
```

- Reproduce script
```lua
local bufnr = vim.api.nvim_create_buf(false, true)
local many_lines = vim.fn["repeat"]({ "local test = 'a'" }, 100000)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, many_lines)
local window = vim.api.nvim_open_win(bufnr, true, {
  relative = "editor",
  row = 0,
  col = 0,
  width = 10,
  height = 10,
})
vim.bo.filetype = "lua"
vim.schedule(function()
  vim.api.nvim_win_close(window, true)
end)
```
2025-06-08 16:44:40 -07:00
zeertzjq
d2dad30898 vim-patch:9.1.1439: Last diff folds not merged (#34380)
Problem:  Last diff folds not merged (after v8.1.1922)
Solution: loop over all windows in the current tabpage and update all
          folds (Gary Johnson)

This commit fixes a bug where the last two folds of a diff are not
merged when the last difference between the two diff'd buffers is
resolved.

Normally, when two buffers are diff'd, folding is used to show only the
text that differs and to hide the text that is the same between the two
buffers.  When a difference is resolved by making a block of text the
same in both buffers, the folds are updated to merge that block with the
folds above and below it into one closed fold.

That updating of the folds did not occur when the block of text was the
last diff block in the buffers.

The bug was introduced by this patch on August 24, 2019:

    patch 8.1.1922: in diff mode global operations can be very slow

    Problem:    In diff mode global operations can be very slow.
    Solution:   Do not call diff_redraw() many times, call it once when
		redrawing.  And also don't update folds multiple times.

Unfortunately, folds were then not updated often enough.

The problem was fixed by adding a short loop to the ex_diffgetput()
function in diff.c to update all the folds in the current tab when the
last difference is removed.

A test for this was added to test_diffmode.vim.  Two of the reference
screen dumps for another test in that file,
Test_diffget_diffput_linematch(), had to be changed to have all the
folds closed rather than to have the last diff block remain open.

closes: vim/vim#17457

3fa0d3514b

Co-authored-by: Gary Johnson <garyjohn@spocom.com>
2025-06-09 06:57:54 +08:00
zeertzjq
2b79d9ba1a vim-patch:9.1.1437: MS-Windows: internal compile error in uc_list() (#34379)
Problem:  MS-Windows: internal compile error in uc_list() with VS 17.14
          (ibear)
Solution: refactor code slightly (Mike Williams)

fixes: vim/vim#17402
closes: vim/vim#17464

0174d8f386

Co-authored-by: Mike Williams <mrmrdubya@gmail.com>
2025-06-09 06:57:31 +08:00
Riley Bruins
8b41df185c fix(treesitter): support multiple @injection.content captures
Before, only the last capture's range would be counted for injection.
Now all captured ranges will be counted in the ranges array. This is
more intuitive, and also provides a nice solution/alternative to the
"scoped injections" issue.
2025-06-08 18:23:22 +02:00
Christian Clason
775e845d59 vim-patch:80a7921: runtime(nginx): Add NGINX directive for background cache updates
Docs: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_background_update

closes: vim/vim#17458

80a7921a02

Co-authored-by: S0AndS0 <strangerthanbland@gmail.com>
2025-06-08 16:53:50 +02:00
glepnir
e21c54000e test: remove unnecessary line breaks #34369
Problem: The test included too many unnecessary line breaks.
Solution: Remove the extra line breaks to make the test code more concise.
2025-06-08 03:26:45 -07:00
zeertzjq
00bec1fd90 vim-patch:partial:8f7256a (#34368)
vim-patch:partial:8f7256a: runtime(doc): fix some style issues and remove obsolete docs

8f7256a5ee

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-08 09:59:02 +08:00
zeertzjq
03bfc4e8d3 Merge pull request #34366 from zeertzjq/vim-1cccdeb
vim-patch: Vim syntax updates
2025-06-08 09:57:49 +08:00
zeertzjq
a1fc8bc17c vim-patch:834bb85: runtime(vim): vimHLGroup is not highlighted correctly
Problem: vimHLGroup is not highlighted in "hi def link"
          and "hi clear" commands
Solution: highlight vimHLGroup similarly to vimGroup
          (Eisuke Kawashima)

closes: vim/vim#17450

834bb85172

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-08 08:42:17 +08:00
zeertzjq
a118597290 vim-patch:6acca4b: runtime(vim): remove trailing whitespace in Vim syntax generator
related: vim/vim#17450

6acca4bc59

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-08 08:39:03 +08:00
zeertzjq
21a2411763 vim-patch:1cccdeb: runtime(vim): Update base-syntax, improve Vim9 block start pattern
The opening curly brace must be followed by whitespace, comment or
trailing bar.

closes: vim/vim#17454

1cccdebc0f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-08 08:38:32 +08:00
zeertzjq
52c61d9690 feat: make :restart work for remote UI (#34354) 2025-06-07 22:10:34 +00:00
Riley Bruins
faae1e72a2 fix(treesitter): scope highlight state per window #34347
**Problem:** There is a lot of distracting highlight flickering when
editing a buffer with multiple open windows. This is because the
parsing/highlighting state is shared across all windows.

**Solution:** Greatly reduce flicker in window splits by scoping the
highlighter state object and the `parsing` state object to each
individual window, so there is no cross-window interference.
2025-06-07 09:27:46 -07:00
Justin M. Keyes
96a0e5f265 docs: lua, UI events #34261 2025-06-07 07:49:04 -07:00
luukvbaal
c8c78b531b fix(startup): make startup windows if there are only floating windows (#34349)
Problem:  If user init creates a floating window, startup windows
          (e.g. to accomodate arglist files) are no longer created.
Solution: Check that firstwin->w_next is not floating when deciding
          whether to make startup windows.
2025-06-07 11:24:51 +02:00
luukvbaal
af82f36108 fix(api): update topline when flushing with nvim__redraw() (#34346)
Problem:  nvim__redraw may update the screen with an invalid topline.
Solution: Update the topline before calling `update_screen()` (as
          :redraw does).
2025-06-07 11:24:24 +02:00
zeertzjq
22389159f5 test(tui_spec): avoid dangling process in OSC 52 test (#34356) 2025-06-07 16:53:00 +08:00
luukvbaal
bf1d4e9793 fix(messages): capture execute("messages") with ext_messages (#34342)
Problem:  "msg_history_show" event is emitted when `msg_silent > 0`.
          E.g. when capturing its output with `execute()`, which also
          doesn't work with ext_messages.
Solution: Don't emit the "msg_history_show" event when `msg_silent > 0`.
          Call regular messaging functions when `redirecting()`, to
          execute `redir_write()` while ensuring the message itself
          is not emitted.
2025-06-06 16:45:30 +02:00
Lewis Russell
3b6084ddf4 fix: type fixes
Type fixes caught by emmylua
2025-06-06 15:36:48 +01:00
Rodrigodd
4c333fdbb7 test(treesitter): test node access after tree edit 2025-06-06 15:35:52 +01:00
Rodrigodd
744674900f refactor(treesitter): avoid unnecessarily copying tree
node:tree() now already copies the tree before returning it, for memory
safety reasons.
2025-06-06 15:35:52 +01:00
Rodrigodd
99e6294819 fix(treesitter): ensure TSNode's tree is immutable
Problem:

TSNode contains a `const TSTree*` and a `const void *id`. The `id`
points to Tree-sitter's internal type `Subtree`, which resides inside
the `TSTree` but may be deallocated if the `TSTree` is mutated (which
is likely why it is `const`).

The Lua method `TSTree:edit()` mutates the tree, which can deallocate
`id`.

See #25254 and #31758.

Solution:

To avoid this, we now make a copy of the tree before pushing its root to
the Lua stack. This also removes the fenv from TSLuaTree, as it was only
used when pushing the tree root to the Lua stack.

We also copy the tree in `node_tree`.

`ts_tree_copy()` just increments a couple of reference counters, so it's
relatively cheap to call.
2025-06-06 15:35:52 +01:00
luukvbaal
cb036cae5f fix(extui): use visible to determine active "more" (#34327)
Problem:  Current window is checked to determine whether "more" window
          is open. Making it the current window is scheduled in case the
          cmdwin is open so this can be too late.
          "cmdline_hide" may be emitted when the topline is
          temporarily invalid (after incsearch->restore_viewstate()).
Solution: Use the window visibility to determine an active "more"
          window instead.
          Don't nvim__redraw->flush the "cmdline_hide" event (a normal
          will already happen).
2025-06-06 16:04:45 +02:00
Kai-Hsiang Hsu
e5c5b563ec fix(lsp): only auto-detach lsp.config enabled clients #34325
Problem: A custom server (initialized through `vim.lsp.start`) gets
         unexpectedly detached.

Solution: Only auto-detach the clients enabled through `vim.lsp.enable`
          to prevent unexpected behavior.
2025-06-06 06:26:50 -07:00
luukvbaal
3165e94a64 fix(api): ensure win_get_config() "border" is reciprocal (#34322)
fix(api): ensure win_get_config() is reciprocal

Problem:  win_get_config() does not include a 'none' border field,
          causing nvim_open_win() to apply the 'winborder' value.
Solution: Include a 'none' border field in the returned config,
          such that it can be used reciprocally in nvim_open_win()
          to yield the same window layout.
2025-06-06 12:40:57 +02:00
zeertzjq
9f505b4d0f refactor: make two functions used only in memory.c static (#34339)
After #29450 try_to_free_memory() is only used in memory.c.
Also move do_outofmem_msg() closer to where it's used.
2025-06-06 13:49:22 +08:00
zeertzjq
60d0b7d0c3 fix(diff): fix incorrect item size of dout_ga (#34338)
Related 267494151b
2025-06-06 04:34:28 +00:00
zeertzjq
552983515f vim-patch:9.1.1435: completion: various flaws in fuzzy completion (#34335)
Problem:  completion: various flaws in fuzzy completion
Solution: fix the issues (Girish Palya)

- Remove the brittle `qsort()` on `compl_match_array`.
- Add a stable, non-recursive `mergesort` for the internal doubly
  linked list of matches.
- The sort now happens directly on the internal representation (`compl_T`),
  preserving sync with external structures and making sorting stable.
- Update fuzzy match logic to enforce `max_matches` limits after
  sorting.
- Remove `trim_compl_match_array()`, which is no longer necessary.
- Fixe test failures by correctly setting `selected` index and
  maintaining match consistency.
- Introduce `mergesort_list()` in `misc2.c`, which operates generically
  over doubly linked lists.
- Remove `pum_score` and `pum_idx` variables

fixes: vim/vim#17387
closes: vim/vim#17430

8cd42a58b4

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-06 02:46:01 +00:00
Phạm Bình An
4e71d3bfab vim-patch:eb59129: runtime(typescript): remove Fixedgq() function from indent script (#34334)
Problem:
1. The `Fixedgq()` function is broken (see vim/vim#17412)
2. The `'formatexpr'` for Typescript is not documented, which causes
   confusion to users when they try to set `'formatprg'`, since
   `'formatexpr'` always takes precedence over `'formatprg'`. See also
   https://github.com/HerringtonDarkholme/yats.vim/issues/209
3. Typescript already has a very good and popular formatter called
   `prettier`, that can be easily integrated to Vim via `'formatprg'`
   (see vim/vim#16989). I don't think there are any good reasons to reinvent a
   half-baked version in Vim.

Solution:  Remove the Fixedgq() 'formatexpr' function.

fixes: vim/vim#17412
closes: vim/vim#17452

eb59129d2c
2025-06-06 07:47:55 +08:00
zeertzjq
a9f544b712 Merge pull request #34333 from zeertzjq/vim-9.1.1431
vim-patch:9.1.{1431,1433}

N/A patch:
vim-patch:002548b: runtime(doc): Add missing 'wfb' (winfixbuf) tag
2025-06-06 06:57:51 +08:00
zeertzjq
6171ab7f4e vim-patch:9.1.1433: Unnecessary :if when writing session
Problem:  Unnecessary :if in session where both branches have the same
          effect (after 9.1.1431).
Solution: Remove the superfluous :if (zeertzjq).

closes: vim/vim#17448

8f751d56f4
2025-06-06 06:37:36 +08:00
zeertzjq
f89381e05c vim-patch:9.1.1431: Hit-Enter Prompt when loading session files
Problem:  Hit-Enter Prompt when loading session files
Solution: use set+= for 'shortmess' to keep the existing flags
          (Miguel Barro)

closes: vim/vim#17445

0ca5966196

Co-authored-by: Miguel Barro <miguel.barro@live.com>
2025-06-06 06:36:47 +08:00
Lewis Russell
2b21c9c23f fix(diagnostic): ensure autocmd always is always sent diagnostics 2025-06-05 13:02:56 +01:00
Christian Clason
b6b35cb557 vim-patch:bb78ea2: runtime(mbsync): Add support for TLSType in syntax script
closes: vim/vim#17438

bb78ea23c6

Co-authored-by: Filippo Bonazzi <filippo.bonazzi@suse.com>
2025-06-05 09:16:38 +02:00
zeertzjq
1c417b565e vim-patch:9.1.1432: GTK GUI: Buffer menu does not handle unicode correctly (#34313)
Problem:  GTK GUI: Buffer menu does not handle unicode correctly
Solution: Get rid of the BMHash() function (SUN Haitao)

fixes: vim/vim#17403
closes: vim/vim#17405

08896dd330

Co-authored-by: SUN Haitao <sunhaitao@devtaste.com>
2025-06-05 09:19:22 +08:00
zeertzjq
5e470c7af5 fix(menu): fix listing of submenus (#34315)
Problem:  Listing submenus with :menu doesn't work.
Solution: Don't go to the parent of the return value of find_menu(), and
          handle empty path at the caller.

Related #8194, which actually only fixed the problem for menu_get(), not
for :menu Ex command.
2025-06-05 01:18:00 +00:00
zeertzjq
b16dc698cf Merge pull request #34312 from zeertzjq/vim-d6c9ac9
vim-patch: doc updates
2025-06-05 07:05:27 +08:00
zeertzjq
a5bbdbb5d5 vim-patch:dfed077: runtime(doc): fix small errors from rev 2090405de5bb66facc29c74
- update the netrw window to current version (and trim it slightly to 80
  chars)
- remove a trailing double quote

dfed077e06

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Antonio Giovanni Colombo <azc100@gmail.com>
2025-06-05 06:32:13 +08:00
zeertzjq
038fb30ece vim-patch:d6c9ac9: runtime(doc): clarify the effect of 'smarttab'
closes: vim/vim#17426

d6c9ac97a0

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-05 06:31:09 +08:00
luukvbaal
5e4700152b fix(extui): copy window config to new tabpage (#34308)
Problem:  When opening a new tabpage, extui windows are initialized with
          their default config. Window visiblity/dimensions on other
          tabpages may get out of sync with their buffer content.
Solution: Copy the config of the window to the new tabpage.
          No longer keep track of the various windows on each tabpage.
          Close windows on inactive tabpages instead (moving them could
          be more efficient but is currently not supported in the API).
2025-06-04 19:59:36 +02:00
Christian Clason
03832842d5 build(deps): bump tree-sitter to v0.25.6 2025-06-04 19:31:08 +02:00
phanium
f577bb024e docs: getreg() type #34215
```lua
---@type string
local _a = vim.fn.getreg('a', 1)

---@type string[]
local _b = vim.fn.getreg('a', 1, 1)
```
2025-06-04 09:26:56 -07:00
Christian Clason
442dade5be ci(release): drop manual shasum collection
This is now included for all GH release assets out-of-the-box, see
https://github.blog/changelog/2025-06-03-releases-now-expose-digests-for-release-assets/

These can be accessed programmatically through
  `gh release view --json assets <release tag>`
and then looking at the `digest` key.
2025-06-04 18:22:09 +02:00
Emanuel Krollmann
7e393ff4f2 refactor(windows): redundant icon messages #34274
Problem:  Two separate window messages are used to get
          the original console icon and set a new
          one on windows, although the `WM_SETICON`
          message returns the original icon itself.

Solution: Replace the two `WM_GETICON` messages with
          two `WM_SETICON` messages, save the return
          values and remove the call to `os_icon_set`.
          Also, replace `os_icon_set` with `os_icon_reset`
          as its only usage is now resetting the
          icon to the original one.
2025-06-04 07:11:01 -07:00
zeertzjq
dd9ac565d8 Merge pull request #34294 from glepnir/vim-9.1.1426
vim-patch:9.1.{1426,1428}: register completion improve
2025-06-04 13:46:19 +08:00
glepnir
97ca92f9dd vim-patch:9.1.1428: completion: register completion needs cleanup
Problem:  completion: register completion needs cleanup
Solution: slightly refactor get_register_completion()
          (glepnir)

closes: vim/vim#17432

86d46a7018

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-04 13:27:38 +08:00
Yochem van Rosmalen
3d1f907912 vim-patch:2090405: runtime(doc): make examples verbatim to prevent conceal/tag parsing (#34299)
closes: vim/vim#17437

2090405de5
2025-06-04 05:55:24 +08:00
Lewis Russell
533cc0ab35 fix(vim.diagnostic): improve typing
Problem:

`vim.diagnostic.set()` doesn't actually accept a list of
`vim.Diagnostic` as internally `vim.diagnostic.set()` normalizes the
diagnostics and this normalization is assumed throughout the module.

Solution:

- Add a new type `vim.Diagnostic.Set` which is the input to `vim.diagnostic.set()`

- `col` is now an optional field and defaults to `0` to be consistent
  with `vim.diagnostic.match()`.

- Change `table.insert(t, x)` to `table[#table + 1] = x` for improved
  type checking.
2025-06-03 20:25:07 +01:00
Sergei Slipchenko
9641ad9369 fix(diagnostics): diagnostic just after EOL is not highlighted #34085
Fixes #34013

Problem:
when diagnostic is set right after EOL, underline handler looks
inconsistent compared to other handlers, visually underline is shown
starting from the next line. On top of that it's also inconsistent with
open_float and jump.

Solution:
clamp starting column position in underline handler to be right before
EOL to make it visible and consistent with other handlers, open_float
and jump.
2025-06-03 07:22:36 -07:00
Brynne Taylor
3991f14621 fix(glob): handling commas in letter pattern #34170 2025-06-03 06:36:44 -07:00
luukvbaal
eeacd7bd71 fix(api): adjust fix for reconfiguring float "relative" (#34287)
Problem:  "win" is cleared in float config after 96330843, even with
          unchanged "relative".
Solution: Don't clear "win". Avoid erroring for deleted "win" by setting
          the parent win to curwin directly when "win" is zero or not
          present in config.
2025-06-03 13:27:07 +02:00
glepnir
eb10852804 vim-patch:9.1.1426: completion: register contents not completed
Problem:  CTRL-X CTRL-R only completes individual words from registers,
          making it difficult to insert complete register content.
Solution: Add consecutive CTRL-X CTRL-R support - first press completes
          words, second press completes full register lines, similar to
          CTRL-X CTRL-L and CTRL-X CTRL-P behavior (glepnir).

closes: vim/vim#17395

d5fdfa5c9c

Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-03 16:25:49 +08:00
zeertzjq
ee84518b94 fix(excmd): don't allow range or args for :detach/:restart (#34280)
Also remove the CMDWIN and LOCK_OK flags, so that there is no need to
check for text_locked() and curbuf_locked().
2025-06-03 01:03:43 +00:00
zeertzjq
049877d379 fix(tui): make :restart use new size after terminal resize (#34282) 2025-06-03 00:18:04 +00:00
zeertzjq
304a9baebd vim-patch:3993cd6: runtime(vim): Update base-syntax, bug fixes (#34288)
- Contain :profdel arguments.
- Fix string highlighting immediately after lambda -> operators.

Reported by Aliaksei Budavei.

closes: vim/vim#17427

3993cd619a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-02 23:58:11 +00:00
zeertzjq
aa4fa24963 vim-patch:bfeefc4: runtime(doc): clarify the effect of exclusive single char selections (#34289)
closes: vim/vim#17410

bfeefc474a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-02 23:54:29 +00:00
zeertzjq
9c9c7ae30f Merge pull request #34247 from zeertzjq/vim-9.1.1301
vim-patch: various 'complete' features
2025-06-03 07:00:25 +08:00
zeertzjq
525c02a89f vim-patch:9.1.1424: PMenu selection broken with multi-line selection and limits
Problem:  PMenu selection broken with multi-line selection and limits
          (Maxim Kim)
Solution: update completion match index when limiting the completion
          sources (Girish Palya)

fixes: vim/vim#17394
closes: vim/vim#17401

6c40df09e0

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
9bfd0162dc vim-patch:9.1.1422: scheduling of complete function can be improved
Problem:  scheduling of complete function can be improved
Solution: call user completion functions earlier when just determining
          the insertion column (Girish Palya)

This change improves the scheduling behavior of async user-defined
completion functions (such as `F{func}`, `F`, or `'o'` values in the
`'complete'` option), particularly benefiting LSP clients.

Currently, these user functions are invoked twice:

1. First with `findstart = 1` to determine the completion start
   position.
2. Then with `findstart = 0` to retrieve the actual matches.

Previously, both calls were executed back-to-back. With this change, the
first call (`findstart = 1`) is performed earlier—before any matches are
gathered from other sources.

This adjustment gives event-driven completion sources (e.g., LSP
clients) more time to send their requests while Vim concurrently
collects matches from other sources like the current buffer.

Not sure about the real-world performance gains, but this approach
should, in theory, improve responsiveness and reduce latency for
asynchronous completions.

To test, try using yegappan LSP client:

```vim
set cpt+=o^10
autocmd VimEnter * g:LspOptionsSet({ autoComplete: false, omniComplete: true })
```

If you prefer to use 'native' auto-completion (without plugins), try the
following configuration:

```vim
set cot=menuone,popup,noselect,nearest
autocmd TextChangedI * InsComplete()
def InsComplete()
  if getcharstr(1) == '' && getline('.')->strpart(0, col('.') - 1) =~ '\k$'
    SkipTextChangedI()
    feedkeys("\<c-n>", "n")
  endif
enddef
inoremap <silent> <c-e> <c-r>=<SID>SkipTextChangedI()<cr><c-e>
inoremap <silent> <c-y> <c-r>=<SID>SkipTextChangedI()<cr><c-y>
def SkipTextChangedI(): string
  set eventignore+=TextChangedI
  timer_start(1, (_) => {
    set eventignore-=TextChangedI
  })
  return ''
enddef
inoremap <silent><expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <silent><expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
```

closes: vim/vim#17396

98c29dbfd1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
bec1449cc5 vim-patch:9.1.1416: completion limits not respected for fuzzy completions
Problem:  completion limits not respected when using fuzzy completion
          (Maxim Kim)
Solution: trim completion array (Girish Palya)

fixes: vim/vim#17379
closes: vim/vim#17386

19ef6b0b4b

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
2411f924a3 vim-patch:9.1.1410: out-of-bounds access with 'completefunc'
Problem:  out-of-bounds access with 'completefunc' (csetc)
Solution: check if it is safe to advance cpt_sources_index
          (Girish Palya)

fixes: vim/vim#17363
closes: vim/vim#17374

7c621052c3

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: @csetc
2025-06-03 06:30:47 +08:00
zeertzjq
eeff6ca8ff vim-patch:9.1.1409: using f-flag in 'complete' conflicts with Neovim
Problem:  using f-flag in 'complete' conflicts with Neovims filename
          completion (glepnir, after v9.1.1301).
Solution: use upper-case "F" flag for completion functions
          (Girish Palya).

fixes: vim/vim#17347
closes: vim/vim#17378

14f6da5ba8

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
13aec582b4 vim-patch:fa8b7db: runtime(doc): tweak documentation style in options.txt
closes: vim/vim#17229

fa8b7db99a

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
857ff5cae9 vim-patch:9.1.1313: compile warning about uninitialized value
Problem:  compile warning about uninitialized value
          (Tony Mechelynck, after v9.1.1311)
Solution: initialize variable on declaration

b53d4fb63e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-03 06:30:47 +08:00
zeertzjq
b6acf6112b vim-patch:9.1.1311: completion: not possible to limit number of matches
Problem:  completion: not possible to limit number of matches
Solution: allow to limit the matches for 'complete' sources by using the
          "{flag}^{limit}" notation (Girish Palya)

This change extends the 'complete'  option to support limiting the
number of matches returned from individual completion sources.

**Rationale:** In large files, certain sources (such as the current
buffer) can generate an overwhelming number of matches, which may cause
more relevant results from other sources (e.g., LSP or tags) to be
pushed out of view. By specifying per-source match limits, the
completion menu remains balanced and diverse, improving visibility and
relevance of suggestions.

A caret (`^`) followed by a number can be appended to a source flag to
specify the maximum number of matches for that source. For example:
```
  :set complete=.^9,w,u,t^5
```
In this configuration:
- The current buffer (`.`) will return up to 9 matches.
- The tag completion (`t`) will return up to 5 matches.
- Other sources (`w`, `u`) are not limited.

This feature is fully backward-compatible and does not affect behavior
when the `^count` suffix is not used.

The caret (`^`) was chosen as the delimiter because it is least likely
to appear in file names.

closes: vim/vim#17087

0ac1eb3555

Cherry-pick test_options.vim change from patch 9.1.1325.

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:47 +08:00
zeertzjq
c249389adb vim-patch:9.1.1302: Coverity warns about using uninitialized value
Problem:  Coverity warns about using uninitialized value
          (Coverity, Tony Mechelynck, after v9.1.1301)
Solution: initialize callback pointer to NULL

d2079cff48

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-06-03 06:30:47 +08:00
zeertzjq
7651c43252 vim-patch:9.1.1301: completion: cannot configure completion functions with 'complete'
Problem:  completion: cannot configure completion functions with
          'complete'
Solution: add support for setting completion functions using the f and o
          flag for 'complete' (Girish Palya)

This change adds two new values to the `'complete'` (`'cpt'`) option:
- `f` – invokes the function specified by the `'completefunc'` option
- `f{func}` – invokes a specific function `{func}` (can be a string or `Funcref`)

These new flags extend keyword completion behavior (e.g., via `<C-N>` /
`<C-P>`) by allowing function-based sources to participate in standard keyword
completion.

**Key behaviors:**

- Multiple `f{func}` values can be specified, and all will be called in order.
- Functions should follow the interface defined in `:help complete-functions`.
- When using `f{func}`, escaping is required for spaces (with `\`) and commas
  (with `\\`) in `Funcref` names.
- If a function sets `'refresh'` to `'always'`, it will be re-invoked on every
  change to the input text. Otherwise, Vim will attempt to reuse and filter
  existing matches as the input changes, which matches the default behavior of
  other completion sources.
- Matches are inserted at the keyword boundary for consistency with other completion methods.
- If finding matches is time-consuming, `complete_check()` can be used to
  maintain responsiveness.
- Completion matches are gathered in the sequence defined by the `'cpt'`
  option, preserving source priority.

This feature increases flexibility of standard completion mechanism and may
reduce the need for external completion plugins for many users.

**Examples:**

Complete matches from [LSP](https://github.com/yegappan/lsp) client. Notice the use of `refresh: always` and `function()`.

```vim
set cpt+=ffunction("g:LspCompletor"\\,\ [5]). # maxitems = 5

def! g:LspCompletor(maxitems: number, findstart: number, base: string): any
    if findstart == 1
        return g:LspOmniFunc(findstart, base)
    endif
    return {words: g:LspOmniFunc(findstart, base)->slice(0, maxitems), refresh: 'always'}
enddef
autocmd VimEnter * g:LspOptionsSet({ autoComplete: false, omniComplete: true })
```

Complete matches from `:iabbrev`.

```vim
set cpt+=fAbbrevCompletor

def! g:AbbrevCompletor(findstart: number, base: string): any
    if findstart > 0
        var prefix = getline('.')->strpart(0, col('.') - 1)->matchstr('\S\+$')
        if prefix->empty()
            return -2
        endif
        return col('.') - prefix->len() - 1
    endif
    var lines = execute('ia', 'silent!')
    if lines =~? gettext('No abbreviation found')
        return v:none  # Suppresses warning message
    endif
    var items = []
    for line in lines->split("\n")
        var m = line->matchlist('\v^i\s+\zs(\S+)\s+(.*)$')
        if m->len() > 2 && m[1]->stridx(base) == 0
            items->add({ word: m[1], info: m[2], dup: 1 })
        endif
    endfor
    return items->empty() ? v:none :
        items->sort((v1, v2) => v1.word < v2.word ? -1 : v1.word ==# v2.word ? 0 : 1)
enddef
```

**Auto-completion:**

Vim's standard completion frequently checks for user input while searching for
new matches. It is responsive irrespective of file size. This makes it
well-suited for smooth auto-completion. You can try with above examples:

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

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>

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
```

closes: vim/vim#17065

cbe53191d0

Temporarily remove bufname completion with #if 0 to make merging easier.

Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: glepnir <glephunter@gmail.com>
2025-06-03 06:30:46 +08:00
zeertzjq
0af6d6ff5e vim-patch:9.1.1147: preview-window does not scroll correctly
Problem:  preview-window does not scroll correctly
Solution: init firstline = 0 for a preview window
          (Girish Palya)

The 'info' window, which appears during insert-mode completion to display
additional information, was not scrolling properly when using commands like:
	win_execute(popup_findinfo(), "normal! \<PageDown>")
This issue made it impossible to navigate through info window contents using
keyboard-based scrolling.
The fix correctly updates the w_firstline value of the popup window, ensuring
proper scrolling behavior. Mouse scrolling was already working as expected and
remains unaffected.

closes: vim/vim#16703

12b1eb58ab

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-06-03 06:30:46 +08:00
Luuk van Baal
33b0a004eb fix(extui): properly setup "more" window for changed buffer
Problem:  Buffer setup after moving the message buffer to the "more"
          window after ff95d7ff is incomplete.
Solution: Adjust and invoke tab_check_wins() to do the setup instead.
2025-06-02 16:32:48 +02:00
Luuk van Baal
5e83d0f5ad fix(extui): reposition "more" window after entering cmdwin
Problem:  Closing the "more" window for an entered cmdwin in ff95d7ff9
          still requires special casing to properly handle "more" visibility.
Solution: Reposition the "more" window instead; anchoring it to the
          cmdwin.
2025-06-02 16:32:48 +02:00
luukvbaal
963308439a fix(api): reconfiguring float "relative" does not clear "win" (#34271)
Problem:  Unable to change the "relative" of a flag after its target
          "win" no longer exists.
Solution: Unset target window if it is not present in config and
          reconfigured "relative" no longer expects a target window.
2025-06-02 14:59:19 +02:00
Sathya Pramodh
86835b3db3 feat(editor): ":restart" command #33953
Problem:
Developing/troubleshooting plugins has friction because "restarting"
Nvim requires quitting and manually starting again. #32484

Solution:
- Implement a `:restart` command which emits `restart` UI event.
- Handle the `restart` UI event in the builtin TUI client: stop the
  `nvim --embed` server, start a new one, and attach to it.
2025-06-02 05:54:17 -07:00
Christian Clason
236243029d vim-patch:b577ad5: runtime(java): Match annotation- and interface-type names of "java.lang"
Complement the documented support for the recognition of all
public types of the "java.lang" package (":help java.vim").
(The original syntax item generator may have, inadvertently,
contributed via suppressing "NullPointerException"s to not
having annotation and interface types qualify in general.)

Also, re-link usage instructions for the alternative syntax
item generator to a rolling "master"'s version.

closes: vim/vim#17419

b577ad50d0

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-06-02 10:03:12 +02:00
zeertzjq
5fd03508aa vim-patch:95ea0b0: runtime(doc): make 'shiftwidth' setting more precise (#34266)
closes: vim/vim#17414

95ea0b0f8d

Co-authored-by: Damien Lejay <damien@lejay.be>
2025-06-02 08:26:34 +08:00
zeertzjq
06f07a104b vim-patch:0aaf6f8: runtime(vim): Update base-syntax, improve :profile highlighting (#34265)
Match full :profile and :profdel commands.

closes: vim/vim#17420

0aaf6f8bbb

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-02 00:11:36 +00:00
Emanuel Krollmann
52991d8728 fix(windows): don't set window icon on SIGHUP #34260
Problem:  When using conhost and pressing the 'x' button
          to close it while nvim is open, nvim hangs up
          while trying to reset the window icon, causing a big
          delay before the terminal actually closes. #34171

Solution: Set the window handle to NULL after receiving SIGHUP
          so that nvim will not try resetting the icon.
2025-06-01 15:23:42 -07:00
luukvbaal
981d4ba45e fix(eval): winnr('$') counts non-current hidden/unfocusable windows #34207
Problem:  Non-visible/focusable windows are assigned a window number,
          whereas commands that use this window number skip over them.

Solution: Skip over non-visible/focusable windows when computing
          the window number, unless it is made the current window
          through the API in which case an identifiable window number
          is still useful. This also ensures it matches the window
          number of the window entered by `<winnr>wincmd w` since
          403fcacf.
2025-06-01 15:12:12 -07:00
glepnir
5cfbc35aa8 fix(api): add missing nargs field to user command Lua callbacks #34210
Problem: nvim_create_user_command() Lua callbacks were missing the documented nargs field in the options table passed to the callback function.

Solution: Add nargs field derivation from command argument type flags in nlua_do_ucmd(), using the same logic as nvim_parse_cmd().
2025-06-01 15:03:35 -07:00
Justin M. Keyes
80753332d1 docs: news, intro, lsp, api #33687 2025-06-01 14:13:50 -07:00
luukvbaal
ff95d7ff9a fix(extui): adjust "more" window routing (#34251)
Problem:  Message lines from multiple message events that end up
          spilling 'cmdheight' end up spread out over the cmdline
          and "more" window.
          Messages emitted as feedback to a typed :command (rather than
          its sole purpose like :echo/:=) are routed to the more window.
          The more window isn't closed when entering the cmdwin, and
          doesn't allow `vim.hl.on_yank()`.
Solution: When first opening the "more" window for spilled messages,
          move the message buffer to the more window.
          Restrict routing of typed commands to echo kinds.
          Ignore all events but WinLeave and TextYankPost.
2025-06-01 20:54:38 +02:00
zeertzjq
b95189b7e3 Merge pull request #34244 from brianhuster/vim-6fea0a5
vim-patch: document on how to write lang annotation for codeblock in help file
2025-06-01 23:11:52 +08:00
zeertzjq
84c7785546 vim-patch:055cca8: runtime(java): Reference a modern syntax item generator for type names (#34256)
And generalise the sourcing of "javaid.vim" for Java
buffers.

Resolves zzzyxwvut/java-vim#10.
closes: vim/vim#17411

055cca88c4

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-06-01 21:33:32 +08:00
zeertzjq
b77666e6f9 Merge pull request #34252 from zeertzjq/vim-7b5550f
vim-patch: Vim syntax updates
2025-06-01 08:58:32 +08:00
zeertzjq
7384cf015e vim-patch:086b3b5: runtime(vim): Update base-syntax, improve :mark and :substitute highlighting
- Match full :mark and :k commands.
- Match 2 and 3 letter :s repeat commands.
- Match :s [count] argument.

closes: vim/vim#17408

086b3b5b79

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-01 08:33:56 +08:00
zeertzjq
4091f2c740 vim-patch:7b5550f: runtime(vim): Update base-syntax, improve :import highlighting
- Match "autoload" as a keyword in :import commands.
- Match an expression argument for the filename.

closes: vim/vim#15375

7b5550fac7

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-06-01 08:32:28 +08:00
zeertzjq
7a8b0cd0f8 Merge pull request #34239 from e-kwsm/vim-9.1.1342
vim-patch:9.1.{1342,1420}
2025-06-01 08:31:00 +08:00
Maria José Solano
f72c13341a feat(lsp)!: pass entire entry to format function (#34166)
* feat(lsp)!: pass entire entry to format function

* refactor(lsp): deprecate `vim.lsp.log.should_log()`
2025-05-31 08:47:32 -07:00
Eisuke Kawashima
0471cc7595 vim-patch:9.1.1420: tests: could need some more tests for shebang lines
Problem:  tests: could need some more tests for shebang lines
Solution: add more shebang patterns to test_filetype.vim
          (Eisuke Kawashima)

closes: vim/vim#17409

54a09e7e86

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-06-01 00:03:02 +09:00
Eisuke Kawashima
41179a6bc1 vim-patch:9.1.1342: Shebang filetype detection can be improved
Problem:  Shebang filetype detection can be improved
Solution: Improve detection logic (Eisuke Kawashima)

Vim does not correctly detect filetype from
  - `#!/usr/bin/env --split-string=awk -f`
  - `#!/usr/bin/env -S -i awk -f`
  - `#!/usr/bin/env -S VAR= awk -f`
So update the current detection logic to detect those cases.

closes: vim/vim#17199

f102f4c2e8

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-05-31 23:57:37 +09:00
brianhuster
7082367b3a vim-patch:b9ea0a8: runtime(doc): tweak documentation style in helphelp.txt
closes: vim/vim#16302

b9ea0a89fa

Co-authored-by: h-east <h.east.727@gmail.com>

I removed some parts that are not applicable to Nvim, like HelpTOC
2025-05-31 20:21:59 +07:00
brianhuster
60b866049c vim-patch:5ddcecf: runtime(help): Add better support for language annotation highlighting
closes: vim/vim#16238

5ddcecf05f

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: h_east <h.east.727@gmail.com>
2025-05-31 19:57:53 +07:00
luukvbaal
2763d06100 vim-patch:9.1.1419: It is difficult to ignore all but some events (#34245)
Problem:  It is difficult to ignore all but some events.
Solution: Add support for a "-" prefix syntax in '(win)eventignore' that
          subtracts an event from the ignored set if present
          (Luuk van Baal).

8cc6d8b187
2025-05-31 14:51:29 +02:00
brianhuster
11ae879ebd vim-patch:6fea0a5: runtime(help): Add Vim lang annotation support for codeblocks
closes: vim/vim#16215

6fea0a5480

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-05-31 17:25:27 +07:00
zeertzjq
5ebaf83256 Merge pull request #34243 from zeertzjq/vim-a4a3f71
vim-patch: doc updates
2025-05-31 09:01:23 +08:00
zeertzjq
eb6ca14248 vim-patch:77959dc: runtime(doc): CI fails with trailing whitespace error in usr_30.txt
77959dc644

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-31 08:18:28 +08:00
zeertzjq
d29b800515 vim-patch:a4a3f71: runtime(doc): clarify tabstop settings and guidance
closes: vim/vim#17381

a4a3f712e2

Co-authored-by: Damien Lejay <damien@lejay.be>
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-31 08:15:25 +08:00
zeertzjq
7ed8e96994 fix(redraw): update curswant for Visual selection (#34241)
Problem:  Blockwise Visual selection not redrawn correctly when moving
          cursor for more than 1 cells with 'virtualedit'.
Solution: Restore the curswant update removed in 6679687bb3.
2025-05-30 23:47:13 +00:00
zeertzjq
ade64c3ca3 vim-patch:570e71a: runtime(vim): Update base-syntax, improve :set highlighting (#34240)
- Match comments and trailing bar after :set without args.
- Match the <...> form for key code options.
- Remove orphaned vim_ex_python[3x]* dump files (Aliaksei Budavei).

closes: vim/vim#17397

570e71a277

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-30 22:59:42 +00:00
Christian Clason
9e81408b69 ci(release): bump windows runner to windows-2022
Windows-20219 runner will be retired June 30, 2025 and receive several
brownouts before then.
2025-05-30 18:41:00 +02:00
Phạm Bình An
9d5eb3eda5 docs: rename builtin.txt, eval.txt #34212
Problem:
Despite the name, `builtin.txt` only includes Vimscript functions, which
is confusing, especially to people who only use Lua to configure Nvim

Solution: From justinmk's suggestion
- Rename `builtin.txt` to `vimfn.txt`
- Rename `eval.txt` to `vimeval.txt`
- The tags `*builtin.txt*` and `*eval.txt*` should be kept for Vim-patches

Closes #33743
2025-05-30 08:57:58 -07:00
phanium
756751afa3 fix(terminal): stack overflow when too many csi args (#34012)
fix: stack overflow when too many csi args

Problem:
Crash when csi contains > 16 args. It's easy to trigger
when you attempt to pipe external terminal scrollback buffer.
```sh
nvim --clean --cmd "term printf
'\e[38:2:59:66:97;48:2:36:40:59;58:2:224:175:104;4:3m'"
```

Solution:
Increase buffer size.
2025-05-30 06:57:07 -05:00
Gabriel Ford
b28bbee539 fix(terminal): skip setting string_initial to false on no-op (#34176)
Problem:

Currently undefined behavior can occur when `string_fragment()` is
called with `OSC_COMMAND`. This is because when the state changes to
`OSC_COMMAND`, `string_initial` is set to true. Then in some cases,
directly after this `string_initial` will be set back to false before
the on_osc callback is called, this leads to `term_settermprop()` never
initializing the title.

Solution:

In all of the no-op cases in `string_fragment()` currently, we continue
to the end of the function where `vt->parser.string_initial` is set to
false. This change returns in the no-op cases instead since in these
cases the string has not yet been terminated and sent to the callback.

Note:

This change also adds a test with a byte sequence from the file
in #34028 that caused nvim to crash. This byte sequences is the shortest
sequence I could trim down from that file that still would trigger the
crash. There are also two other tests I added which validate that
setting the title with OSC-0 and OSC-2 still works.

Fixes: #34028
2025-05-29 13:29:16 -05:00
Christian Clason
f82219c490 fix(treesitter): parser metadata annotations
Problem: `TSLangInfo` annotation does not reflect the structure returned
by `vim.treesitter.language.inspect()`.

Solution: Move version information under new (optional since ABI 15 only)
`TSLangMetadata` field.
2025-05-29 16:57:51 +02:00
Lewis Russell
532610388b fix(vim.system): improve error message when cwd does not exist
Problem:
vim.uv.spawn will emit ENOENT for either when the cmd or cwd do not
exist and does not tell you which.

Solution:
If an error occurs, check if cwd was supplied and included in the error
message if it does not exist.
2025-05-29 13:59:33 +01:00
Riley Bruins
cc264d51ab test(treesitter): coverage for comments with combined injections (#33975) 2025-05-29 12:10:07 +02:00
zeertzjq
6c4ddf607f vim-patch:9.1.1417: missing info about register completion in complete_info() (#34219)
Problem:  missing info about register completion in complete_info()
          (after v9.1.1408)
Solution: update documentation and mention that register is used as
          source, add a test (glepnir)

closes: vim/vim#17389

49864aecd0

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-29 07:09:50 +08:00
zeertzjq
03933fe4c0 vim-patch:0bc8709: runtime(doc): Correct allowed flags after :substitute repeat (#34218)
closes: vim/vim#17391

0bc8709a63

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-29 07:04:38 +08:00
glepnir
f2373a89d7 vim-patch:9.1.1408: not easily possible to complete from register content (#34198)
Problem:  not easily possible to complete from register content
Solution: add register-completion submode using i_CTRL-X_CTRL-R
          (glepnir)

closes: vim/vim#17354

0546068aae
2025-05-28 09:10:00 +00:00
Christian Clason
a4f318574a build(deps): bump tree-sitter to v0.25.5 2025-05-28 09:28:36 +02:00
phanium
8af28ab9cb fix(filetype): error when vim.filetype.match{buf=fn.bufadd('a.sh')} #34155
Problem: Error when `vim.filetype.match` a buffer with suffix `sh`.

Solution: fallback to an empty string as buffer content.
2025-05-27 06:56:29 -07:00
RedHolger
70697417c4 docs(ui): cmdline_hide parameters #34049 2025-05-27 06:50:20 -07:00
altermo
d22fcf2917 fix(gO): use non-breaking space #34197 2025-05-27 05:38:45 -07:00
luukvbaal
85d33514f9 feat(api): set nvim_echo() kind for ext_messages (#33998)
Problem:  Unable to emit a message with arbitrary kind.
Solution: Add a "kind" opts field to nvim_echo().
          Use it to set the "list_cmd" kind for vim.show_pos().
2025-05-27 13:01:10 +02:00
luukvbaal
3828856233 fix(extui): incorrect cmdline cursor position (#34201)
Problem:  Calculated cmdline cursor position can be smaller than 0.
          Prompt part of the cmdline is translated, while it should
          support "\t" characters.
Solution: Remove prompt part from the stored "cmdbuff" and get rid of
          dubious +/-1 from cmdline cursor calculation.
2025-05-27 12:38:18 +02:00
luukvbaal
8defe1afb2 feat(extui): route to "more" window if it is open (#34190)
Problem:  An already open "more" window is the most convenient place
          to route messages to with `cfg.msg.pos == 'cmd'`. Instead we
          route to the cmdline (unless that message also exceeds
          'cmdheight').
Solution: Route to "more" window while it is open and scroll to bottom
          to show the newest message. This is more convenient and more
          efficient due to not writing to the target buffer first (which
          is done to calculate the height of the message).
          (Ensure message highlights are deleted when text is replaced.)
2025-05-27 11:27:00 +02:00
Sean Dewar
66dddd8b51 fix(folds): adjust filler text drawing for transparent folds
Problem: Search highlighting is applied strangely to the filler text of
transparent folds, and EOL list characters are not shown.

Solution: Don't apply search highlighting to the last column of the window row
if the last text char on the line is highlighted. Display the EOL list char if
needed. Don't highlight the entire filler text when matching EOL, just highlight
the EOL list char or the first filler char.
2025-05-27 08:54:59 +01:00
zeertzjq
c4e52d604c vim-patch:9.1.1413: spurious CursorHold triggered in GUI on startup (#34195)
Problem:  spurious CursorHold triggered in GUI on startup
Solution: init global did_cursorhold flag to true
          (Gary Johnson)

When Vim is started in GUI mode, the CursorHold autocommand event is
triggered 'updatetime' milliseconds later, even when the user has not
pressed a key.  This is different from the behavior of Vim in terminal
mode, which does not trigger a CursorHold autocommand event at startup,
and contradicts the description of the CursorHold event in ":help
CursorHold", which states that the event is "[n]ot triggered until the
user has pressed a key".

The fix is to change the initial value of did_cursorhold from FALSE to
TRUE.  While it is true that the CursorDone event has not been done yet
at startup, it should appear to have been done until the user presses
a key.

fixes vim/vim#17350
closes: vim/vim#17382

318ff9c362

Co-authored-by: Gary Johnson <garyjohn@spocom.com>
2025-05-27 09:16:46 +08:00
zeertzjq
8c5bd841ed build: lint decorations_spec etc. with lintlua (#34182)
Follow-up to #33274
2025-05-27 00:14:42 +00:00
zeertzjq
092e49d020 build: unset $TMUX when running tests (#34178)
This prevents Nvim TUI running in tests from thinking it's inside tmux.

Another solution is make :terminal unset $TMUX instead, but I'm not sure
if that'll break some other use cases.
2025-05-27 07:47:28 +08:00
zeertzjq
a2daa3c0c0 Merge pull request #34193 from zeertzjq/vim-a6172f8
vim-patch: Correct allowed characters at :help 'filetype'
2025-05-27 07:46:13 +08:00
zeertzjq
fbf5fbacc2 vim-patch:f0c7090: runtime(doc): trailing whitespace in options.txt, delete it.
f0c7090a38

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-27 07:24:56 +08:00
zeertzjq
e35a7d4782 vim-patch:a6172f8: runtime(doc): Correct allowed characters at :help 'filetype'
closes: vim/vim#17366

a6172f8c5c

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-27 07:24:18 +08:00
monkoose
5e64d92411 perf(runtime): vim.trim for long only whitespace strings 2025-05-26 22:41:12 +01:00
Christian Clason
ba1cc9e10c vim-patch:69c3493: runtime(doc): clarify license conditions for distributed runtime files
related: vim/vim#17372

69c3493adc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-26 17:51:24 +02:00
Christian Clason
aa9fd08034 vim-patch:c8b7e61: runtime: Add license information for HCL and Terraform runtime files
fixes: vim/vim#17372
closes: vim/vim#17377

c8b7e6129a

Co-authored-by: Gregory Anders <greg@gpanders.com>
2025-05-26 17:51:24 +02:00
luukvbaal
c973c7ae6f fix(extui): write each message chunk pattern separately (#34188)
Problem:  Bulking message lines to write in a single API call is
          complicated and still not correct w.r.t. overwriting
          highlights.
Solution: Write each chunk pattern separately with it's highlight
          such that it will be spliced correctly for message chunks
          that contain a carriage return. Go with correctness over
          performance until this proves to be too inefficient.
          Also add an identifying name to the various extui buffers.
2025-05-26 16:25:45 +02:00
Gabriel Ford
a6e2c22347 test: format decoration_spec.lua (#34181)
Problem: Currently when I run `make format` this is the one file outside
of my changes that isn't currently formatted.

Solution: Format this file.
2025-05-26 09:24:45 +08:00
zeertzjq
bd01bd6564 vim-patch:9.1.1407: Can't use getpos('v') in OptionSet when using setbufvar() (#34177)
Problem:  Can't use getpos('v') in OptionSet when using setbufvar().
Solution: Don't reset Visual selection when switching to the same
          buffer (zeertzjq).

closes: vim/vim#17373

5717ee33db
2025-05-25 22:51:15 +00:00
Maria José Solano
4db58f78b4 fix(lsp): announce normalizesLineEndings capability (#34175) 2025-05-25 15:04:38 -07:00
Maria José Solano
52868977ae refactor(lsp): use vim.validate in vim.lsp.log (#34165) 2025-05-25 15:04:23 -07:00
zeertzjq
8b9500c886 fix(system): don't treat NUL at start as no input (#34167) 2025-05-25 09:28:11 +08:00
bfredl
06043af27d Merge pull request #34054 from bfredl/looking_glass
build.zig: LuaJIT / unittests
2025-05-24 22:05:32 +02:00
bfredl
af947f0107 ci: bump zig to 0.14.1 2025-05-24 21:05:24 +02:00
bfredl
e25b99c5b6 feat(build): make build.zig run unittests 2025-05-24 21:05:24 +02:00
bfredl
c4501e98f2 feat(build): make build.zig use luajit on main plattforms 2025-05-24 21:05:24 +02:00
luukvbaal
a96665cf48 fix(extui): using tracked message column in cleared buffer (#34154)
Problem:  Using tracked message column as column in cleared buffer.
Solution: Ensure column does not exceed current line length.
          Further work to ensure carriage return and cmdline block mode
          work properly.
2025-05-24 20:31:20 +02:00
Christian Clason
8a207b3e19 build(deps): bump tree-sitter-c to v0.24.1 2025-05-24 20:02:29 +02:00
Riley Bruins
baabc35987 fix(treesitter): properly clip nested injections 2025-05-24 11:51:11 +01:00
phanium
a59b052857 fix(extui): map wincmd instead of remapped key (#34151)
Problem: "q" cannot close window when `<c-w>` is mapped.
Solution: Map q to `<Cmd>wincmd c<CR>`.
2025-05-24 12:02:11 +02:00
Christian Clason
c9d8468020 feat(search): increase MAX_COUNT to 999
Problem: "99 searchcount ought to be enough for anyone."

Solution: Increase `SEARCH_STAT_DEF_MAX_COUNT` to 999, which I'm sure
will suffice for the next twenty years.

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-24 10:55:43 +02:00
Luuk van Baal
9784bc1346 fix(extui): append consecutive :echon messages
Problem:  Consecutive `:echon` messages are printed on separate lines.
Solution: Implement the new msg_show->append parameter.
2025-05-24 01:02:22 +02:00
Luuk van Baal
abb40ecedd feat(ui): "append" parameter for "msg_show" UI events
Problem:  Consecutive "msg_show" events stemming from an `:echon`
          command are supposed to be appended without a newline, this
          information is not encoded in the "msg_show" event.
Solution: Add an "append" parameter to the "msg_show" event that is set
          to true to indicate the message should not start on a new line.
Considered alternative: Emit a newline for the common case instead at the
start of a new message. That way UIs can more closely follow the logic
as it is implemented for the message grid currently. This would be a
breaking change. The "append" parameter seems OK.
2025-05-24 01:02:22 +02:00
zeertzjq
7c2b4a0eaf Merge pull request #34137 from brianhuster/vim-2323f22
vim-patch: add chapter 2 of beginner tutor
2025-05-24 06:48:34 +08:00
luukvbaal
6ce2877327 fix(move): consume skipcol before revealing filler lines (#34143)
Problem:  When scrolling (the text) down with 'smoothscroll', filler
          lines are revealed before the text skipped with `w_skipcol`.
Solution: Check `w_skipcol` before filler lines.
2025-05-24 00:45:00 +02:00
zeertzjq
071dcab68f vim-patch:9.1.1405: tests: no test for mapping with special keys in session file (#34146)
Problem:  tests: no test for mapping with special keys in session file.
Solution: Add a special keys to an existing test.  Also test with UTF-8
          characters containing 0x80 or 0x9b bytes (zeertzjq).

closes: vim/vim#17360

9ff1e598e8
2025-05-23 22:38:12 +00:00
brianhuster
f791ae82e5 vim-patch:9.1.1404: wrong link to Chapter 2 in new-tutor
Problem:  wrong link to Chapter 2 in vim-01-beginner.tutor
Solution: Fix the link to Chapter 2, add test for links in tutor files
          (Phạm Bình An)

In order to write the test, I exposed the function `s:GlobTutorials` as
`tutor#GlobTutorials` and make it also accept a `locale` argument.

closes: vim/vim#17356

e8302da74a

Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
2025-05-23 09:59:43 +07:00
brianhuster
41c850e2c8 vim-patch:2323f22: runtime(new-tutor): add chapter two to the interactive tutorial
closes: vim/vim#16803

2323f225ca

Co-authored-by: RestorerZ <restorer@mail2k.ru>
2025-05-23 09:34:39 +07:00
Brahmajit Das
079e7d2b11 vim-patch:df68419: runtime(doc): clarify the use of change marks when writing a buffer (#34132)
related: vim/vim#17008

df68419ba0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-22 23:52:12 +00:00
zeertzjq
153a910897 vim-patch:9.1.1402: multi-byte mappings not properly stored in session file (#34131)
Problem:  multi-byte mappings not properly stored in session file
Solution: unescape the mapping before writing out the mapping, prefer
          single-byte mapping name if possible (Miguel Barro)

closes: vim/vim#17355

5b07aff2f6

Co-authored-by: GuyBrush <miguel.barro@live.com>
2025-05-23 07:42:30 +08:00
zeertzjq
f0fb6d448a vim-patch:f4b2fce: runtime(vim): Update base-syntax, fix missing luaParenError error (#34130)
We shouldn't assume that the luaParenError syntax group is present in
the, possibly custom, included file or that it hasn't already been
removed.  However, issue vim/vim#11277 has been fixed so it no longer needs to
be cleared.

Fixes comment https://github.com/vim/vim/pull/15375#issuecomment-2899791944

related: vim/vim#15375
closes: vim/vim#17357

f4b2fce71c

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-22 23:12:17 +00:00
Evan Hahn
927927e143 fix(lsp): fix error with InsertReplaceEdit events #33973
Problem:
Some LSPs cause the following completion error (reformatted slightly):

    Error executing vim.schedule lua callback:
    .../runtime/lua/vim/lsp/completion.lua:373
    attempt to index field 'range' (a nil value)

This is because an internal function assumes edits are either missing
or of type `TextEdit`, but there's a third [possibility][0] that's not
handled: the `InsertReplaceEdit`.

This was previously reported in at least two issues:

- https://github.com/neovim/neovim/issues/33142
- https://github.com/neovim/neovim/issues/33224

Solution:
Don't assume the edit is a `TextEdit`. This implicitly handles
`InsertReplaceEdit`s.

Also, add a test case for this, which previously caused an error.

[0]: 2c07428966/runtime/lua/vim/lsp/_meta/protocol.lua (L1099)
2025-05-22 06:22:47 -07:00
bfredl
27bb814cb1 Merge pull request #34100 from bfredl/billions
fix(tests): fix unittests so they don't have hidden errors
2025-05-22 13:15:40 +02:00
Yochem van Rosmalen
62ba6e8a76 fix: use nvim namespace convention #34010 2025-05-22 03:40:08 -07:00
Yi Ming
fed9069b8d fix(lsp): avoid foldclose() after current window-buffer changed #33901
Problem:
Because the buffer in the window may change before the request is completed, foldclose() might be executed on the wrong buffer.

Solution:
Avoid that.
2025-05-22 03:16:28 -07:00
bfredl
2d4b028d02 fix(tests): use correct include path for unittest
Copy whatever was made to work for generated headers:

(1) we need to consider all cmake targets not just main_lib
(2) we need to add the sysroot for macOS
2025-05-22 11:56:46 +02:00
bfredl
c81af9428c fix(tests): use uv.spawn instead of io.popen for unittest helpers
The old implementation of repeated_read_cmd would attempt to run the
command multiple times to handle racyness of async output. Code
like this should not be written. Instead, use the libuv event
loop to read until the process has exited and the pipe has been closed.

This causes some previous discarded errors to be propagated. Fix these
as well.
2025-05-22 11:56:46 +02:00
altermo
0412527a40 feat(outline): smaller indentation #34005 2025-05-22 02:21:34 -07:00
bfredl
272e041780 fix(tests): don't surpress stderr output
This is a diabolical anti-pattern and is hiding errors which exist
currently in unittests. Also we want to see _where_ in the process
stderr was emitted, stashing it away at the end erases important
context.
2025-05-22 11:20:35 +02:00
Brynne Taylor
322a6d305d feat(glob): new Glob implementation based on Peglob #33605
|vim.glob.to_lpeg()| uses a new LPeg-based implementation (Peglob) that
provides ~50% speedup for complex patterns. The implementation restores
support for nested braces and follows LSP 3.17 specification with
additional constraints for improved correctness and resistance to
backtracking edge cases.
2025-05-22 00:24:49 -07:00
Christian Clason
172a90c245 vim-patch:b0691b4: runtime(sh): Fix various syntax highlighting problems in ksh93 scripts
- Fixed syntax highlighting for ksh93 namespace variables starting
  with '${.'
- Added support for the alarm, eloop, fds, mkservice, pids, poll and
  sha2sum builtins (which are indeed ksh93 builtins, albeit whether or
  not they are available depends on the ksh release and the compiled
  SHOPT options).
- Added support for the many Unix commands provided by ksh93's libcmd
  as builtin commands (since these are general commands, scripts for
  other shells like bash will also highlight these).
  - The dumps for the sh_0{2,5,6,8,9}.sh were recreated due to this
    change affecting commands those scripts call (e.g. 'wc').
- Enabled ${parameter/pattern/string} and friends for ksh syntax.
- Enabled case modification for ksh. See also:
  https://github.com/ksh93/ksh/commit/c1762e03
- Enabled ;;& support for ksh. See also:
  https://github.com/ksh93/ksh/commit/fc89d20a
- Added many special ksh variables using 93u+m's data/variables.c
  as a reference.

If vim can't figure out which ksh release is in play using e.g.
the hashbang path, in such a case a generic default that enables
everything and the kitchen sink will be used. Otherwise, features will
be disabled if it's absolutely known a certain feature will not be
present. Examples:
   - ERRNO is ksh88 specific, so that is locked to ksh88.
   - Only 93u+m (assumed for generic) has SRANDOM, and only 93u+m
     and 93v- have case modification support.
   - 93u+ and 93v- have VPATH and CSWIDTH variables (the latter
     is vestigal, but still present in the hardcoded variable table).
   - 93v- and ksh2020 have (buggy and near unusable) implementations
     of compgen and complete.
   - Only mksh provides function substitutions, i.e. ${|command;}.

This took the better part of my day to implement. It seems to work well
enough though. (Also had to regenerate the dumps again while testing
it, as now there are dup scripts with mere hashbang differences, used
solely for testing syntax highlighting differences.)

closes: vim/vim#17348

b0691b46bd

Co-authored-by: Johnothan King <johnothanking@protonmail.com>
2025-05-22 08:56:01 +02:00
luukvbaal
7077c59295 fix(extui): reset message state after "search_cmd" message (#34119)
Problem:  A "search_cmd" message alters the message state (since 8e8f4523),
          unnecessarily affecting logic for messages that follow.
Solution: Reset the appropriate variables after a "search_cmd" message.
          Don't show "search_cmd" message with zero 'cmdheight'.
2025-05-21 23:34:09 +02:00
Maria José Solano
2e0158650a fix(diagnostic): accept multiple namespace in open_float() (#34073) 2025-05-21 10:54:43 -07:00
Rijul Kapoor
19efabafc5 fix(diagnostics): fixed virtual_text cursormoved autocmd error (#34017) 2025-05-21 10:20:37 -05:00
Phạm Bình An
dd43eb445a docs(tutor): move lesson 7.2 below lesson 7.3 #33662
Problem:

- Lesson 7.3 (Cmdline Completion) teaches an important way to discover
  Nvim features. I think users should learn it before they start
  configuring Nvim
- Nvim can be configured in Lua as well, but lesson 7.2 (Configuring
  Nvim) only mentions init.vim. And I think Nvim is promoting Lua more

Solution:

- Move lesson 7.2 to be after lesson 7.3
- Lesson 7.2 should teach about init.lua

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-05-21 02:26:57 -07:00
Gregory Anders
cd9d8469b2 Merge pull request #34090 from yochem/exrc-search-parent
feat(exrc): unset 'exrc' to stop searching parent directories
2025-05-20 12:06:08 -05:00
Gregory Anders
5ad01184f3 fix(lsp/health): ensure valid table before concatenating (#34092)
The root_markers field can now contain a table of tables (as of
https://github.com/neovim/neovim/pull/33485) and :checkhealth will show
an error in that case since Lua cannot concatenate a table of tables.

Ensure that tables contain strings before concatenating and if not, fall
back to using vim.inspect().
2025-05-20 12:05:20 -05:00
Christian Clason
849e24f3cd vim-patch:719ec0f: runtime(tar): preserve pwd when reading and writing tar files
While at it, use `:lcd` to temporarily set the window local directory
instead of `:cd` for the global working directory.

fixes: vim/vim#17334
closes: vim/vim#17339

719ec0fe15

Co-authored-by: Michele Sorcinelli <michelesr@autistici.org>
2025-05-20 08:15:27 +02:00
Christian Clason
14631e2264 vim-patch:5ad53ca: runtime(muttrc): fix mangled keywords in syntax script
Regression introduced in commit 10f23e10a9 ("Update syntax/muttrc.vim to
latest mutt (vim/vim#12797)", 2023-08-15)

Affected keywords:
  invresume_draft_files
  invresume_edited_draft_files
  mailcap_path
  mark_macro_prefix

closes: vim/vim#17344

5ad53ca99f

Co-authored-by: Markus Heidelberg <markus.heidelberg@web.de>
2025-05-20 08:15:27 +02:00
v1nh1shungry
dbe17da120 fix(diagnostic): deprecate float in vim.diagnostic.Opts.Jump (#34037) 2025-05-19 19:44:26 -07:00
Phạm Bình An
1524868711 vim-patch:5a8f995: runtime(doc): remove outdated Contribution section in pi_tutor (#34094)
Problem:  The Github repo link in the Contribution section has been
          archived for 5 years. So people who want to contribute to the
          tutor plugin should just send PR to Vim repo, similar to most
          other Vim features, so there is no need for a Contribution
          section in the plugin doc.

Solution: Replace it with an Original Author note at the beginning of
          the help document.

closes: vim/vim#17341

5a8f9958e2
2025-05-20 00:21:30 +00:00
Yochem van Rosmalen
8d397fa458 feat(exrc): stop searching in parent directories by unsetting 'exrc'
Problem:
No way for a user to limit 'exrc' search in parent directories (compare
editorconfig.root).

Solution:
A configuration file can unset 'exrc', disabling the search for its
parent directories.
2025-05-20 00:03:14 +02:00
Fionn Fitzmaurice
2045e9700c Don't set manwidth wider than the window (#34078)
fix: set manwidth to not exceed the window width

If we set the MANWIDTH variable to a value wider than the window, the
contents wrap and formatting breaks. A more sensible way to handle this
is to interpret MANWIDTH as a maximum width, but to set the width to the
window size if smaller.

See also: #9023, #10748.
2025-05-19 12:37:03 -05:00
bfredl
dfad613813 Merge pull request #33884 from neovim/dependabot/github_actions/mlugg/setup-zig-2
ci: bump mlugg/setup-zig from 1 to 2
2025-05-19 16:07:58 +02:00
Yochem van Rosmalen
dc6fc11b87 fix(defaults): start exrc search from parent directory
Problem:
The exrc file in the current directory is executed twice, here and in
`do_exrc_initalization()`.

Solution:
Start search from parent directory. Let core handle exrc in current
directory.
2025-05-19 15:16:36 +02:00
zeertzjq
dc6885dc24 vim-patch:9.1.1398: completion: trunc does not follow Pmenu highlighting attributes (#34084)
Problem:  When items are combined with user-defined highlight attributes
          (e.g., strikethrough), trunc inherits these attributes, making
          the text difficult to read.
Solution: trunc now uses the original Pmenu and PmenuSel highlight
          attributes (glepnir)

closes: vim/vim#17340

0816f17e9a

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-19 08:11:54 +08:00
Fredrik Foss-Indrehus
3a35fdc347 feat(clipboard): wayclip primary clipboard and correct mimetype (#33990)
* Don't specify wayclip mimetype

Problem:  Since wayclip 0.2, wayclip assumes UTF-8
          (text/plain;charset=utf-8) in absence of an explicit mimetype.
	  Since Neovim sets the mimetype to "text/plain" without
	  specifying UTF-8, you will also have to use `-t text/plain`
	  when using waypaste or wayclip outside of Neovim.

Solution: Don't specify mimetype when using wayclip, thereby using the
          default "text/plain:charset=utf-8".

* Add primary clipboard support to wayclip

wayclip have had support for primary clipboard for some time now.

---------

Co-authored-by: Fredrik Foss-Indrehus <fred@ffoss.net>
2025-05-19 07:44:13 +08:00
bfredl
a87aa68ed0 Merge pull request #34071 from bfredl/tagutf
refactor(helptags): remove useless homegrown encoding check
2025-05-18 11:36:12 +02:00
Christian Clason
23c214ed4a build(deps): bump uncrustify to 0.81.0 2025-05-18 09:59:21 +02:00
zeertzjq
5661f74ab2 Merge pull request #34075 from zeertzjq/vim-a577e42
vim-patch: Vim syntax updates
2025-05-18 07:06:55 +08:00
zeertzjq
ba237ce96c vim-patch:a577e42: runtime(vim): Update base-syntax, improve script-interface command highlighting
- Normalise interface heredoc highlighting with that used for
  :let-heredocs.
- Remove interface feature testing.  The Lua and Python interface
  command scripts are now highlighted by default.  Loading all syntax
  files incurs an undesirable load-time burden so highlighting of the
  less popular MzScheme, Perl, Ruby and Tcl interfaces is disabled by
  default.  g:vimsyn_embed can still be used to customise the supported
  interfaces.
- Always highlight interface ex-commands as valid commands, even when
  the corresponding command-script highlighting is disabled.
- Highlight simple command-script statements as well as heredocs.
- Remove error highlighting of heredoc and statement command-script
  regions when an interface is disabled.  These are now highlighted as
  plain text.
- Allow indented heredoc end tokens when "trim" is specified.
- Match interface heredocs in :def functions.
- Fix runaway vimEmbedError regions.  These regions have been removed.
- Use python2 syntax for :python, and :pythonx when 'pyxversion' is
  appropriately set.

closes: vim/vim#15522

a577e4289c

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-18 06:44:49 +08:00
zeertzjq
913e4c6010 vim-patch:e957cba: runtime(vim): Update base-syntax, match quote separated numbers
closes: vim/vim#17250

e957cba081

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-18 06:14:16 +08:00
Christian Clason
4a6f017bc1 build(deps): bump tree-sitter-markdown to v0.5.0 2025-05-17 19:26:34 +02:00
Anakin Childerhose
4eed85f9bd feat(logs): show full paths in lsp logs (#33886)
feat(logs): show full path of short_src in lsp logs

Problem:
- Cannot gf to info.short_src printed in the logs since only the last 16
  characters are printed

Solution:
- Print full info.short_src and remove ...
2025-05-17 09:57:22 -07:00
bfredl
9a322f8103 refactor(helptags): remove useless homegrown encoding check
This check was always broken. it will "detect" a file as
other-than-UTF-8 if the first line of a help file only is ASCII.

This only works by accident, as all our help files are UTF-8 (or
ASCII-only, which is fully compatible), but are all ASCII-only
on the first line of every help file which means that all helpfiles
gets detected as not-UTF8 which makes the "consistency" test pass
by accident even though the actual consistency is that every single
file is UTF-8 compatible. This means that the
"!_TAG_FILE_ENCODING\tutf-8\t" meta-tag already did not get emitted
but YAGNI in either case as no encoding tag just means that 'encoding'
is used which in neovim always is UTF-8 anyway.

An alternative approach would be to integrate the real encoding
detection already present in the codebase (an editor which edits text of
various encodings) which checks the entire file instead of a weird
first-line-only-hack, but as it happens to be 2025 the resolution of
encoding trouble is to just use UTF-8 everywhere. And if you use something
else you have to keep track yourself anyway it is not like we can detect
if one helpfile of your plugin is latin-1 and another is latin-2 or
whatever. Also, Nvim will detect the encoding of the file when you open
the file as a :help buffer anyway.
2025-05-17 17:01:09 +02:00
Christian Clason
81bb7613f9 build(deps): bump tree-sitter-lua to v0.4.0 2025-05-17 13:20:31 +02:00
luukvbaal
8e8f4523c6 fix(extui): translate <Tab> in cmdline text (#34055)
Problem:  <Tab> is not translated on the cmdline, and exposes a wrong
          assumption in search messages that may contain multiple chunks.
Solution: Translate unprintable characters in the cmdline content.
          Extract the 'search_count' from the last chunk and route
          'search_cmd' to cmdline to handle multiple chunks.
2025-05-17 11:24:05 +02:00
Christian Clason
f40e140083 build(deps): bump luv to 1.51.0-1 2025-05-17 10:59:14 +02:00
zeertzjq
99384fcd9c vim-patch:9.1.1396: 'grepformat' is a global option (#34060)
Problem:  The 'grepformat' option is global option, but it would be
          useful to have it buffer-local, similar to 'errorformat' and
          other quickfix related options (Dani Dickstein)
Solution: Add the necessary code to support global-local 'grepformat',
          allowing different buffers to parse different grep output
          formats (glepnir)

fixes: vim/vim#17316
closes: vim/vim#17315

7b9eb6389d

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-17 00:20:20 +00:00
zeertzjq
ec5f054dc9 vim-patch:9.1.1395: search_stat not reset when pattern differs in case (#34058)
Problem:  search_stat not reset when pattern differs in case
          (tahzibijafar)
Solution: use STRNCMP instead of MB_STRNICMP macro

There was a long standing todo comment, that using MB_STRNICMP is wrong.
So let's change it to STRNCMP() instead. Even if it not handle
multi-byte characters correctly, then Vim will rather recompute the
search stat, instead of re-using the old (and possibly wrong) value.

fixes: vim/vim#17312
closes: vim/vim#17314

670d0c1468

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-16 23:47:20 +00:00
zeertzjq
6af1b7e5e8 fix(:print): don't use schar_from_ascii() for illegal byte (#34046) 2025-05-17 06:35:20 +08:00
Christian Clason
3659058e80 build(deps): bump tree-sitter-vimdoc to v4.0.0 2025-05-16 19:39:44 +02:00
Christian Clason
9d1996ac61 build(deps): bump tree-sitter-query to v0.6.1 2025-05-16 18:42:56 +02:00
bfredl
37cac18787 Merge pull request #34038 from bfredl/tui_mode
refactor(tui): don't use pseudo-terminfo for custom modes
2025-05-16 11:45:49 +02:00
bfredl
82027fd6bd refactor(tui): don't use pseudo-terminfo for custom modes
This just cleans up some old definitions from before tui_set_term_mode
existed. There is no need to represent custom modes in a different
format just because they are safe without feature detection.
2025-05-16 11:02:53 +02:00
bfredl
6e3eb6663e Merge pull request #34016 from bfredl/tui_scroll_shame
fix(tui): don't disable vsplit scrolling in all xterm-like terminals
2025-05-16 10:59:50 +02:00
Christian Clason
1be2fdb910 vim-patch:6451e5f: runtime(gleam): add @Spell clusters to syntax script
closes: vim/vim#17324

6451e5f517

Co-authored-by: Kat <65649991+00-kat@users.noreply.github.com>
2025-05-16 10:49:40 +02:00
Christian Clason
469541c415 vim-patch:1aa68df: runtime(pandoc): update YAML metadata block parsing in compiler runtime
Previously the incorrect regexp forced title to be a single letter
because of using '+' instead of the '\+' regexp modifier.

closes: vim/vim#17321

1aa68dffbf

Co-authored-by: Alexander Abrosimov <alexander.n.abrosimov@gmail.com>
2025-05-16 10:49:40 +02:00
Sean Dewar
2fda267faf vim-patch:9.1.1393: missing test for switching buffers and reusing curbuf
Problem:  The check in buf_freeall that restores curwin subtly prevents
          leaving an unloaded buffer in a window when reusing curbuf, if
          autocommands switch to a different buffer.
Solution: Add a test case that covers this. Also ensure splitting isn't
          possible, as that could do the same (Sean Dewar)

closes: vim/vim#17325

31be82e66d

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-15 21:05:07 +01:00
bfredl
763e7428e2 refactor(tui): remove obsolete can_set_left_right_margin duplicate
According to terminfo(5), these are obsolete:

Except for very old terminal descriptions, e.g., those developed
for SVr4, the scheme just described should be considered obsolete.
An improved set of capabilities was added late in the SVr4
releases (smglr and smgtb), which explicitly use two parameters
for setting the left/right or top/bottom margins.
2025-05-15 19:02:10 +02:00
bfredl
142f914089 fix(tui): feature detect vsplit scrolling in xterm-like terminals
Current "patch" asserts that EVERY terminal claiming to be an xterm has
broken vertical split scrolling which is far too an aggressive
workaround.

Instead, as left-right margins for scrolling regions use a
private DEC mode, we can use feature detection to use them in supported
terminals only. This way, users who use properly implemented terminals
can enjoy hardware accelerated scrolling even with vertical split
windows.
2025-05-15 18:56:45 +02:00
luukvbaal
70eb416459 fix(extui): better message highlighting after carriage return (#34034)
Problem:  Incorrect message highlighting for highlighted message
          chunks containing carriage returns.
Solution: Add a highlight for each substring ending in a newline or
          carriage return separately.
2025-05-15 17:23:01 +02:00
zeertzjq
17e13ce3b6 fix(tui): clear primary device callback before invoking it (#34032)
A primary device callback may set a new callback (e.g. when suspending),
so clearing it after invoking it is too late.

While at it, add missing reset of did_set_grapheme_cluster_mode in
terminfo_start().
2025-05-15 20:42:49 +08:00
luukvbaal
f87b6230f1 vim-patch:9.1.1388: Scrolling one line too far with 'nosmoothscroll' page scrolling (#34023)
Problem:  One-off error in "count" to make "w_skipcol" zero with
          'nosmoothscroll' page scrolling when last virtual line
          in a buffer line is exactly the entire window width.
          (Hirohito Higashi)
Solution: Properly compute the smallest integer value necessary
          to make "w_skipcol" zero (Luuk van Baal)

c6c72d165c
2025-05-15 10:01:34 +02:00
Sean Dewar
6b9665a507 vim-patch:9.1.1387: memory leak when buflist_new() fails to reuse curbuf
Problem:  buflist_new() leaks ffname and fails to reuse curbuf when
          autocommands from buf_freeall change curbuf. Plus, a new
          buffer is not allocated in this case, despite what the comment
          above claims.
Solution: Remove the condition so ffname is not leaked and so a new
          buffer is allocated like before v8.2.4791. It should not be
          possible for undo_ftplugin or buf_freeall autocommands to
          delete the buffer as they set b_locked, but to stay consistent
          with other uses of buf_freeall, guard against that anyway
          (Sean Dewar).

Note that buf is set to NULL if it was deleted to guard against the (rare)
possibility of messing up the "buf != curbuf" condition below if a new buffer
happens to be allocated at the same address.

closes: vim/vim#17319

0077282c82

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-15 08:47:49 +01:00
glepnir
f2aec4bc05 vim-patch:9.1.1389: completion: still some issue when 'isexpand' contains a space (#34026)
Problem:  Cannot get completion startcol when space is not the first
          trigger character (after v9.1.1383)
Solution: Detect the next comma followed by a space in the option string
          and use in next compare loop (glepnir)

closes: vim/vim#17311

08db2f4f28
2025-05-15 06:15:29 +00:00
Luuk van Baal
d25eb246ef revert: show "g<" hint when message spills 'cmdheight'
Problem:  Hint message to press "g<" for message that spills
          'cmdheight' is too intrusive.
Solution: Remove the hint message. Document the meaning of the spill
          indicator instead.
2025-05-14 15:36:42 +02:00
Luuk van Baal
4d56dc43c0 fix(extui): handle carriage return in messages
Problem:  Carriage return should place the "write cursor" at the start of a line.
Solution: Construct the to be printed line by iterating over carriage returns.
2025-05-14 15:36:42 +02:00
bfredl
b0bb3cccf9 Merge pull request #34015 from bfredl/tui_scroll_state
refactor(tui): remove scroll_region_is_full_screen global state
2025-05-14 10:54:19 +02:00
bfredl
2bfb12ef46 refactor(tui): remove scroll_region_is_full_screen global state
This is a left-over for when we ported to state-less scrolling events
(e.g. no scrolling regions as part of the ext_linegrid state).

We always reset the scrolling region after performing a non-fullscreen
scroll. Thus the extra check in tui_grid_resize() is not needed.
2025-05-14 10:32:14 +02:00
Maria José Solano
570e62d0f9 docs(diagnostic): add on_jump example (#33933) 2025-05-13 19:39:05 -07:00
Maria José Solano
4fae013a21 feat(diagnostic): add enabled filter (#33981) 2025-05-13 19:32:00 -07:00
Lewis Russell
40b64e9100 refactor(treesitter): move functions from executor.c to treesitter.c 2025-05-13 15:44:42 +01:00
Luuk van Baal
cc78f88201 fix(extui): adjust which messages are sent to "more" window
Problem:  Decision whether message is sent to "more" window is based on
          the number of newlines present in a message, rather than the
          actual text height.
          With the "box" target, messages that come from a cmdline
          entered command are not always routed to the more window.
Solution: Still write the message to the target buffer, and calculate
          the actual text height. Postpone updating several state
          variables until after the decision to re-route is made.
          With the "box" target, only consider the text height of the
          message if it is not a message from a cmdline entered command.
2025-05-13 08:45:08 +02:00
Luuk van Baal
a62e55d407 feat(extui): show "g<" hint when message spills 'cmdheight'
Problem:  Extui shows a spill indicator to hint to the user to press "g<"
          to show the output of the last command. The user may be
          unaware of this mapping.
Solution: Route a hint message to the message "box" window.
2025-05-13 08:45:08 +02:00
luukvbaal
d539a952da vim-patch:9.1.1385: inefficient loop for 'nosmoothscroll' scrolling (#33992)
Problem:  Loop that ensures "w_skipcol" is zero with 'nosmoothscroll'
	  for (half)-page scrolling is inefficient.
Solution: Calculate the required "count" instead of looping until
	  "w_skipcol" is zero (Luuk van Baal).

acf0ebe8a8
2025-05-13 08:39:34 +02:00
glepnir
e4c4d672b5 vim-patch:9.1.1383: completion: 'isexpand' option does not handle space char correct (#33999)
Problem:  When a space character is used as a trigger in 'isexpand' option
          it doesn't get recognized because skip_to_option_part() skips
          spaces after a comma, treating them as option separators
          rather than option value (after v9.1.1341)
Solution: manually set the part to a space character (glepnir).

closes: vim/vim#17305

8d0e42b710
2025-05-13 14:29:07 +08:00
zeertzjq
cc6ee59f5a Merge pull request #33994 from brianhuster/vim-3704b5b
vim-patch:37045b5,9.1.1384 && fix(tutor): `l:lang` is undefined
2025-05-13 10:07:51 +08:00
Maria José Solano
2f24ae8de4 feat(diagnostic): add format option to setloclist/setqflist (#33977) 2025-05-12 20:50:37 -04:00
Maria José Solano
c681336e3c fix(diagnostic): accept multiple namespaces when setting loclist/qflist (#33982) 2025-05-12 20:13:26 -04:00
brianhuster
e5665754d1 fix(tutor): l:lang is undefined
Problem:
The scope `elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"` in
function `s:Locale` in file `runtime/autoload/tutor.vim` leaves a case
when l:lang is not defined.

Solution:
Define `l:lang` at function scope instead of `if` scope
2025-05-13 06:54:48 +07:00
brianhuster
e01f196e44 vim-patch:9.1.1384: still some problem with the new tutors filetype plugin
Problem:  still some problem with the new tutors filetype plugin
Solution: refactor code to enable/disable tutor mode into
          tutor#EnableInteractive() function, include a test
          (Phạm Bình An)

I find it annoying that Tutor's interactive mode is always on (or debug
mode is off) even when I open a tutor file with :edit command.
I think it makes more sense to make this "interactive mode":

- Always on when it is opened with :Tutor command
- Off otherwise

For more references, see `:help` feature, it is a much better than
:Tutor, since I don't have to run `:let g:help_debug = 1` just to be able
to edit and save a help file

Therefore, I remove `g:tutor_debug`

closes: vim/vim#17299

13bea589a2

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2025-05-13 06:54:32 +07:00
brianhuster
238e1d6ecc vim-patch:3704b5b: runtime(tutor): improve tutor.vim plugin and filetype plugin
- Set g:tutor_debug on startup if it doesn't exist so that users can get
  cmdline completion when interactively setting it.
- set b:undo_ftplugin in filetype plugin
- set default runtime file headers

closes: vim/vim#17274

3704b5b58a

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2025-05-13 04:38:55 +07:00
bfredl
69d04ee99f Merge pull request #33987 from bfredl/bump2
fix(scripts): use right syntax for choosing ref in "zig fetch"
2025-05-12 19:14:26 +02:00
bfredl
d04cbb65b9 fix(scripts): use right syntax for choosing ref in "zig fetch" 2025-05-12 13:24:38 +02:00
Christian Clason
9c0afc8873 build(deps): bump tree-sitter-query to v0.6.0 2025-05-12 11:25:07 +02:00
Riley Bruins
7369f80b19 refactor(treesitter): remove empty parse callback
Now that we have bumped to tree-sitter 0.25.4, we no longer need to do
this since upstream does it for us when calling the regular parse
method.
2025-05-11 20:14:08 +02:00
Sean Dewar
ef5c5dc99b vim-patch:9.1.1380: 'eventignorewin' only checked for current buffer
Problem:  When an autocommand executes for a non-current buffer,
          'eventignorewin' is only checked from the buffer's last
          wininfo (overwrites win_ignore in the loop), not from the
          value of 'eventignorewin' in all windows showing the buffer as
          described (after v9.1.1084)

Solution: Fix the check and don't use wininfo, as that may only contain
          windows that recently showed the buffer. Consider all the
          buffer's windows in all tabpages (Sean Dewar).

closes: vim/vim#17294

d4110e0695

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-11 17:12:54 +01:00
Yochem van Rosmalen
23bf4c0531 feat(exrc): search in parent directories (#33889)
feat(exrc): search exrc in parent directories

Problem:
`.nvim.lua` is only loaded from current directory, which is not flexible
when working from a subfolder of the project.

Solution:
Also search parent directories for configuration file.
2025-05-11 11:00:51 -05:00
Christian Clason
2c07428966 build(deps): bump tree-sitter to v0.25.4 2025-05-11 16:49:06 +02:00
Sean Dewar
d95b0a5396 vim-patch:9.1.1376: quickfix dummy buffer may remain as dummy buffer
Problem:  when failing to wipeout a quickfix dummy buffer, it will
          remain as a dummy buffer, despite being kept.
Solution: clear its dummy BF_DUMMY flag in this case (Sean Dewar).

closes: vim/vim#17283

270124f46a

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-11 15:31:37 +01:00
Sean Dewar
05dab80d8d vim-patch:9.1.1375: [security]: possible heap UAF with quickfix dummy buffer
Problem:  heap use-after-free possible when autocommands switch away from the
          quickfix dummy buffer, but leave it open in a window.
Solution: close its windows first before attempting the wipe.
          (Sean Dewar)

related: vim/vim#17283

b4074ead5c

Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2025-05-11 15:31:37 +01:00
glepnir
4b3a9ac413 vim-patch:9.1.1381: completion: cannot return to original text (#33966)
Problem:  Cannot return to the original text after selecting the next
          item when the currently selected item is the last one.
Solution: When continuing to move down past the last item, locate the
          original completion at the head/tail nodes of the completed
          linked list (glepnir).

closes: vim/vim#17300

5a18ccf490
2025-05-11 12:36:20 +00:00
Christian Clason
59c45b22d9 fix(runtime): remove erroneously added syntax tests
fixup for a2c3591720
2025-05-11 11:54:58 +02:00
Christian Clason
73e7e7631c build(deps): bump luv to 1.51.0-0 2025-05-11 11:08:33 +02:00
Christian Clason
1889c351fd vim-patch:7344024: runtime(java): Search type and method declarations with "&inc" and "&def"
=============== LIMITATIONS AND OBSERVATIONS ===============

* Remember that external-type names can only be found when
  they match filenames resolvable in "&path" with "import"
  declarations; load the source file of an external type to
  look up its nested types and sibling top types, if any.

* Strive to narrow the search by assigning only relevant
  pathnames for directories *or* an archive to "&path", e.g.
  ":set path-=/usr/include".

* Use "{Visual}gf" on fully-qualified names.

* Accept the fact that "&define" cannot contain end-of-line
  characters (":help definition-search").  A declaration
  whose matchable header is not contained within a line can
  be found iff all of its non-optional components belong to
  the same line; for types, such components are a keyword,
  e.g. "class", followed by a run of blank characters and
  an identifier, e.g. "Test"; for methods: a return type,
  e.g. "String", or a keyword "void", followed by a run of
  blank characters and an identifier, e.g. "toString", that
  is followed by "(".

* The members of the "java.lang" package are usually not
  associated with "import" declarations; to look up their
  declarations, load a source file for a member of that
  package, and then use, on a simple name of interest for
  a member, either "[-Ctrl-d" etc. for local declarations
  or "gf" for external declarations, assuming that "." *or*
  the appropriate pathname for a JDK archive is assigned to
  "&path".

* Follow the above instruction made for the "java.lang"
  members for any type whose simple name is not associated
  with an "import" declaration, i.e. a member type of the
  same package that is declared in another compilation unit.

* Append the "$" character to "&iskeyword" when looking up
  declarations of generated code.

See zzzyxwvut/java-vim#4.

closes: vim/vim#17281

7344024536

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-05-11 10:47:39 +02:00
Christian Clason
a2c3591720 vim-patch:dc7ed8f: runtime(html): Optionally fold tags with the "expr" method
Tag folding poses a few difficulties.  Many elements, e.g.
"blockquote", are always delimited by start and end tags;
end tags for some elements, e.g. "p", can be omitted in
certain contexts; void elements, e.g. "hr", have no end tag.
Although the rules for supporting omissible end tags are
ad-hoc and involved, they apply to elements in scope.
Assuming syntactical wellformedness, an end tag can be
associated with its nearest matching start tag discoverable
in scope and towards the beginning of a file, whereas all
unbalanced tags and inlined tags can be disregarded.

For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <p>Paragraph vim/vim#1.		<!--  = : 2 -->
    <p>				<!-- >3 : 3 -->
      Paragraph vim/vim#2.		<!--  = : 3 -->
    </p>			<!-- <3 : 3 -->
    <p>Paragraph vim/vim#3.</p>	<!--  = : 2 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

(HTML comments here, "<!-- ... -->", record two values for
each folded line that are separated by ":", a value obtained
from "&foldexpr" and a value obtained from "foldlevel()".)

Innermost foldedable tags will be flattened.  For example:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre><code>		<!-- >4 : 4 -->
[CODE SNIPPET]			<!--  = : 4 -->
      </code></pre>		<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

No folding will be requested for the "<code>"-"</code>" tag
pair and reflected by "&foldexpr" because such a fold would
have claimed the same lines that the immediate fold of the
"<pre>"-"</pre>" tag already claims.

Run-on folded tags may confuse Vim.  When a file such as:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
				<!--  = : 3 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#2]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div>			<!-- <3 : 3 -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

is reformatted as follows:
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">		<!-- >1 : 1 -->
  <body>			<!-- >2 : 2 -->
    <div class="block">		<!-- >3 : 3 -->
      <pre>			<!-- >4 : 4 -->
	<code>			<!-- >5 : 5 -->
[CODE SNIPPET vim/vim#1]		<!--  = : 5 -->
	</code>			<!-- <5 : 5 -->
      </pre>			<!-- <4 : 4 -->
    </div><div class="block"><pre><code> <!-- <3 : 3 -->
[CODE SNIPPET vim/vim#2]		<!--  = : 2 ? -->
	</code>			<!-- <5 : 2 ? -->
      </pre>			<!-- <4 : 2 ? -->
    </div>			<!-- <3 : 2 ? -->
  </body>			<!-- <2 : 2 -->
</html>				<!-- <1 : 1 -->
------------------------------------------------------------

"&foldexpr" values will not be used as is for the lines
between (and including) "[CODE SNIPPET vim/vim#2]" and "</div>".
(Cf. v9.1.0002.)

Having syntax highlighting in effect, tag folding using the
"fold-expr" method can be enabled with:
------------------------------------------------------------
	let g:html_expr_folding = 1
------------------------------------------------------------

By default, tag folding will be redone from scratch after
each occurrence of a TextChanged or an InsertLeave event.
Such frequency may not be desired, especially for large
files, and this recomputation can be disabled with:
------------------------------------------------------------
	let g:html_expr_folding_without_recomputation = 1
        doautocmd FileType
------------------------------------------------------------

To force another recomputation, do:
------------------------------------------------------------
	unlet! b:foldsmap
	normal zx
------------------------------------------------------------

References:
https://web.archive.org/web/20250328105626/https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
https://en.wikipedia.org/wiki/Dangling_else

closes: vim/vim#17141

dc7ed8f946

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-05-11 10:47:39 +02:00
Christian Clason
1826ad16af vim-patch:839b79e: runtime(sh): Update syntax, improve wildcard character class matching
- Default to POSIX supported classes.
- Add a KornShell specific class list.
- Remove "or" from the Bash class list, presumably a typo.

closes: vim/vim#17293

839b79eeb3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-11 10:47:39 +02:00
Riley Bruins
de45b8e275 fix(treesitter): proper tree contains() logic with combined injections
**Problem:** `LanguageTree:contains()` considers any range within the
start of the first tree and end of the last tree as "within" the
language tree. In the case of combined injections, this is problematic
because we only want to consider ranges within any of the combined trees
as "contained" (as opposed to any range within the entire range spanned
by all combined trees).

**Solution:** Use a more discriminative check in
`LanguageTree:contains()`.
2025-05-11 08:04:57 +01:00
Maria José Solano
bee45fc0e7 refactor(docs): remove unnecessary @private/@nodoc annotations (#33951)
* refactor(docs): remove `@private` annotations from local functions

* refactor(docs): remove unnecessary `@nodoc` annotations
2025-05-10 14:42:48 -07:00
zeertzjq
8605f5655b vim-patch:9.1.1378: sign without text overwrites number option (#33942)
Problem:  When 'signcolumn' is set to `number` but a line has a sign
          without text, the line number disappears (finite-state-machine)
Solution: Verify that a sign actually contains text before rendering the
          line number (glepnir)

fixes: vim/vim#17169
closes: vim/vim#17282

1b186833c1

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-10 22:12:07 +08:00
zeertzjq
f38f92931a vim-patch:0553f2f: runtime(doc): clarify single/multibyte support for 'fillchars' (#33941)
closes: vim/vim#17287

0553f2ff0d

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-05-10 22:11:55 +08:00
Christian Clason
44a6e5ea99 vim-patch:6b7637e: runtime(lf): use syn iskeyword in syntax script
Sets 'syn iskeyword' in syntax/lf.vim to fix the missing lf keyword
highlighting in lines like 'map e :open; open' (first 'open' not
highlighted).

applies PR andis-sprinkis/lf-vim#21 by @joelim-work
closes: andis-sprinkis/lf-vim#14

6b7637e6bb

Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
2025-05-10 15:16:19 +02:00
bfredl
1c96b72dfa fix(deps): make script/bump_deps.lua update build.zig.zon versions in sync
Also bring luv version in build.zig.zon up to date

This skips some deps not currently managed/used by build.zig
2025-05-10 10:34:40 +02:00
zeertzjq
1d9990daac fix(folds): avoid unnecessary loop with horizontal scrolling (#33932)
Fix #33931
2025-05-10 10:36:33 +08:00
zeertzjq
9b11746d80 Merge pull request #33930 from zeertzjq/vim-17ad852
vim-patch: doc updates
2025-05-10 08:40:14 +08:00
zeertzjq
cb12c8fa47 vim-patch:9973b39: runtime(doc): remove duplicate sentence in builtin.txt
9973b39a17

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-10 07:29:41 +08:00
zeertzjq
1bfb8dd338 vim-patch:17ad852: runtime(doc): update return types for builtin functions
fixes: vim/vim#17273

credit: Github user @msoyka2024

17ad852a62

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-10 07:29:37 +08:00
luukvbaal
db702782e0 fix(extui): close cmdwin to enter "more" window (#33860)
Problem:  Cannot enter "more" window while cmdwin is open since it is a
          regular window and changing windows is disallowed.
Solution: Close cmdwin to enter the "more" window. Minor regression
          w.r.t. the current message grid. Resolving that will require
          somehow bypassing textlock for the "more" window.
2025-05-09 23:54:39 +02:00
Natanael Copa
c2d218d0c6 test(treesitter): add flaky test to TEST_SKIP_FRAGILE #33912
ref: https://github.com/neovim/neovim/issues/33910#issuecomment-2863276239
2025-05-09 12:26:17 -07:00
Sean Dewar
e56292071a fix(terminal): check size when switching buffers
Problem: terminal not always resized when switching to its buffer.
Solution: add missing calls to terminal_check_size.
2025-05-09 17:49:57 +01:00
luukvbaal
302e59f734 feat(extui): assign 'filetype' to extui windows (#33924)
Problem:  Unable to discern windows used by the extui interface
          to configure their local options.
          'winblend' may be detrimental to legibility depending on the
          colorscheme and 'background'.
Solution: Assign the "cmdline", "msgmore", "msgprompt" and "msgbox" 
          'filetype' to the respective windows.
          Don't set 'winblend' for the message "box" window.
2025-05-09 14:47:36 +02:00
Artem
6adf48b66d fix(decor): extmark highlight not applied (#33858)
Problem: If the only highlight present in the buffer is an extmark, and its end
position is outside the screen, redraws that start on lines after the
first line of the mark will consider the buffer as not having any highlights,
and skip drawing the mark's highlight.
Solution: Check the updated number of decor ranges.
2025-05-09 12:37:43 +02:00
luukvbaal
7e787f6a4f fix(extui): route interactive messages to more-window (#33885)
Problem:  Extui does not route messages emitted as a result of a typed
          command to the "more" window.
          Command message leading shell messages is missing a kind.
          Messages not routed to 'cmdheight' area after it was 0.
Solution: Route messages that were emitted in the same event loop as an
          entered command to the "more" window. Also append multiple
          messages in an already open more-window.
          Assign it the `shell_cmd` kind.
          Change message position when 'cmdheight' changes from 0.
2025-05-09 12:17:26 +02:00
zeertzjq
3121e02ae0 Merge pull request #33918 from zeertzjq/vim-9.1.1373
vim-patch:9.1.{1373,1374}
2025-05-09 07:21:21 +08:00
zeertzjq
15d31fe7a6 vim-patch:9.1.1374: completion: 'smartcase' not respected when filtering matches
Problem:  Currently, 'smartcase' is respected when completing keywords
          using <C-N>, <C-P>, <C-X><C-N>, and <C-X><C-P>. However, when
          a user continues typing and the completion menu is filtered
          using cached matches, 'smartcase' is not applied. This leads
          to poor-quality or irrelevant completion suggestions, as shown
          in the example below.
Solution: When filtering cached completion items after typing additional
          characters, apply case-sensitive comparison if 'smartcase' is
          enabled and the typed pattern includes uppercase characters.
          This ensures consistent and expected completion behavior.
          (Girish Palya)

closes: vim/vim#17271

dc314053e1

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-05-09 06:48:18 +08:00
zeertzjq
6b955af875 vim-patch:9.1.1373: 'completeopt' checking logic can be simplified
Problem:  Flag checking logic uses a temporary variable and multiple
          bitwise operations in insexpand.c
Solution: Consolidate into a single equality check using bitwise OR and
          comparison (glepnir)

closes: vim/vim#17276

c3fbaa086e

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-09 06:48:18 +08:00
zeertzjq
ab5c15610f vim-patch:partial:9.1.1371: style: indentation and brace issues in insexpand.c
Problem:  style: indentation issue in insexpand.c
Solution: update style (glepnir)

closes: vim/vim#17278

19e1dd6b6a

Co-authored-by: glepnir <glephunter@gmail.com>
2025-05-09 06:48:05 +08:00
Maria José Solano
50c200fcd4 Merge pull request #33850 from MariaSolOs/on-jump
feat(diagnostic): add `on_jump` callback option
2025-05-08 11:42:24 -05:00
Maria José Solano
ee1d389fa6 Merge pull request #33905 from seandewar/doc-color-nil
fix(lsp): nil error in ColorScheme autocmd
2025-05-08 11:41:49 -05:00
luukvbaal
7c43f8e433 fix(messages): messages added to history missing from ext_messages "g<" #33907
Problem:  Messages that are already added to the history are not emitted
          as part of the "g<" msg_history_show event.

Solution: Move clearing the history for temporary messages to before
          adding a message to the history, rather than after emitting
          a message.
2025-05-08 05:50:25 -07:00
Sean Dewar
d976834864 fix(lsp): nil error in ColorScheme autocmd
Problem: nil error possible if a loaded buffer hasn't been drawn in a window:

```vim
lua vim.lsp.document_color.is_enabled() -- Load module
badd foo
call bufload('foo')
colo default
```

Solution: Skip _buf_refresh branch also if bufstates[bufnr] is nil.
2025-05-08 09:28:20 +01:00
zeertzjq
1b8ae4336d test(swapfile): don't check for line with full file path (#33896)
Wrapping can happen anywhere where in the full file path, breaking the
matching. Match a line with the "Xswaptest" line instead.
2025-05-08 07:51:23 +08:00
dependabot[bot]
2f2cba24f9 ci: bump mlugg/setup-zig from 1 to 2
Bumps [mlugg/setup-zig](https://github.com/mlugg/setup-zig) from 1 to 2.
- [Release notes](https://github.com/mlugg/setup-zig/releases)
- [Commits](https://github.com/mlugg/setup-zig/compare/v1...v2)

---
updated-dependencies:
- dependency-name: mlugg/setup-zig
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-07 12:13:10 +00:00
luukvbaal
6dee1672cc fix(extui): "box" window width calculated on last line (#33881)
Problem:  The "box" window width is calculated on the last line when
          applying "last" virt_text. There may be longer lines
          part of the same message.
Solution: Don't decrease box width if the calculated width is smaller.
          Minor unrelated changes.

Co-authored-by: Eike <eike.rackwitz@mail.de>
2025-05-07 10:02:53 +02:00
zeertzjq
27311b0b5c Merge pull request #33879 from zeertzjq/vim-fe22867
vim-patch: runtime file updates
2025-05-07 11:11:03 +08:00
zeertzjq
186851b1bd vim-patch:87947a9: runtime(sh): Update syntax, match KornShell compound arrays
closes: vim/vim#17268

87947a9a76

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-07 09:46:01 +08:00
zeertzjq
d8621a53ac vim-patch:adfeb4a: runtime(spec): add more local macro names according to rpm 4.20
closes: vim/vim#17258

adfeb4ad95

Co-authored-by: fundawang <fundawang@yeah.net>
2025-05-07 09:45:43 +08:00
zeertzjq
45e9054813 vim-patch:fe22867: runtime(sh): Update syntax, fix single-quoted strings in parameter expansions
Ignore single-quoted backslash escape sequences in parameter expansions.

\' is not an escaped single quote in ${foo:-'word\'}.

closes: vim/vim#17261

fe22867ef5

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-07 09:45:34 +08:00
luukvbaal
ac67098998 fix(messages): "list_cmd" kind for mark commands #33874
Problem:  `:marks/jumps/changes` are missing a message kind.

Solution: Assign the "list_cmd" kind to them.
2025-05-06 18:23:38 -07:00
luukvbaal
2aa7948266 fix(treesitter): invalidate conceal_lines cache earlier #33875
Problem:  conceal_lines cache is invalidated in `on_buf`
          which is too late for code calculating text height after a
          buffer change but before a redraw (like `lsp/util.lua`).

Solution: Replace `on_buf` with `on_bytes` handler that invalidates
          the cache and clears the marks.
2025-05-06 18:03:54 -07:00
Phạm Bình An
fb59188b6d vim-patch:0fb6cea: runtime(lua): update 'path' option in filetype plugin #33876
Problem:  Lua doesn't support importing module in path related to current
          file like JS does (https://www.reddit.com/r/lua/comments/wi0bau/whats_the_correct_way_to_run_a_lua_file_that_uses/)
Solution: Remove `.` from Lua buffer-local option `'path'`

closes: vim/vim#17267

0fb6ceac4c
2025-05-06 18:02:06 -07:00
Justin M. Keyes
f5b5f2095e refactor(tests): lint decorations_spec, float_spec, multigrid_spec #33274
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.

Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
2025-05-06 18:00:20 -07:00
Christian Clason
a81d2b6703 docs(luv): replace bundled LuaCATS meta files with upstream
Synced from https://github.com/luvit/luv/blob/master/meta.lua
2025-05-06 18:47:33 +02:00
gcrtnst
8707ec2644 fix(termkey): out-of-bounds write in array #33868
Problem:
termkey crashes due to an out-of-bounds write in an array when it
received a CSI sequence with 17 or more arguments. This could be
observed on startup with certain terminal emulators like [RLogin], which
send a response to the `CSI c` query containing 17 parameters.

The termkey code has a boundary check, but its comparison operator is
incorrect.

Solution:
Correct the comparison operator to ensure proper boundary checking.

With this change, I have confirmed that the crash no longer occurs on
RLogin. https://github.com/kmiya-culti/RLogin

Fixes #24356
2025-05-06 05:20:03 -07:00
Phạm Bình An
db2b774a16 fix(runtime): 'includeexpr' with non-Nvim-style Lua modules #33867
Closes #33862
2025-05-06 05:15:31 -07:00
Maria José Solano
c65817774d feat(diagnostic): add on_jump callback option 2025-05-05 19:59:22 -07:00
Riley Bruins
8d75910ef9 fix(treesitter): eliminate flicker for single windows #33842
This commit will eliminate flicker while editing one open window. It
works by querying previously calculated trees for highlight marks, in
the case that we are still asynchronously parsing in `on_win`.

It will not fully solve the case of flicker when there are multiple open
windows, since the parser will drop previously parsed injection trees
whenever it receives a call to parse a different region of the buffer.
This will require a refactor of `languagetree.lua`.
2025-05-05 19:05:16 -07:00
luukvbaal
9efdd4fe98 fix(extui): drop "more" window that is no longer floating #33861
Problem:  Moving the "more" (or any extui)-window to a split with
          `wincmd L` does not invalidate it as a tracked window.

Solution: Drop an extui window that is no longer floating.
2025-05-05 11:28:02 -07:00
glepnir
1e7406fa38 feat(api): nvim_cmd supports plus ("+cmd", "++opt") flags #30103
Problem:
nvim_cmd does not handle plus flags.

Solution:
In nvim_cmd, parse the flags and set the relevant `ea` fields.
2025-05-05 05:58:36 -07:00
luukvbaal
912388f517 fix(messages): list_cmd kind for buffer line messages (#33855)
Problem:  Missing kind and separate event for each line for message
          containing buffer lines for e.g. `:print`.
Solution: Set the `list_cmd` kind and only `msg_start()` for the first
          message, print a newline instead.
2025-05-05 12:04:09 +00:00
bfredl
2d75ea6afe Merge pull request #33753 from bfredl/hotgrid
fix(grid): don't scroll on an invalid grid
2025-05-05 11:20:13 +02:00
bfredl
1ad9cdd403 fix(grid): check allocated grid size when suspicious scrolling
fixes #33749
2025-05-05 10:50:18 +02:00
Justin M. Keyes
40351bbbbe fix(lua): vim.validate message param #33675
Problem:
vim.validate does not handle `message` param.

Solution:
Add the missing logic.
2025-05-04 16:36:32 -07:00
Eike
0862c1036a fix(lsp): check if client is stopping before reuse #33796
Problem:
Stopping a language server and then calling vim.lsp.start() with the same name/root will return the old language server that's in the middle of shutting down. vim.lsp.start() won't return a new server until the old process has terminated.

Solution:
Introducing a client._is_stopping field that tracks the shutdown phase, preventing the client from being reused.
2025-05-04 14:38:01 -07:00
Maria José Solano
df345503eb refactor(lua): swap value params in tbl_extend behavior callback #33847 2025-05-04 14:28:03 -07:00
bfredl
0402f5a76b Merge pull request #33848 from psnszsn/master
fix(build): musl libc build.zig
2025-05-04 23:21:37 +02:00
Vlad Panazan
3268f51d20 fix(build): musl libc build.zig 2025-05-04 22:55:19 +02:00
luukvbaal
d4ecfc4234 fix(extui): message may overwrite active cmdline #33846
Problem:  Active cmdline may be overwritten by a message.

Solution: Check if cmdline is active before writing message.
2025-05-04 20:02:02 +00:00
bfredl
ba2a5a7787 Merge pull request #33837 from bfredl/cmakeversion
fix(build): use correct cmake expression for $<CONFIG>

fixes #33835
2025-05-04 19:35:07 +02:00
Justin M. Keyes
72ec410134 Merge #33789 cleanup error messages 2025-05-04 08:53:29 -07:00
Justin M. Keyes
fc2dee1736 feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't
say "Error ...".
2025-05-04 11:22:57 -04:00
Justin M. Keyes
af4f7f1618 test: multiline assert_log()
Problem:
assert_log() only matches single lines. This was never an intentional
decision, it was merely a result of using read_file_list().

Note: any tests that indiscriminately match `.*` should be rewritten to
avoid (unlikely) "false positives". I checked all existing tests.

Solution:
Change assert_log() to match the concatenated lines instead of matching
per-line.
2025-05-04 10:35:07 -04:00
Maria José Solano
8f5bd569c5 feat(lsp): support documentColor dynamic registration #33800 2025-05-04 07:00:21 -07:00
glepnir
5c15df449a fix(lsp): improve error completion message #33812
problem: Error notifications from LSP responses were difficult to read due to
inconsistent formatting and missing critical information like client name and error codes.

solution: Implemented a more structured error notification format using pipe separators to
clearly display client name, error code (when available), and error message.
2025-05-04 06:40:35 -07:00
glepnir
91e116f3a6 fix(lsp): only auto-detach lsp.config clients #33834
Problem:
enable() routine detaches clients even if they were manually started
and not managed by vim.lsp.config.

Solution:
Skip clients that aren't managed by vim.lsp.config.
2025-05-04 06:07:11 -07:00
Shougo
cb2ca54331 fix(display): cursor moves when searching with "n", "*" #29446
Problem:
When searching for the next pattern via n/N/*/#, cursor
moves to cmdline, perceived as "flicker".

Solution:
Can ui_busy_start() and ui_busy_stop().
2025-05-04 05:53:25 -07:00
luukvbaal
f1295fe76f fix(extui): hide inactive "more" window (#33831)
Problem:  More-window is left visible after leaving it. Cursor may be
          hidden behind it and it is hard to re-enter afterwards.
Solution: Close the more-window when another window is entered.
2025-05-04 13:39:07 +02:00
bfredl
921f8b0df7 fix(build): use correct cmake expression for $<CONFIG>
${CONFIG} is an empty string even when configuration is known at
configuration time. $<CONFIG> has to be used at "generation time"

Currently zig's reimplementation of cmake config headers does not
support $<CONFIG> so use a branch to pick the one which works.
2025-05-04 09:49:10 +02:00
Sean Dewar
627c648252 vim-patch:9.1.1361: [security]: possible use-after-free when closing a buffer (#33820)
Problem:  [security]: Possible to open more windows into a closing
          buffer without splitting, bypassing existing "b_locked_split"
          checks and triggering use-after-free
Solution: Disallow switching to a closing buffer. Editing a closing
          buffer (via ":edit", etc.) was fixed in v9.1.0764, but add an
          error message and check just "b_locked_split", as "b_locked"
          is necessary only when the buffer shouldn't be wiped, and may
          be set for buffers that are in-use but not actually closing.
          (Sean Dewar)

closes: vim/vim#17246

6cb1c82840
2025-05-04 03:15:51 +01:00
Phạm Bình An
2c1f5a6aa5 docs: default mappings #33706
Problem:
Docs don't mention that `gc` is just a mapping, not
a builtin normal-mode command.

Solution:
Update docs for all "default mappings".
2025-05-03 15:47:59 -07:00
luukvbaal
9274532615 fix(treesitter): invalidate conceal_lines marks #33828
Problem:  Spliced conceal_lines marks after changing the buffer text are
          left valid, concealing lines that shouldn't be.

Solution: Set the `invalidate` extmark property.
2025-05-03 22:37:02 +00:00
Jeremy Fleischman
b877aa34cf feat(lsp): detach LSP clients when 'filetype' changes #33707
Problem:
When the buffer 'filetype' changes, invalid or non-applicable LSP
clients are not detached.

https://github.com/neovim/neovim/issues/33443
https://github.com/neovim/nvim-lspconfig/issues/3326

Solution:
In the enable() routine, check can_start() on _existing_ clients.
2025-05-03 14:57:59 -07:00
Maria José Solano
047a10bfde feat(lua): function behavior for tbl_extend, tbl_deep_extend #33819 2025-05-03 14:53:44 -07:00
luukvbaal
8305af9bd2 fix(statusline): clear ruler when it is no longer drawn #33765
Problem:  Ruler is not cleared from the screen/ext_messages state when
          it is no longer drawn after e.g. `set noruler` or when moving
          from a floating to a regular window.
Solution: Remember if ruler was drawn and clear it.
2025-05-03 14:24:11 -07:00
luukvbaal
6256adde2f fix(quickfix): always split from current window #33807
Problem:  `:copen` opens at the bottom by switching to `lastwin`,
           needlessly changing the window it inherits context from.

Solution:  Use the `WSP_BOT` flag to `win_split()` to open at the bottom.
2025-05-03 13:38:20 -07:00
luukvbaal
b2a5105c66 fix(extui): search highlighting in extui "more" pager #33792
Problem:  No search highlighting in extui "more" pager window.
Solution: Only use custom highlight namespace in cmdline window.
2025-05-03 12:30:08 -07:00
joe
d0867574bd refactor(tui): redundant input->in_fd assignment #33756
Problem:
`input->in_fd = STDIN_FILENO;` was set twice during TUI initialization.

Solution:
Remove the duplicate assignment for clarity and better performance
2025-05-03 11:37:14 -07:00
PRIZ ;]
902b689c4d docs(lua): typing for vim.fn.winlayout #33817
Problem:
`any[]` means nothing, and the return value is not the same as what's
documented in the comment (eg, Lua returns `{ "row", { { "leaf", 1000 },
{ "leaf", 1001 } } }`, not `{ "row", { "leaf", 1000, "leaf", 1001 } }`)

Solution:
Create two classes (vim.fn.winlayout.leaf and vim.fn.winlayout.branch)
and one alias that links the two together.

Also: Due to LuaLS limitations, there is an empty class,
vim.fn.winlayout.empty

Signed-Off-By: VoxelPrismatic <voxelprismatic@pm.me>
2025-05-03 11:34:25 -07:00
Sean Dewar
403fcacfc1 fix(window): skip unfocusable and hidden floats with "{count}<C-W>w" #33810
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.

Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
2025-05-03 11:30:24 -07:00
Jeremy Fleischman
03d378fda6 feat(lsp): vim.lsp.is_enabled() #33703
Problem:
No way to check if a LSP config is enabled without causing it to
resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config,
which could be an unwanted and somewhat expensive side-effect.

Solution:
Introduce `vim.lsp.is_enabled()`.
2025-05-03 10:25:58 -07:00
Christian Clason
2e35161fa1 docs: treesitter parse errors #33811 2025-05-03 10:08:53 -07:00
Sean Dewar
94bc7f47bf docs: fixups (#33815)
- Add missing diagnostics virtual lines hl groups.
- Fix LSP dynamic registration example; curbuf may not actually be attached to
  the client, and it may be attached to many such buffers.
2025-05-03 16:45:32 +01:00
Michele Campeotto
f048298e9a fix(runtime): conceal paths in help, man ToC loclist #33764
Problem:
The check for concealing paths in TOCs in the qf syntax file fails
because the TOC tile has changed.

Solution:
Force the qf syntax file to be reloaded after the qf_toc variable
has been set, so that the it can apply the correct settings.

Using the explicit qf_toc key, already used in the syntax file, instead
of the title is less prone to breaking.

It was also already being set for man pages but it had no effect because
the syntax file had already been loaded when the variable was set.

Fixes #33733
2025-05-03 07:06:22 -07:00
Christian Clason
6b233cd1a1 build(deps): bump tree-sitter-vim to v0.6.0 2025-05-03 11:29:34 +02:00
Riley Bruins
5d1fd4aca5 fix(lsp): improper diagnostic end_col computation
**Problem:** For multiline diagnostics, the end column was improperly
calculated by checking the byte index of the character position on the
*start* line.

**Solution:** Calculate the byte index for end_col using the *end* line.
2025-05-03 10:01:20 +02:00
zeertzjq
adbd33027f fix(tui): don't try to add unsupported modifiers (#33799)
Problem:  The TUI doesn't forward a key properly when it has unsupported
          modifiers like NumLock.
Solution: Don't try to add modifiers when only unsupported modifiers are
          present.

Related #33791
2025-05-03 12:09:28 +08:00
zeertzjq
862e676efc docs: add missing change to getcharstr() signature (#33797) 2025-05-03 08:10:13 +08:00
Christian Clason
5a2edc483d fix(treesitter): close :InspectTree with q
Problem: `:InspectTree` window does not follow precedent for focused
"info windows" (like `checkhealth`, `Man`, etc.).

Solution: Map `q` to `<C-w>c`.
2025-05-02 21:39:11 +02:00
Maria José Solano
34c769dd89 fix(lsp): use bufnr when getting clients in symbols_to_items (#33760) 2025-05-02 14:30:02 -05:00
luukvbaal
39a5b7f239 fix(extui): cmdline visibility, cmdheight cursor position (#33774)
Problem:  The cmdline popupmenu is hidden behind extui windows.
          'showmode' message is drawn over the cmdline.
          Changing the 'cmdheight' to accommodate space for the text in
          the cmdline may change the current cursor position.
Solution: Ensure kZIndexMessages < zindex < kZIndexCmdlinePopupMenu.
          Clear the 'showmode' message when the cmdline level is negative.
          Temporarily set 'splitkeep' = "screen" when changing the 'cmdheight'.
2025-05-02 19:46:30 +02:00
Christian Clason
c916bdf329 fix(extui): close message window with q
Problem: Using `<c-c>` does not follow precedent (from `checkhealth`
etc.) for closing "information windows".

Solution: Use `q` for close mapping.
2025-05-02 19:09:56 +02:00
Christian Clason
8d6f016345 vim-patch:c3f48e3: runtime(abnf): include ABNF filetype plugin
closes: vim/vim#17239

c3f48e3a76

Co-authored-by: A4-Tacks <wdsjxhno1001@163.com>
2025-05-02 17:12:18 +02:00
zeertzjq
53b41ec7c2 Merge pull request #33776 from zeertzjq/vim-9.1.1359
vim-patch:9.1.{1359,1360}
2025-05-02 22:17:01 +08:00
zeertzjq
da3eeb4b32 vim-patch:9.1.1360: filetype: GNU Radio companion files are not recognized
Problem:  filetype: GNU Radio companion files are not recognized
Solution: detect *.grc files as xml or yaml filetype depending on the
          first line (zeertzjq).

Ref:
- https://wiki.gnuradio.org/index.php/XML_GRC
- https://wiki.gnuradio.org/index.php/YAML_GRC

closes: vim/vim#17241

af4a5d6e2a
2025-05-02 21:53:18 +08:00
zeertzjq
074a6abd55 vim-patch:9.1.1359: filetype: GNU Radio config files are not recognized
Problem:  filetype: GNU Radio config files are not recognized.
Solution: detect GNU Radio config files as confini filetype.  Only
          allow '#' as start of comment in confini syntax (zeertzjq).

Ref:
- https://wiki.gnuradio.org/index.php/Configuration_Files

closes: vim/vim#17242

9c9200d1ea
2025-05-02 21:53:15 +08:00
Sathya Pramodh
0741d2520d feat(messages): hl-StderrMsg, hl-StdoutMsg #33429
Problem:
stderr messages from executing ":!cmd" show up with
highlight hl-ErrorMsg. But some shell utilites use stderr for debug
logging, progress updates, etc.

Solution:
Highlight shell command outputs hl-StderrMsg and hl-StdoutMsg.
2025-05-02 06:06:55 -07:00
luukvbaal
3c7c824bdc fix(extui): check option values after VimEnter (#33768)
Problem:  Not picking up configured option values when enabling _extui after startup.
Solution:  Check option values when enabing _extui.

Fix https://github.com/neovim/neovim/issues/33767
2025-05-02 13:13:12 +02:00
zeertzjq
4b5364b423 fix(tui): forward C0 control codes literally (#33759)
This fixes the problem that sending a raw C0 control code to trigger a
mapping for it does not work in Terminal mode.

Note: this isn't done for 00 or 7F, as that'll be backward-incompatible.
2025-05-02 17:40:24 +08:00
Phạm Bình An
1fb0126a08 fix(vim.lsp.enable): don't eagerly enable LSP configs during startup #33762
closes #33761
2025-05-02 02:05:18 -07:00
luukvbaal
2c1c0b7af5 feat(ui): ext_cmdline/messages for the TUI #27855
Problem:  We have an unmaintained Vimscript parser and cmdline
highlighting mechanism, with which it is hard to leverage the
treesitter highlighter. Long messages result in a hit-enter-prompt.

Solution: Implement a vim.ui_attach() UI, that replaces the message
grid (orphaning some 3000+ LOC core C code). Introduce an experimental
vim._extui module, because removing the message grid at the same time is
too risky. The new UI leverages the bundled treesitter highlighter and
parser for Vimscript, as well as the matchparen plugin, to highlight the
cmdline. Messages are truncated in the cmdline area, or placed in a
floating message box in the bottom right corner. Special ("list_cmd")
messages and the message history are shown in a, "more prompt" (now a
fully interactive regular window). Various default UI elements ('showcmd',
'ruler') are also placed in the cmdline area, as virtual text.

`require('vim._extui').enable({})` enables the experimental UI.
`{ msg.pos = 'box' }` or `:set cmdheight=0` enables the message
box variant.

Followup:
  - Come to a consensus for how best to represent messages (by default).
  - Start removing message grid when this is deemed a successful replacement.
    When that is finished, make this new UI the default and update a lot of tests.
2025-05-02 02:02:02 -07:00
bfredl
da401ca25b Merge pull request #28344 from bfredl/wonderland
feat(build): build.zig MVP: build and run functionaltests on linux
2025-05-02 10:34:25 +02:00
bfredl
1f004970f0 feat(build): build.zig MVP: build and run functionaltests on linux
NEW BUILD SYSTEM!

This is a MVP implementation which supports building the "nvim" binary,
including cross-compilation for some targets.
As an example, you can build a aarch64-macos binary from
an x86-64-linux-gnu host, or vice versa

Add CI target for build.zig currently for functionaltests on linux
x86_64 only

Follow up items:

-  praxis for version and dependency bumping
-  windows 💀
-  full integration of libintl and gettext (or a desicion not to)
-  update help and API metadata files
-  installation into a $PREFIX
-  more tests and linters
2025-05-02 09:28:50 +02:00
zeertzjq
ce8b755a86 vim-patch:1c58019: runtime(vim): Update base-syntax, improve enum highlighting (#33758)
Match enum values and missing class keywords.

fixes: vim/vim#15970

1c58019a82

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-02 07:26:38 +08:00
zeertzjq
dd71a21463 vim-patch:f57c065: runtime(sh): Update syntax, highlight escaped chars in test expressions (#33757)
Highlight escape characters in unquoted test expression operands.

E.g., [[ foo == \[bar\] ]]

fixes vim/vim#17221

f57c065e75

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-02 07:25:58 +08:00
brianhuster
0b3c76502c vim-patch:83cb817: runtime(doc): update example ctags program and links
- :helptags is also a tags generating program, it deserves mentioning
- JTags seems too dead: its website has been sold, the source, binary
  can't be found anywhere.
- update link of ptags

closes: vim/vim#17233

83cb8174c8

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2025-05-02 07:05:22 +08:00
brianhuster
65a4c8f3ca vim-patch:9.1.1357: Vim incorrectly escapes tags with "[" in a help buffer
Problem:  Vim incorrectly escapes tags containing "[" in a help buffer
Solution: check if the buffer has the "help" filetype set, instead of
          already being a help buffer (Phạm Bình An)

fixes: vim/vim#17224
closes: vim/vim#17232

6af20a9be3

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-05-02 07:05:22 +08:00
Maria José Solano
abc96ba0ce fix(lsp): handle nil buffer state in documentColor clear (#33746) 2025-05-01 18:15:32 +01:00
Gregory Anders
d1fed989f2 refactor: move StringBuilder to types_defs.h (#33745) 2025-05-01 10:06:08 -05:00
Michael Clayton
d567f899ef fix(diagnostic): allow virtual_{lines,text} cursor exclusivity #33517
Problem:
virtual_text diagnostics are great when skimming a file, and
virtual_lines are great when "zooming in" on a particular problem.
Having both enabled results in duplicate diagnostics on-screen.

Solution:
This PR expands the behavior of `current_line` for virtual_text and
virtual_lines by making `virtual_text.current_line = false` distinct
from `nil`.  If you set:

    vim.diagnostic.config({
      virtual_text = { current_line = false },
      virtual_lines = { current_line = true },
    })

With this configuration, virtual_text will be used to display
diagnostics until the cursor reaches the same line, at which point they
will be hidden and virtual_lines will take its place.
2025-05-01 03:54:39 -07:00
luukvbaal
97a6259442 fix(display): adjust setting winline info for concealed lines (#33717)
Problem:  Wrong winline info after partial redraw. Setting
          `conceal_cursor_used` is unnecessarily spread out.
Solution: Rather than adjusting `wl_lastlnum` for the previous
          winline, adjust it when setting the current winline.
          Set `conceal_cursor_used` when the current window is redrawn.
2025-05-01 09:51:51 +02:00
zeertzjq
edc8e9f40a Merge pull request #33738 from zeertzjq/vim-fa8b7db
vim-patch: doc updates
2025-05-01 08:07:14 +08:00
Jeremy Fleischman
4bc7bac884 feat(lsp): start/stop LSPs as necessary during vim.lsp.enable() #33702
Problem:
enable() could be more flexible, so that it works even if called "late".

Solution:
- enable(true) calls `doautoall nvim.lsp.enable FileType`.
- enable(false) calls `client:stop()` on matching clients.

This will be useful for e.g. :LspStop/:LspStart also.
2025-04-30 16:57:29 -07:00
zeertzjq
fae4abd2f4 vim-patch:ff3d4b2: runtime(doc): document that :b cannot handle buffer names starting with "+"
closes: vim/vim#17229

ff3d4b2d49

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-01 07:45:31 +08:00
zeertzjq
b38525f65c vim-patch:fb08192: runtime(doc): clarify the use of 'tagfunc', update a comment in tags.c
related: vim/vim#17228

fb08192ca7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-05-01 07:45:01 +08:00
zeertzjq
ad48cccaa8 vim-patch:partial:fa8b7db: runtime(doc): tweak documentation style in options.txt
closes: vim/vim#17229

fa8b7db99a

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-05-01 07:42:41 +08:00
Gregory Anders
71f3a9c590 feat(terminal): parse current buffer contents in nvim_open_term() (#33720)
When nvim_open_term() is called with a non-empty buffer, the buffer
contents are piped into the PTY.
2025-04-30 21:34:23 +00:00
Lorenzo Bellina
6577d72d81 feat(lsp): root_markers can control priority #33485
Problem:
root_markers cannot specify "equal priority filenames.

Solution:
Support nesting:

    {
      ...
      root_markers = { { ".stylua.toml", ".luarc.json" }, { ".git "} }
      ...
    }


Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: Gregory Anders <github@gpanders.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-04-30 06:43:32 -07:00
bfredl
f27fb737ce Merge pull request #33727 from bfredl/bordergrid
fix(ui): correct condition for "wrap" flag in a floating grid
2025-04-30 13:56:32 +02:00
luukvbaal
0015a105ca fix(cmdline): do not move UI cursor when entering cmdline #33729
Problem:  Cursor is still moved to curwin when entering cmdline (after d41b8d47).

Solution: Remove call to `setcursor()`.
2025-04-30 04:51:14 -07:00
Jeremy Fleischman
272dba7f07 fix(trust): support for trusting directories #33617
Problem:
Directories that are "trusted" by `vim.secure.read()`, are not detectable later
(they will prompt again). https://github.com/neovim/neovim/discussions/33587#discussioncomment-12925887

Solution:
`vim.secure.read()` returns `true` if the user trusts a directory.

Also fix other bugs:

- If `f:read('*a')` returns `nil`, we treat that as a successful read of
  the file, and hash it. `f:read` returns `nil` for directories, but
  it's also documented as returning `nil` "if it cannot read data with the
  specified format". I reworked the implementation so we explicitly
  treat directories differently. Rather than hashing `nil` to put in the
  trust database, we now put "directory" in there explicitly*.
- `vim.secure.trust` (used by `:trust`) didn't actually work for
  directories, as it would blindly read the contents of a netrw buffer
  and hash it. Now it uses the same codepath as `vim.secure.read`, and
  as a result, works correctly for directories.
2025-04-30 04:20:39 -07:00
bfredl
f02484118c fix(ui): correct condition for "wrap" flag in a floating grid
In a floating window grid, "wrap" flag should not
be set when vertical borders are used, as the the wrapped
text will be broken up by border chars.

fixes #33719
2025-04-30 12:29:03 +02:00
zeertzjq
0ab0cdb2da vim-patch:910bfd5: runtime(java): Consent to HTML tags folding in Javadoc comments (#33718)
HTML tags in Javadoc comments can additionally be folded
after applying
------------------------------------------------------------
	let g:html_syntax_folding = 1
	set foldmethod=syntax
------------------------------------------------------------

and giving explicit consent with
------------------------------------------------------------
	let g:java_consent_to_html_syntax_folding = 1
------------------------------------------------------------

Do not default to this kind of folding unless ALL start tags
and optional end tags are balanced in Javadoc comments;
otherwise, put up with creating runaway folds that break
syntax highlighting.

resolves: zzzyxwvut/java-vim#8.
closes: vim/vim#17216

910bfd5d38

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-04-30 06:29:10 +08:00
Gregory Anders
99e754ae02 fix(terminal): remove condition that buf is curbuf (#33721) 2025-04-29 21:35:27 +00:00
luukvbaal
08c484f2ca feat(ui): use builtin completion popupmenu with ext_cmdline (#31269)
Problem:  UIs implementing ext_cmdline/message must also implement
          ext_popupmenu in order to get cmdline completion with
          wildoptions+=pum.
Solution: Allow marking a window as the ext_cmdline window through
          nvim_open_win(), including prompt offset. Anchor the cmdline-
          completion popupmenu to this window.
2025-04-29 15:55:00 +02:00
luukvbaal
9bbbeb60e3 feat(ui): no delay for errors with ext_messages (#33693)
Problem:  Delay for reading a message may be unwanted for ext_messages,
          and can be done by the implementation. Empty completion source
          error message is not distinguishable as such.
Solution: Only delay without ext_messages enabled. Emit empty completion
          source message as an error.
2025-04-29 15:45:40 +02:00
zeertzjq
c35dde03c8 fix(tui): don't process UI events when suspending or stopping (#33710)
When the TUI is suspending or stopping, redraw events should not be
processed, as when it next processes redraw events it's already waiting
for a DA1 response after having disabled some terminal modes.

Fix #33708
2025-04-29 09:37:54 +00:00
zeertzjq
ffb93d9883 Merge pull request #33667 from glepnir/vim-9.1.1341
vim-patch: 9.1.{1341,1344}
2025-04-29 14:59:32 +08:00
glepnir
e7e665b489 vim-patch:ffc89e4 runtime(doc): clarify complete_match() and 'isexpand' option
clarify complete_match() documentation to better explain its backward
search behavior, argument handling, and return value format and add an
example of isexpand

closes: https://github.com/vim/vim/pull/17212

ffc89e47d0
2025-04-29 14:11:55 +08:00
zeertzjq
c489b5a3e3 test(lua/secure_spec): avoid magic number (#33700)
Avoid magic number in skipping condition by moving the expected message
to a variable.
2025-04-29 01:44:54 +00:00
zeertzjq
7692a62b75 Merge pull request #33698 from zeertzjq/vim-9.1.1349
vim-patch:9.1.{1349,1350,1351,1353}
2025-04-29 07:48:18 +08:00
zeertzjq
d107375f0c vim-patch:9.1.1353: missing change from v9.1.1350
Problem:  missing change from v9.1.1350
Solution: update the test Test_CmdlineTrigger() (Girish Palya)

related: vim/vim#17217

612f63bf81

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-29 07:15:22 +08:00
zeertzjq
afcc4e95d5 vim-patch:9.1.1351: Return value of getcmdline() inconsistent in CmdlineLeavePre
Problem:  Return value of getcmdline() inconsistent in CmdlineLeavePre
          when leaving cmdline in different ways (after v9.1.1329).
Solution: Trigger CmdlineLeavePre before calling abandon_cmdline() so
          that getcmdline() can return the command line (zeertzjq).

closes: vim/vim#17218

9240369774
2025-04-29 07:15:22 +08:00
zeertzjq
c64cada12e vim-patch:9.1.1350: tests: typo in Test_CmdlineLeavePre_cabbr()
Problem:  tests: typo in Test_CmdlineLeavePre_cabbr()
          (after v9.1.1349)
Solution: fix typo, disable failing test on Windows for now
          (Girish Palya)

closes: vim/vim#17217

6220bbad4e

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-29 07:15:22 +08:00
zeertzjq
d75410b091 vim-patch:9.1.1349: CmdlineLeavePre may trigger twice
Problem:  CmdlineLeavePre may trigger twice
          (after v9.1.1329)
Solution: check that the key was typed, trigger it when it wasn't before
          (Girish Palya)

There are two problems:
- CmdlineLeavePre may be triggered twice when a cabbr is present.
- CmdlineLeavePre fails to trigger when exiting the command-line via
  <Backspace>.

Check if the Carriage Return (Enter) key was actually typed.
Trigger the event when the command-line is exited using Backspace and
other keys.

closes: vim/vim#17214

46755e6b52

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-29 07:15:21 +08:00
bfredl
43f3c4a48f Merge pull request #33481 from bfredl/gridview
refactor(ui): separate types for allocated grids and viewports
2025-04-28 12:07:54 +02:00
bfredl
bd413a2f55 refactor(ui): separate types for allocated grids and viewports 2025-04-28 10:10:11 +02:00
zeertzjq
317a897c46 vim-patch:b9ffbf5: runtime(vim): Update base-syntax, fix inline Vim9 dict comments at SOL (#33686)
Match Vim9 comments at start-of-line (no leading whitespace) in
dictionaries, lists and parenthesised expressions and argument lists.

Addresses https://github.com/vim/vim/pull/14975#issuecomment-2832643115

Report and fix by Aliaksei Budavei.

closes: vim/vim#17211

b9ffbf57f8

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-28 08:14:42 +08:00
Justin M. Keyes
ce097c5091 Merge #33542 shada improvements
* feat(shada): don't store jumplist if '0 in 'shada'
* fix(shada): don't store search and sub patterns if /0 in 'shada'
* fix(shada): don't store empty replacement string
* fix(shada): don't add '0' mark if f0 in 'shada'
2025-04-27 16:15:30 -07:00
Justin M. Keyes
07a207a5f1 Revert "fix(desktop): cannot open filename with spaces using OS file manager" #33684
This reverts commit 6e12ef4a7b

> Paths with spaces were already working. The original bug is most
> likely with user's terminal desktop entry, file manager or DE, and has
> nothing to do with nvim.desktop.

These are 3 different implementations that work correctly with unquoted %F and spaces:
```
$ DE=generic xdg-open "D I R/F I L E.txt" # pure bash
$ gio open "D I R/F I L E.txt" # glib2
$ handlr open "D I R/F I L E.txt" # rust
```
2025-04-27 15:49:00 -07:00
Justin M. Keyes
644c618825 docs: lsp, lua #33682
- sort fields alphabetically.
- in the `vim.lsp.Client` docs, reference `vim.lsp.ClientConfig` instead
  of duplicating its docs.
- cleanup lots of redundant-yet-drifted field docs.
2025-04-27 15:44:11 -07:00
Andre Toerien
36dbd2686f fix(shada): don't add '0' mark if f0 in 'shada' 2025-04-27 23:03:32 +02:00
Andre Toerien
1f503ac7c0 fix(shada): don't store empty replacement string 2025-04-27 23:03:30 +02:00
Justin M. Keyes
52a4bc4548 docs: lsp, emoji, startup #33446
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2025-04-27 13:40:46 -07:00
Andre Toerien
a6591950f6 fix(shada): don't store search and sub patterns if /0 in 'shada' 2025-04-27 22:14:10 +02:00
Andre Toerien
71455173b4 feat(shada): don't store jumplist if '0 in 'shada' 2025-04-27 22:14:09 +02:00
Maria José Solano
82b844fefe fix(lsp): fallback to empty capability_path in supports_registration 2025-04-27 18:49:50 +01:00
Maria José Solano
181df60533 fix(lsp): remove unused ns field 2025-04-27 18:49:50 +01:00
Justin M. Keyes
63323a9c81 feat(checkhealth): trigger FileType event after showing report #33677
Problem:
`FileType` event is fired before checkhealth report is finished, so
user can't override report settings or contents.
https://github.com/neovim/neovim/pull/33172#issuecomment-2833513916

Solution:
- Trigger FileType event later.
- Document how to remove emojis.
2025-04-27 10:32:25 -07:00
Maria José Solano
b98aefc584 fix(lsp): properly handle documentColor from multiple servers #33656 2025-04-27 16:58:10 +00:00
Justin M. Keyes
ef16a02a76 test: feed_command is deprecated #33674 2025-04-27 09:46:53 -07:00
Maria José Solano
e991133058 fix: remove unnecessary nvim -l from gen command #33676 2025-04-27 09:46:19 -07:00
Phạm Bình An
86b34ad073 docs: provide example_init.lua #33524
Problem:
There are some "boilerplate" steps for new users. Although we are
constantly improving defaults and lifting patterns into core, users
eventually want to know how to start their own config, add plugins, etc.

Solution:
Add `runtime/example_init.lua` and refer to it from docs.
2025-04-27 08:11:02 -07:00
zeertzjq
a167800f1c vim-patch:partial:fbe4a8f: runtime(doc): Fix notation of "Vim script" and "Vim9 script" (#33673)
closes: vim/vim#17213

fbe4a8f5c0

Cherry-pick Test_source_ignore_shebang() change from patch 9.0.0363.

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-27 22:06:16 +08:00
Phạm Bình An
923efaea28 fix(runtime): cpoptions is reset in Lua file #33671
closes #33670
2025-04-27 04:55:15 -07:00
Justin M. Keyes
c2fc867843 Merge #33660 from MariaSolOs/supports-dynamic 2025-04-27 04:34:05 -07:00
glepnir
31e31273bc vim-patch:9.1.1344: double free in f_complete_match() (after v9.1.1341)
Problem:  double free in f_complete_match() (after v9.1.1341)
Solution: remove additional free of trig pointer, correctly free
          regmatch.regprog and before_cursor in the error case

closes: https://github.com/vim/vim/pull/17203

3accf046ec

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-27 15:57:11 +08:00
glepnir
fcabbc2283 vim-patch:9.1.1341: cannot define completion triggers
Problem:  Cannot define completion triggers and act upon it
Solution: add the new option 'isexpand' and add the complete_match()
          function to return the completion matches according to the
          'isexpand' setting (glepnir)

Currently, completion trigger position is determined solely by the
'iskeyword' pattern (\k\+$), which causes issues when users need
different completion behaviors - such as triggering after '/' for
comments or '.' for methods. Modifying 'iskeyword' to include these
characters has undesirable side effects on other Vim functionality that
relies on keyword definitions.

Introduce a new buffer-local option 'isexpand' that allows specifying
different completion triggers and add the complete_match() function that
finds the appropriate start column for completion based on these
triggers, scanning backwards from cursor position.

This separation of concerns allows customized completion behavior
without affecting iskeyword-dependent features. The option's
buffer-local nature enables per-filetype completion triggers.

closes: vim/vim#16716

bcd5995b40

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-27 15:00:31 +08:00
Maria José Solano
d6fffe6b32 fix(lsp): access correct client capability path in supports_registration 2025-04-26 18:40:55 -07:00
Maria José Solano
66339e0641 feat(lsp): generate method to client capability map 2025-04-26 18:24:39 -07:00
zeertzjq
c1d21492a6 vim-patch:c29b533: runtime(vim): Update base-syntax, match continued strings and tail comments (#33659)
Continued strings are currently only matched after operators, in
parenthesised expressions and in function call argument lists.

closes: vim/vim#14975

c29b533cf1

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-27 01:17:39 +00:00
zeertzjq
2c3488c52e vim-patch:c5cb6b2: runtime(doc): tagfunc should refer to 'complete' option (#33658)
fixes: vim/vim#17205

c5cb6b2ee4

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-27 01:06:08 +00:00
fredizzimo
1999c4cdc1 fix: screenchar()/screenstring() with multigrid #32494
Problem:
- When multigrid is enabled, screenchar()/screenstring() functions return wrong
  results. See https://github.com/neovide/neovide/issues/2569
- `screenstring()` executed via RPC in child Nvim process, doesn't recognize
  floating windows.

Solution:
In ui_comp_get_grid_at_coord(), also iterate window grids.
2025-04-26 13:39:12 -07:00
Justin M. Keyes
dd18ab1691 test: drop redundant clear() #33654
followup to #33647 after overlapping merge
2025-04-26 09:42:13 -07:00
Justin M. Keyes
e7410048fa test: drop redundant clear() #33647
Problem:
Tests call `clear()` even though `clear_notrace()` is already called in
a `before_each()` handler, wasting precious milliseconds!

Solution:
Remove redundant `clear()` calls.
2025-04-26 09:39:32 -07:00
Andre Toerien
d927a87ed6 fix(health): checkhealth float opens extra empty buffer #33648 2025-04-26 09:10:06 -07:00
Yi Ming
f486f1742e perf(lsp): include previousResultId in DocumentDiagnosticParams #32887
Problem:
Users of the Roslyn (C#) LSP have encountered significant delays when
retrieving pull diagnostics in large documents while using Neovim. For
instance, diagnostics in a 2000-line .cs file can take over 20 seconds
to display after edits in Neovim, whereas in VS Code, diagnostics for
the same file are displayed almost instantly.

As [mparq noted](https://github.com/seblj/roslyn.nvim/issues/93#issuecomment-2508940330)
in https://github.com/seblj/roslyn.nvim/issues/93, VS Code leverages
additional parameters specified in the [LSP documentation for
textDocument/diagnostic](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentDiagnosticParams),
specifically:

- previousResultId
- identifier

Solution:
When requesting diagnostics, Neovim should include the
`previousResultId` and `identifier` parameters as part of the request.
These parameters enable the server to utilize caching and return
incremental results.

Support for maintaining state is already present in the
[textDocument/semanticTokens implementation](8f84167c30/runtime/lua/vim/lsp/semantic_tokens.lua (L289)).
A similar mechanism can be implemented in `textDocument/diagnostic` handler.
2025-04-26 09:09:20 -07:00
Bartłomiej Maryńczak
8315697449 fix(lsp): detect if Client:request resolved synchronously #33624
Problem:
In cases when the (in-process) LSP server responds to the request
immediately and calls `notify_reply_callback` the request will still be
marked as pending, because the code assumes that the response will occur
asynchronously. Then the request will be pending forever, because it was
already set as "completed" before we even set it as "pending".

A workaround is to wrap `notify_replay_callback` in `vim.shedule` ([like
so](https://github.com/neovim/neovim/pull/24338#issuecomment-2809568617)]
but that seems counterintuitive.

Solution:
Handle this case in Client:request().
2025-04-26 07:08:03 -07:00
Justin M. Keyes
e45ec5a852 Merge #33642 from ofseed/lsp-fix-signature 2025-04-26 06:30:23 -07:00
Christian Clason
e324ab2b6b vim-patch:35cfc3d: runtime(debversions): Add questing (25.10) as Ubuntu release name
closes: vim/vim#17201

35cfc3d3c4

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-04-26 10:43:12 +02:00
Yi Ming
342974773c fix(lsp): cycling signatures with the default config.focusable 2025-04-26 16:12:25 +08:00
Yi Ming
9e93bfdb5f fix(lsp): prioritize showing active signature 2025-04-26 15:44:30 +08:00
zeertzjq
8090dcf494 test(pum): check RightRelease in outside pum with winbar (#33640) 2025-04-26 09:44:21 +08:00
zeertzjq
766cd01ff2 vim-patch:9.1.1346: missing out-of-memory check in textformat.c (#33639)
Problem:  missing out-of-memory check in textformat.c
Solution: add out-of-memory check, add small optimizations to
          internal_format() and same_leader() (John Marriott)

closes: vim/vim#17200

c25368ba14

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-04-26 07:42:24 +08:00
Luuk van Baal
d01b2611a6 fix(ui): exclude unfocusable windows from 'complete' "w" completion
Problem:  As in f85bc41, assume unfocusable windows to be UI windows
          whose buffer content is unexpectedly included in 'complete'
          "w" completion.
Solution: Exclude unfocusable windows when looping over windows.
2025-04-25 17:45:57 +02:00
zeertzjq
d9353bd442 test(pum): fix passing incorrect grid (#33635) 2025-04-25 22:51:25 +08:00
Christian Clason
06613989a6 build(deps): bump libuv to v1.51.0 2025-04-25 13:01:29 +02:00
Christian Clason
1fed4412e4 vim-patch:e36a931: runtime(groff,nroff): improve ftplugin
- set options in ftplugin but not in syntax
- implement ftplugin/groff.vim (wrapper of ftplugin/nroff.vim)

closes: vim/vim#17174

e36a931d9b

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-25 10:58:49 +02:00
Christian Clason
9e450000d3 vim-patch:32f4973: runtime(gleam): update filetype plugin, include new compiler and syntax script
closes: vim/vim#17172

32f49738d1

Co-authored-by: Kirill Morozov <mail2kirill@gmail.com>
2025-04-25 10:58:49 +02:00
Christian Clason
4ddd31de14 vim-patch:9.1.1343: filetype: IPython files are not recognized
Problem:  filetype: IPython files are not recognized
          (user202729)
Solution: detect *.ipy files as python filetype

fixes: vim/vim#17163

e380b5cbba

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-25 10:35:32 +02:00
zeertzjq
533ce0e807 test(pum): remove two more duplicate screen states (#33628) 2025-04-25 15:19:09 +08:00
zeertzjq
7d569abb20 fix(pum): handle RightDrag on parent grid properly (#33626) 2025-04-25 06:37:42 +00:00
Stephan Seitz
1670fbee0f fix(docs) fix syntax error in Lua snippet for vim.lsp.document_color #33612
9ff1239634 added support for 'textDocument/documentColor' but the
text snippet in the Lua docs seem to contain a syntax error.
2025-04-24 19:21:23 +00:00
luukvbaal
276860b538 fix(messages): clear 'showmode' message after insert_expand #33607
Problem:  'showmode' ext_messages state is not cleared after insert_expand mode.
Solution: Replace empty message with more idiomatic way to clear the showmode.
2025-04-24 12:11:49 -07:00
Maria José Solano
18e8839c80 fix(lsp): don't create an 'LspAttach' document_color autocommand 2025-04-24 21:03:44 +02:00
Maria José Solano
8495d96238 fix(lsp): ensure bufstate when calling vim.lsp.document_color.is_enabled 2025-04-24 21:03:44 +02:00
Maria José Solano
9ff1239634 feat(lsp): support textDocument/documentColor
test(lsp): add tests form `vim.lsp.document_color`
2025-04-24 18:48:19 +02:00
Maria José Solano
ca47cc39f8 refactor(lsp): add handler to vim.lsp.util._refresh options 2025-04-24 18:48:19 +02:00
zeertzjq
ac8ae1596c vim-patch:9.1.1340: cannot complete :filetype arguments (#33602)
Problem:  cannot complete :filetype arguments (Phạm Bình An)
Solution: add :filetype ex command completion, add "filetypecmd"
          completion type for getcompletion()

fixes: vim/vim#17165
closes: vim/vim#17167

a3422aa317

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-24 00:50:33 +00:00
zeertzjq
63689deb45 vim-patch:9.1.1337: Undo corrupted with 'completeopt' "preinsert" when switching buffer (#33600)
Problem:  Undo corrupted with 'completeopt' "preinsert" when switching
          buffer or window.
Solution: Do not delete preinsert text when switching buffer or window.
          (zeertzjq)

related: neovim/neovim#33581
closes: vim/vim#17193

1343681aba
2025-04-24 07:35:11 +08:00
zeertzjq
921752d3e2 Merge pull request #33565 from zeertzjq/vim-9.1.1329
vim-patch:9.1.{1329,1331,1338}
2025-04-24 07:34:37 +08:00
zeertzjq
3d126ec89f vim-patch:9.1.1338: Calling expand() interferes with cmdcomplete_info()
Problem:  Calling expand() interferes with cmdcomplete_info()
          (after 9.1.1329).
Solution: Only clear cmdline_orig when starting/ending cmdline mode
          (zeertzjq).

closes: vim/vim#17192

ec270a5f55
2025-04-24 06:53:26 +08:00
zeertzjq
07d60e8f19 vim-patch:9.1.1331: Leaking memory with cmdcomplete()
Problem:  Leaking memory with cmdcomplete()
          (zeertzjq, after v9.1.1329)
Solution: free the memory (Girish Palya)

closes: vim/vim#17190

5c3d1e3258

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-24 06:53:26 +08:00
zeertzjq
a9f810b203 vim-patch:31b78cc: runtime(doc): update documentation
closes: vim/vim#17180

31b78cce6e

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-24 06:53:26 +08:00
zeertzjq
f3c4fec43f vim-patch:9.1.1329: cannot get information about command line completion
Problem:  cannot get information about command line completion
Solution: add CmdlineLeavePre autocommand and cmdcomplete_info() Vim
          script function (Girish Palya)

This commit introduces two features to improve introspection and control
over command-line completion in Vim:

- Add CmdlineLeavePre autocmd event:

  A new event triggered just before leaving the command line and before
  CmdlineLeave. It allows capturing completion-related state that is
  otherwise cleared by the time CmdlineLeave fires.

- Add cmdcomplete_info() Vim script function:

  Returns a Dictionary with details about the current command-line
  completion state.

These are similar in spirit to InsertLeavePre and complete_info(),
but focused on command-line mode.

**Use case:**

In [[PR vim/vim#16759](https://github.com/vim/vim/pull/16759)], two examples
demonstrate command-line completion: one for live grep, and another for
fuzzy file finding. However, both examples share two key limitations:

1. **Broken history recall (`<Up>`)**
   When selecting a completion item via `<Tab>` or `<C-n>`, the original
pattern used for searching (e.g., a regex or fuzzy string) is
overwritten in the command-line history. This makes it impossible to
recall the original query later.
   This is especially problematic for interactive grep workflows, where
it’s useful to recall a previous search and simply select a different
match from the menu.

2. **Lack of default selection on `<CR>`**
   Often, it’s helpful to allow `<CR>` (Enter) to accept the first match
in the completion list, even when no item is explicitly selected. This
behavior is particularly useful in fuzzy file finding.

----
Below are the updated examples incorporating these improvements:

**Live grep, fuzzy find file, fuzzy find buffer:**

```vim
command! -nargs=+ -complete=customlist,GrepComplete Grep VisitFile()
def GrepComplete(arglead: string, cmdline: string, cursorpos: number):
list<any>
    return arglead->len() > 1 ? systemlist($'grep -REIHns "{arglead}"' ..
       ' --exclude-dir=.git --exclude=".*" --exclude="tags" --exclude="*.swp"') : []
enddef
def VisitFile()
    if (selected_match != null_string)
        var qfitem = getqflist({lines: [selected_match]}).items[0]
        if qfitem->has_key('bufnr') && qfitem.lnum > 0
            var pos = qfitem.vcol > 0 ? 'setcharpos' : 'setpos'
            exec $':b +call\ {pos}(".",\ [0,\ {qfitem.lnum},\ {qfitem.col},\ 0]) {qfitem.bufnr}'
            setbufvar(qfitem.bufnr, '&buflisted', 1)
        endif
    endif
enddef
nnoremap <leader>g :Grep<space>
nnoremap <leader>G :Grep <c-r>=expand("<cword>")<cr>
command! -nargs=* -complete=customlist,FuzzyFind Find
execute(selected_match != '' ? $'edit {selected_match}' : '')
var allfiles: list<string>
autocmd CmdlineEnter : allfiles = null_list
def FuzzyFind(arglead: string, _: string, _: number): list<string>
    if allfiles == null_list
        allfiles = systemlist($'find {get(g:, "fzfind_root", ".")} \! \(
-path "*/.git" -prune -o -name "*.swp" \) -type f -follow')
    endif
    return arglead == '' ? allfiles : allfiles->matchfuzzy(arglead)
enddef
nnoremap <leader><space> :<c-r>=execute('let
fzfind_root="."')\|''<cr>Find<space><c-@>
nnoremap <leader>fv :<c-r>=execute('let
fzfind_root="$HOME/.vim"')\|''<cr>Find<space><c-@>
nnoremap <leader>fV :<c-r>=execute('let
fzfind_root="$VIMRUNTIME"')\|''<cr>Find<space><c-@>
command! -nargs=* -complete=customlist,FuzzyBuffer Buffer execute('b '
.. selected_match->matchstr('\d\+'))
def FuzzyBuffer(arglead: string, _: string, _: number): list<string>
    var bufs = execute('buffers', 'silent!')->split("\n")
    var altbuf = bufs->indexof((_, v) => v =~ '^\s*\d\+\s\+#')
    if altbuf != -1
        [bufs[0], bufs[altbuf]] = [bufs[altbuf], bufs[0]]
    endif
    return arglead == '' ? bufs : bufs->matchfuzzy(arglead)
enddef
nnoremap <leader><bs> :Buffer <c-@>
var selected_match = null_string
autocmd CmdlineLeavePre : SelectItem()
def SelectItem()
    selected_match = ''
    if getcmdline() =~ '^\s*\%(Grep\|Find\|Buffer\)\s'
        var info = cmdcomplete_info()
        if info != {} && info.pum_visible && !info.matches->empty()
            selected_match = info.selected != -1 ? info.matches[info.selected] : info.matches[0]
            setcmdline(info.cmdline_orig). # Preserve search pattern in history
        endif
    endif
enddef
```

**Auto-completion snippet:**

```vim
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu
autocmd CmdlineChanged : CmdComplete()
def CmdComplete()
    var [cmdline, curpos] = [getcmdline(), getcmdpos()]
    if getchar(1, {number: true}) == 0  # Typehead is empty (no more pasted input)
            && !pumvisible() && curpos == cmdline->len() + 1
            && cmdline =~ '\%(\w\|[*/:.-]\)$' && cmdline !~ '^\d\+$'  # Reduce noise
        feedkeys("\<C-@>", "ti")
        SkipCmdlineChanged()  # Suppress redundant completion attempts
        # Remove <C-@> that get inserted when no items are available
        timer_start(0, (_) => getcmdline()->substitute('\%x00', '', 'g')->setcmdline())
    endif
enddef
cnoremap <expr> <up> SkipCmdlineChanged("\<up>")
cnoremap <expr> <down> SkipCmdlineChanged("\<down>")
autocmd CmdlineEnter : set bo+=error
autocmd CmdlineLeave : set bo-=error
def SkipCmdlineChanged(key = ''): string
    set ei+=CmdlineChanged
    timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
    return key != '' ? ((pumvisible() ? "\<c-e>" : '') .. key) : ''
enddef
```

These customizable snippets can serve as *lightweight* and *native*
alternatives to picker plugins like **FZF** or **Telescope** for common,
everyday workflows. Also, live grep snippet can replace **cscope**
without the overhead of building its database.

closes: vim/vim#17115

92f68e26ec

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-24 06:53:22 +08:00
Au.
652c3e76c7 fix(api): nvim_parse_cmd "range" when ea.addr_count=0 #33536
Problem:
nvim_parse_cmd returns invalid 'range' field for cmd like `:bdelete`.

Solution:
Add the condtion `ea.add_count > 0` as required to put 'range'
into result.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-04-23 07:56:17 -07:00
Skoh
bc814cfb2c fix(winblend): treat braille blank (\u2800) as whitespace #32741
Problem:
'winblend' does not display text behind blank unicode characters other than 0x20 ascii space.

Solution:
In ui_compositor.c -> compose_line() check for either 0x20 or 0x80A0E2 (utf8 \u2800).
2025-04-23 05:27:21 -07:00
glepnir
d4f2b9050d fix(float): cursor visible in "hidden" floating window #30866
Problem:
Cursor is visible in "hidden" floating window.

Solution:
Hide cursor when curwin is a hidden floating window.
Show cursor after returning to a normal (non-hidden) window.
2025-04-23 05:22:43 -07:00
Lewis Russell
70d7979439 feat: render tuple types for API methods 2025-04-23 11:58:30 +01:00
Luuk van Baal
019b2050e1 fix(snippet): use <cmd>call cursor() for visual range
Problem:  Change applied in d3e495ce uses a byte-offset where a virtual
          column is expected.
Solution: Set the cursor directly through a <Cmd> mapping, while making
          sure the commands are ordered correctly by adding them to the
          type-ahead buffer.
2025-04-23 10:58:22 +02:00
Christian Clason
8d68dbf906 vim-patch:229f79c: runtime(yaml): fix wrong order of undo_ftplugin suboptions
This commit fixes the following error message:
```
Compiler not supported: make inc< sw< sts<
```

1. orginal value: `setl com< cms< et< fo<| compiler make inc< sw< sts<`
2. correct value: `setl com< cms< et< fo< inc< sw< sts< | compiler make`

While at it, let's also document the g:yaml_recommended_style variable.

closes: vim/vim#17179

229f79c168

Co-authored-by: Vincent Law <vlaw@users.noreply.github.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-23 08:37:36 +02:00
Christian Clason
2ea14c0cf4 vim-patch:7bc9880: runtime(make): do not automatically indent after a special target
prevent indentation if the previous line starts with e.g. `.PHONY:`

closes: vim/vim#17183

7bc988067e

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-23 08:37:36 +02:00
zeertzjq
1dbede5b93 fix(events): avoid superfluous CursorMovedI on first autocmd (#33588) 2025-04-23 03:20:21 +00:00
zeertzjq
803649da11 vim-patch:fa3b104: runtime(vim): Update base-syntax, improve :autocmd highlighting (#33586)
- Match full :autocmd, :doautocmd and :doautoall commands.
- Add filename pattern (wildcard) highlighting.

fa3b1043c6

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-23 01:31:08 +00:00
Gregory Anders
82f08f33c1 fix(tui): ensure all pending escape sequences are processed before exiting #32151
Problem:
Neovim disables a number of terminal modes when it exits, some of which
cause the terminal to send asynchronous events to Neovim. It's possible
that Neovim exits before the terminal has received and processed all of
the sequences to disable these modes, causing the terminal to emit one
of these asynchronous sequences after Neovim has already exited. If this
happens, then the sequence is received by the user's shell (or some
other program that is not Neovim).

Solution:
When Neovim exits, it now emits a Device Attributes request (DA1)
after disabling all of the different modes. When the terminal responds
to this request we know that it has already received all of our other
sequences disabling the other modes. At that point, it should not be
emitting any further asynchronous sequences. This means the process of
exiting Neovim is now asynchronous as well since it depends on receiving
the DA1 response from the terminal.
2025-04-22 05:18:34 -07:00
luukvbaal
d3e495ce03 perf(snippet): use "[count]|" to move cursor #33571
Problem:
Flicker when using vim.snippet.jump().

Solution:
Pass count instead of multiple <right> keys.
2025-04-22 04:34:41 -07:00
Christian Clason
8c81ed8678 feat(runtime): revert cfilter, ccomplete to legacy Vim
Problem: Transpiled Lua code from vim9script is not amenable to static
analysis, requiring manual cleanup or ignoring parts of our codebase.

Solution: Revert to pre-rewrite version of (low-impact) legacy plugins
and remove the vim9jit shim.
2025-04-22 11:03:05 +02:00
luukvbaal
65170e8dad fix(api): wrong return value with reverse range + overlap #32956
Problem:  When iterating in reverse with {start} > {end} in
          `nvim_buf_get_extmarks()`, marks that overlap {start} and are
          greater than {end} are included in the return value twice.
          Marks that overlap {end} and do not overlap {start} are not
          not included in the return value at all. Marks are not
          actually returned in a meaningful "traversal order".

Solution: Rather than actually iterating in reverse, (also possible but
          requires convoluted conditions and would require fetching
          overlapping marks for both the {start} and {end} position,
          while still ending up with non-traversal ordered marks),
          iterate normally and reverse the return value.
2025-04-21 16:18:03 -07:00
Shadman
28e31f5d3d feat(options): default statusline expression #33036
Problem:
Default 'statusline' is implemented in C and not representable as
a statusline expression. This makes it hard for user configs/plugins to
extend it.

Solution:
- Change the default 'statusline' slightly to a statusline expression.
- Remove the C implementation.
2025-04-21 15:05:34 -07:00
Nathaniel Poppe
ab72799841 fix(coverity/530026,530028): free resources on early exit in nlua_exec_file #33502
Problem: The stdin reading path does not close `stdin_dup` or free `sb`
upon early exit.

Solution: Free the resources before returning false.
2025-04-21 08:43:38 -07:00
luukvbaal
986b92eb07 fix(messages): single msg_show event for multiple :set options #33555
Problem:  :set opt1 opt2... emits a separate event for each option.

Solution: Only set the kind for the first printed option value.
2025-04-21 07:51:47 -07:00
Luuk van Baal
7ba0f623d7 feat(ui): avoid setting 'cmdheight' with vim.ui_attach()
Problem:  We allow setting 'cmdheight' to 0 with ext_messages enabled
          since b72931e7. Enabling ext_messages with vim.ui_attach()
          implicitly sets 'cmdheight' to 0 for BWC. When non-zero
          'cmdheight' is wanted, this behavior make it unnecessarily
          hard to keep track of the user configured value.
Solution: Add set_cmdheight to vim.ui_attach() opts table that can be
          set to false to avoid setting 'cmdheight' to 0.
2025-04-21 15:38:23 +02:00
zeertzjq
de7306a250 docs(news): fix incorrect placements (#33566) 2025-04-21 12:20:05 +00:00
luukvbaal
7ba043f0f3 feat(api): add "max_height" argument to nvim_win_text_height (#32835)
Useful to e.g. limit the height to the window height, avoiding unnecessary
work. Or to find out how many buffer lines beyond "start_row" take up a
certain number of logical lines (returned in "end_row" and "end_vcol").
2025-04-21 19:48:26 +08:00
zeertzjq
98ec3fdf74 vim-patch:9.1.1328: too many strlen() calls in indent.c (#33563)
Problem:  too many strlen() calls in indent.c
Solution: refactor indent.c slightly and remove strlen() calls
          (John Marriott)

closes: vim/vim#17156

eac45c558e

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-04-21 19:16:29 +08:00
zeertzjq
e3c3f4730d vim-patch:7938c40: runtime(keymaps): update Brazilian keymaps (#33562)
closes: vim/vim#17161

7938c40b34

Co-authored-by: LuMarquesIlva <luismarques0504@proton.me>
2025-04-21 19:16:17 +08:00
zeertzjq
8051092414 Merge pull request #33561 from zeertzjq/vim-9.1.1304
vim-patch:9.1.{1304,1327}: filetype: some man files are not recognized
2025-04-21 19:09:29 +08:00
zeertzjq
9fafdcb99c vim-patch:9.1.1327: filetype: nroff detection can be improved
Problem:  filetype: nroff detection can be improved
Solution: improve nroff detection (Eisuke Kawashima)

- explicitly check roff comments and macros typically found in manpages
- do not try to detect alphabetically-sectioned files, except for n, as
  nroff
    - l: > 'l' happens to be a section for historical reasons
         <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=391977>
    - n: e.g. /usr/share/man/mann/Tcl.n.gz
    - o: unsure (perhaps fedora-specific)
    - p: unsure (perhaps fedora-specific)

closes: vim/vim#17160

2cb42efc18

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-21 18:40:58 +08:00
zeertzjq
7da1639a14 vim-patch:9.1.1304: filetype: some man files are not recognized
Problem:  filetype: some man files are not recognized
          (e.g. 1p (POSIX commands))
Solution: update the filetype detection pattern and detect more man
          files as nroff (Eisuke Kawashima)

- sections are revised referring to
    - debian-12:/etc/manpath.config
    - fedora-41:/etc/man_db.conf
- detection logic is improved
- detection test is implemented

closes: vim/vim#17117

babdb0554a

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-21 18:40:58 +08:00
Christian Clason
1437144740 vim-patch:e125ee4: runtime(pov): deprecate #render and #statistics in syntax script
- 3.1g: active
  https://www.povray.org/ftp/pub/povray/Old-Versions/Official-3.1g/Docs/povuser.pdf#page=172
- 3.5 or later: deprecated
  https://www.povray.org/ftp/pub/povray/Old-Versions/Official-3.5/Linux/povlinux.tgz
  ─ povray-3.50c/html/povdoc_172.html
  - https://www.povray.org/documentation/3.7.0/r3_3.html#r3_3_2_7_1

closes: vim/vim#17177

e125ee4b9f

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-21 12:38:27 +02:00
Maria José Solano
d55330bcd1 refactor(lsp): use method type annotations for parameters 2025-04-21 11:35:29 +02:00
zeertzjq
351613bc1f vim-patch:187df69: runtime(doc): cross-link :| meaning :p and explain E749 (#33559)
E749 is given when :print (with any range) is issued on an empty buffer,
like the one you get with :new or :enew. Furthermore, due to Vi
compatibility :| is a synonym.

As a result, mappings intended to include a <bar> separator (esp. in the
case of boolean or "||") between commands can generate E749 on startup
when placed in a vimrc if the bars are not properly encoded or escaped.
[1]. Document this failure mode and synonym near the generated error,
and cross link with :help :bar. Note that one must read or scroll quite
a bit to find the mention of :| behaving like :print!

[1]: https://vi.stackexchange.com/q/46625/10604

closes: vim/vim#17173

187df69fd1

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2025-04-21 08:56:05 +00:00
Luuk van Baal
4b02d1f6f6 fix(gen_vimdoc): unnecessary assert for non-source files
Problem:  The presence of non-source files breaks `make doc`.
Solution: Replace assert with if statement to skip non-matching files.
2025-04-21 10:15:33 +02:00
zeertzjq
d3cded796c vim-patch:9.1.1326: invalid cursor position after 'tagfunc' (#33556)
Problem:  invalid cursor position after 'tagfunc'
          (gandalf4a)
Solution: call check_cursor() after executing the 'tagfunc'

9919085491

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-20 23:04:02 +00:00
zeertzjq
c7d8812ca7 vim-patch:2398460: runtime(doc): clarify 'includeexpr' is not used for <cfile> (#33540)
fixes: vim/vim#17139

2398460232

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-19 19:10:43 +08:00
zeertzjq
e4516a90b1 vim-patch:54081f0: runtime(nix): set iskeyword and b:match_words in ftplugin (#33541)
closes: vim/vim#17154

54081f0ce0

Co-authored-by: Arnie97 <arnie97@gmail.com>
2025-04-19 10:59:12 +00:00
Christian Clason
255bf6e5b1 vim-patch:9.1.1320: filetype: alsoft config files are not recognized
Problem:  filetype: alsoft config files are not recognized
Solution: detect alsoft config files as dosini filetype
          (David Mandelberg)

References:
* code with paths to config: ReadALConfig() in
  https://github.com/kcat/openal-soft/blob/master/alc/alconfig.cpp
* example config:
  https://github.com/kcat/openal-soft/blob/master/alsoftrc.sample

closes: vim/vim#17140

1d96caaa4b

Co-authored-by: David Mandelberg <david@mandelberg.org>
2025-04-19 10:52:12 +02:00
Christian Clason
1b0dedb81c vim-patch:9.1.1321: filetype: MS ixx and mpp files are not recognized
Problem:  filetype: MS ixx and mpp files are not recognized
Solution: detect *.mpp and *.ixx files as c++ filetype
          (Hampus Avekvist)

closes: vim/vim#17155

aee34ef23e

Co-authored-by: Hampus Avekvist <hampus.avekvist@hey.com>
2025-04-19 10:52:12 +02:00
zeertzjq
df96276b19 test(api/window_spec): check start_vcol on folded line (#33535) 2025-04-19 05:14:34 +00:00
zeertzjq
ed5e70465a test(api): nvim_win_text_height with virt_lines around fold (#33529) 2025-04-19 01:00:46 +00:00
zeertzjq
7380f8ec71 vim-patch:cb3b752: runtime(doc): clarify "nearest" value for 'completeopt' (#33534)
closes: vim/vim#17146

cb3b752f95

Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-19 08:42:48 +08:00
phanium
dca8b3fede vim-patch:9.1.1322: small delete register cannot paste multi-line correctly (#33531)
Problem:  small delete register cannot paste multi-line correctly
          (after v8.2.2189)
Solution: caused by 032a2d050b82b146d70d6ff714838ee62c07d8ad, so make
          this logic handle charwise only (phanium)

closes: vim/vim#17151

7e93d4c617
2025-04-19 08:01:51 +08:00
zeertzjq
c67398d31b vim-patch:9.1.1319: Various typos in the code, issue with test_inst_complete.vim (#33527)
Problem:  Various typos in the code, redundant and strange use of
          :execute in test_ins_complete.vim (after 9.1.1315).
Solution: Fix typos in the code and in the documentation, use the
          executed command directly (zeertzjq).

closes: vim/vim#17143

98800979dc

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2025-04-19 07:23:20 +08:00
zeertzjq
9397fdafe1 Merge pull request #33519 from zeertzjq/vim-9.1.1314
vim-patch:9.1.{1314,1318}: max allowed string width too small
2025-04-19 07:22:39 +08:00
Au.
44f1dbee0d fix(spell): save spell files to stdpath('data')/site/spell #33528 2025-04-18 08:56:20 -07:00
zeertzjq
0251a25541 vim-patch:9.1.1318: tests: test_format fails
Problem:  tests: test_format fails (after 9.1.1314).
Solution: Increase the string size.  Add missing test_format.res in
          NEW_TESTS_RES (zeertzjq).

closes: vim/vim#17144

e9a27ef373
2025-04-18 17:00:34 +08:00
zeertzjq
ccdb37b075 vim-patch:9.1.1314: max allowed string width too small
Problem:  max allowed string width too small
Solution: increased MAX_ALLOWED_STRING_WIDTH from 6400 to 1MiB
          (Hirohito Higashi)

closes: vim/vim#17138

06fdfa11c5

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-04-18 16:58:10 +08:00
zeertzjq
34791f7988 Merge pull request #33526 from zeertzjq/vim-3dca512
vim-patch: Vim syntax updates
2025-04-18 15:25:11 +08:00
zeertzjq
9045656014 vim-patch:9b171bd: runtime(vim): Update-base-syntax, match full :*grep, :make, :sort and :filter commands
closes: vim/vim#17082

9b171bdfd6

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:59:20 +08:00
zeertzjq
67d6f2baa4 vim-patch:520a2c7: runtime(vim): Update base-syntax, improve :command highlighting
- Match multiline :command definitions.
- Match custom completion funcref var names.

fixes: vim/vim#17001
closes: vim/vim#17067

520a2c7852

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:57:09 +08:00
zeertzjq
5662bdafc2 vim-patch:2f5a8c0: runtime(vim): Update base-syntax, match full :redir command
closes: vim/vim#17057

2f5a8c0b5b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:55:45 +08:00
zeertzjq
3ee144aa95 vim-patch:2a6be83: runtime(vim): Update base-syntax, improve :set backslash handling
Improve backslash handling in :set option values. There is no special
handling for options supporting Windows path separators yet.

See :help option-backslash.

Remove the vimSetString syntax group. Option string values cannot be
specified with a quoted string, this is a command terminating tail
comment.

fixes: vim/vim#16913
closes: vim/vim#17034

2a6be83512

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:52:50 +08:00
zeertzjq
234be4aebc vim-patch:722fbd1: runtime(vim): Update base-syntax, match tuples
Tuples were introduced in commit 9cb865e.  See PR vim/vim#16776.

fixes: vim/vim#16965
closes: vim/vim#16935

722fbd1554

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-18 14:50:05 +08:00
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
Lewis Russell
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
Lewis Russell
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
Christian Clason
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
Christian Clason
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
yuukibarns
284b0e4fa2 fix(treesitter): fix :InspectTree incorrect injections 2025-04-16 15:03:28 +01:00
Justin M. Keyes
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
Judit Novak
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
Dmitry Torokhov
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
Eisuke Kawashima
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
zeertzjq
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
zeertzjq
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
zeertzjq
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
João Bettencourt
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
bfredl
07b33c3266 Merge pull request #31837 from fredizzimo/multigrid-composition
feat(ui): include compositor info with multigrid
2025-04-15 11:56:39 +02:00
Fred Sundvik
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
Phạm Bình An
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
zeertzjq
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
luukvbaal
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
luukvbaal
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
Christian Clason
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
zeertzjq
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
zeertzjq
51caf0a3af fix(completion): avoid freeing uninitialized value (#33459) 2025-04-14 05:02:58 +00:00
zeertzjq
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
zeertzjq
ec9931fae1 Merge pull request #33456 from zeertzjq/vim-eded336
vim-patch: improve 'wildmode' description
2025-04-14 08:44:35 +08:00
zeertzjq
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
zeertzjq
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
luukvbaal
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
Riley Bruins
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
zeertzjq
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
dundargoc
0814086a23 docs: misc (#33093)
Co-authored-by: Jx <JxJxxJxJ@github.com>
Co-authored-by: Richard Dzenis <richard@dzenis.dev>
Co-authored-by: Shixian Sheng <shixian_sheng-2@protonmail.com>
Co-authored-by: Sourabh Kumar <sourabh7.tech@gmail.com>
Co-authored-by: Yegor Yefremov <yegorslists@googlemail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-04-13 07:41:54 +08:00
Riley Bruins
60af1a1db2 fix(treesitter): clear parse options state #33437
Apparently after parsing with options in tree-sitter, the options data
persists in the parser object, and thus successive calls to
`ts_parser_parse()` will act like `ts_parser_parse_with_options()`. This
is problematic because `languagetree.lua` makes coroutine-environment
assumptions based on if a nullptr has been returned by the parser
function. This commit makes it so that the parse options state is reset
upon a regular parse (would be nice if this was done upstream).

Fixes #33277
2025-04-12 15:51:29 -07:00
Emanuel Krollmann
b8763cb215 fix(man.lua): useless executability check #33438
Problem:
executability check using `uv.fs_access`
doesn't work currently and can't work on windows

Solution:
only check for executable with `vim.fn.executable`
2025-04-12 15:50:04 -07:00
Emanuel Krollmann
a8dd5c7e41 fix(man.lua): noisy "ENOENT" error on Windows #33409
Problem:
:Man shows noisy "ENOENT: no such file or directory" error on Windows.

Solution:
Do some checks before calling `vim.system`.
2025-04-12 10:54:20 -07:00
Justin M. Keyes
74ca73d545 docs: misc #33330 2025-04-12 10:21:03 -07:00
Alexej Kowalew
d77d961b35 feat(defaults): shelltemp=false #33012
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-04-12 08:24:42 -07:00
zeertzjq
c8fbb0d2ee vim-patch:ab2fe65: runtime(doc): correct backslash escaping comma example (#33433)
closes: vim/vim#17096

ab2fe65fbf

Co-authored-by: Qiming zhao <chemzqm@gmail.com>
2025-04-12 10:08:57 +00:00
luukvbaal
4a706a7092 fix(column): don't count signs on lines beyond eob #33410
Problem:  Computed previous buffer line count may be beyond end of
          buffer. This results in signs being removed from `b_signcols`
          that were never included in it, tripping an assertion.

Solution: Store the previous line count as it was before appending or
          deleting lines. Use it to clamp the edited region when
          clearing signs before a splice, after which it is reset.
2025-04-11 04:46:55 -07:00
luukvbaal
064ff74cdb fix(marks): wrong display after inserting/deleting lines #33389
Problem:  Lines to/from which virt_lines or inline virt_text may have
          moved are left valid. Similarly the modified region may be
          too small to account for moved decorations after inserting
          or deleting lines. `redrawOneLine()` can be replaced with
          a call to `changed_lines_redraw_buf()`.

Solution: Invalidate the line after a change if there is virt_lines, or
          inline virt_text in the buffer with 'wrap' enabled. Extend the
          modified region for inserted or deleted lines if there may be
          decorations in the buffer. Remove `redrawOneLine()`.
          Simplify the logic for `changed_lines_invalidate_win()`.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-04-11 04:36:49 -07:00
Christian Clason
5111d66ac9 build(deps): bump luajit to 51d4c26ec (#33422)
* ARM: Fix soft-float math.min()/math.max().
* ARM64: Fix pass-by-value struct calling conventions.
2025-04-11 12:47:50 +02:00
Phạm Bình An
092962b07c fix(vim.version): vim.VersionRange:has(<prerelease>) (#33324)
Problem:
`vim.version.range('>=0.10'):has('0.12.0-dev')` returns false, which is
wrong per semver.

Solution:
`vim.VersionRange:has()` shouldn't have special handling for prereleases
(Why would we need it when `__eq`, `__lt`, `__le` already handle
 prereleases?).

Closes #33316
2025-04-11 03:15:18 -07:00
zeertzjq
6a728382f9 vim-patch:06a41ad: runtime(keymaps): include 2 Brazilian Keymaps (#33424)
closes: vim/vim#17072

06a41ad084

Co-authored-by: Elsarques <luismarques0504@proton.me>
2025-04-11 08:56:23 +00:00
zeertzjq
3aa833e0d9 vim-patch:5c84d12: runtime(filetype): make shell filetype detection more robust (#33421)
closes: vim/vim#17063

5c84d12df1

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2025-04-11 16:45:14 +08:00
zeertzjq
7c15987444 vim-patch:9.1.1290: tests: missing cleanup in test_filetype.vim (#33420)
Problem:  tests: missing cleanup in test_filetype.vim, wrong name in
          test_plugin_matchparen
Solution: Add :bwipe corresponding to :split, rename test case

closes: vim/vim#17088

b0e19f9e1b
2025-04-11 08:10:50 +08:00
zeertzjq
dc00b37965 vim-patch:9.1.1212: filetype: logrotate'd pacmanlogs are not recognized (#33412)
Problem:  filetype: logrotate'd pacmanlogs are not recognized
Solution: also detect pacman.log* files as pacmanlog filetype,
          remove BufNewFile autocmd (Eisuke Kawashima)

closes: vim/vim#16873

20d23ce93b

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-04-10 16:20:22 +08:00
Christian Clason
0ee5a4d481 feat(meta): vendor luv meta files
Problem: No type information for `vim.uv`.

Solution: Vendor https://github.com/LuaCATS/luv (which is what
luals bundles). This will allow other tooling to work out-of-the-box and
make these files available to users and plugins without the need for
`lazydev.nvim` etc.
2025-04-10 09:13:13 +02:00
Christian Clason
627d0a2b32 vim-patch:f9f53f5: runtime(remind): include remind.vim ftplugin
closes: vim/vim#17085

f9f53f5a8f

Co-authored-by: Joe Reynolds <joereynolds952@gmail.com>
2025-04-10 09:12:57 +02:00
zeertzjq
51a967d58a vim-patch:9.1.1289: tests: no test for matchparen plugin with WinScrolled event (#33411)
Problem:  tests: no test for matchparen plugin with WinScrolled event
Solution: add missing test

closes: vim/vim#10942

96a0b2a6d5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-10 00:46:49 +00:00
Phạm Bình An
f908fe4462 vim-patch:0b540c6: runtime(help): add omni completion and 'iskeyword' to filetype plugin (#33398)
Problem:

- Help tags provide a good way to navigate the Vim documentation, but
  many help documents don't use them effectively. I think one of the
  reasons is that help writers have to look up help tags manually with
  `:help` command, which is not very convenient.
- 'iskeyword' is only set for help buffers opened by `:help` command.
  That means if I'm editing a help file, I cannot jump to tag in same
  file using `Ctrl-]` unless I manually set it, which is annoying.

Solution:

- Add omni completion for Vim help tags.
- Set 'iskeyword' for `ft-help`

closes: vim/vim#17073

0b540c6f38

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-10 07:36:30 +08:00
Siddhant Agarwal
f068386c9f fix(lsp): "bold" border for vim.lsp.buf.hover #33395
Problem: vim.lsp.buf.hover allows a bold border size which hasn't been
defined

Solution: Define the bold border size for vim.lsp.buf.hover
2025-04-09 04:15:33 -07:00
Yochem van Rosmalen
5a94edad70 feat(health): summary in section heading #33388
Problem:
As checkhealth grows, it is increasingly hard to quickly glance through
the information.

Solution:
Show a summary of ok, warn, and error outputs per section.
2025-04-09 04:13:20 -07:00
Christian Clason
ff2cbe8fac vim-patch:7517a8c: runtime(lf): improve syntax script, add filetype plugin
- Greatly improve detection and highlighting of command/shell regions,
  input-device key labels, escape sequences (@joelim-work)
- Add ftplugin for formatoptions, toggling comment areas
  (@andis-sprinkis)
- Add a few missing lf option keywords, rm. old non-working code, misc.
  formatting (@andis-sprinkis)

closes: vim/vim#17078

7517a8cadf

Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
2025-04-09 10:14:27 +02:00
zeertzjq
c73a827564 vim-patch:9.1.1288: Using wrong window in ll_resize_stack() (#33397)
Problem:  Using wrong window in ll_resize_stack()
          (after v9.1.1287)
Solution: Use "wp" instead of "curwin", even though they are always the
          same value.  Fix typos in documentation (zeertzjq).

closes: vim/vim#17080

b71f1309a2
2025-04-09 07:40:55 +08:00
jyn
3647b821ea fix(editor): respect [+cmd] when executing :drop #33339
Problem:
Normally, `:drop +41 foo.txt` will open foo.txt with the cursor on line
41. But if foo.txt is already open, it instead is a no-op, even if the
cursor is on a different line.

Steps to reproduce:

    nvim --clean foo.txt
    :drop +30 foo.txt

Solution:
Handle +cmd in ex_drop().
2025-04-08 05:54:32 -07:00
luukvbaal
5b1561bb71 fix(display): scroll redrawing doesn't account for virt_lines above fold #33374
Problem:  Logic computing the new height of the modified area does not
          take into account virtual lines attached to a folded line.

Solution: Remove `hasFolding()` branch and let `plines_win_full()` do its job.
2025-04-08 05:47:18 -07:00
zeertzjq
c0f46daca5 Merge pull request #33381 from zeertzjq/vim-9.1.1283
vim-patch:9.1.{1253,1283,1287}
2025-04-08 13:24:43 +08:00
zeertzjq
454abde1aa vim-patch:9.1.1287: quickfix code can be further improved
Problem:  quickfix code can be further improved (after v9.1.1283)
Solution: slightly refactor quickfix.c (Hirohito Higashi)

- remove error message output
- adjust comments
- rename functions:
  - qf_init_quickfix_stack() --> qf_init_stack()
  - qf_resize_quickfix_stack() --> qf_resize_stack()
  - qf_resize_stack() --> qf_resize_stack_base()

Now qf_alloc_stack() can handle both quickfix/location lists.

closes: vim/vim#17068

adcfb6caeb

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-08 13:06:20 +08:00
zeertzjq
00eff4b196 vim-patch:9.1.1283: quickfix stack is limited to 10 items
Problem:  quickfix and location-list stack is limited to 10 items
Solution: add the 'chistory' and 'lhistory' options to configure a
          larger quickfix/location list stack
          (64-bitman)

closes: vim/vim#16920

88d41ab270

Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-08 13:06:19 +08:00
zeertzjq
36d143e707 vim-patch:9.1.1253: abort when closing window with attached quickfix data
Problem:  If win_close() is called with a window that has quickfix stack
          attached to it, the corresponding quickfix buffer will be
          closed and freed after the buffer was already closed. At that
          time curwin->w_buffer points to NULL, which the CHECK_CURBUF
          will catch and abort if ABORT_ON_ERROR is defined
Solution: in wipe_qf_buffer() temporarily point curwin->w_buffer back to
          curbuf, the window will be closed anyhow, so it shouldn't
          matter that curbuf->b_nwindows isn't incremented.

closes: vim/vim#16993
closes: vim/vim#16985

ce80c59bfd

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-04-08 13:06:19 +08:00
zeertzjq
8af9f8ab5e vim-patch:9.1.1286: filetype: help files not detected when 'iskeyword' includes ":" (#33377)
Problem:  Help files not detected when 'iskeyword' includes ":".
Solution: Do not use \< and \> in the pattern (zeertzjq).

fixes: vim/vim#17069
closes: vim/vim#17071

e370141bf4
2025-04-08 00:13:12 +00:00
zeertzjq
1ffc7d6bf8 vim-patch:2ffb4d0: runtime(lua): fix whitespace style issues in lua ftplugin (#33378)
related: vim/vim#17049

2ffb4d0298

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-08 08:07:26 +08:00
Christian Clason
2c960e8f04 ci(deps): bump lua-language-server to 3.14.0 2025-04-07 17:30:08 +02:00
luukvbaal
ca16b54c86 fix(decor): enable decoration provider in on_start #33337
Problem:  An on_win-disabled decoration provider is left disabled for
          the on_buf callback during the next redraw (if the provider
          does not subscribe to on_end).

Solution: Move re-activation of the provider from after the on_end
          callback to before the on_start callback.
2025-04-07 03:58:18 -07:00
Dmitry Zolotukhin
cf59631f65 fix(treesitter): not refreshing virtualtext contents #33361
Problem: In some cases, when treesitter is enabled, deleting a
line below virtualtext will not refresh all updated lines.
https://github.com/neovim/neovim/issues/33358

Solution: Revert a part of https://github.com/neovim/neovim/pull/31324
to ensure that the full range (with virtual lines) is refreshed.
2025-04-07 03:56:40 -07:00
Maria José Solano
666a82374d docs: PR template #33109 2025-04-07 03:15:55 -07:00
Christian Clason
12720e929d build(deps): bump luajit to e0a7ea8a9 2025-04-07 12:01:45 +02:00
Felipe Lema
bd37348939 fix(health): expecting nonexistent "inotifywait" function #33312
Problem:
55e4301036 changed the program name but not the function name.

Solution:
Fix the healthcheck.
2025-04-07 02:13:05 -07:00
Emanuel Krollmann
3ebde5ea14 fix(defaults): keywordprg=:help on Windows #33336
Problem:
As `:h kp` says, the default value for keywordprg
should be ':help' on Windows. It is currently
always ':Man'.

Solution:
Add condition to options.lua which sets keywordprg
to ':help' if running on windows.
2025-04-07 02:07:31 -07:00
Christian Clason
1e9e523521 vim-patch:00b927b: runtime(lua): improve foldexpr, add vim9 script version
closes: vim/vim#17049

00b927b295

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-04-07 10:19:00 +02:00
Christian Clason
5e192dbce2 vim-patch:9cd6d82: runtime(fstab): set formatoptions-=t in filetype plugin
closes: vim/vim#17020

9cd6d82fbb

Co-authored-by: Radu Dineiu <radu.dineiu@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-07 10:19:00 +02:00
Christian Clason
1867f2a830 vim-patch:9adb310: runtime(svelte): add matchit support to svelte filetype plugin
closes: vim/vim#17052

9adb310cf3

Co-authored-by: 231tr0n <zeltronsrikar@gmail.com>
2025-04-07 10:19:00 +02:00
dependabot[bot]
2d11b981bf ci: bump actions/create-github-app-token from 1 to 2
Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 1 to 2.
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Commits](https://github.com/actions/create-github-app-token/compare/v1...v2)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-06 11:20:06 +02:00
Justin M. Keyes
fece489794 refactor(lsp): deprecate client_is_stopped #33342
Problem:
`client_is_stopped(…)` is an alias for `not get_client_by_id(…)`.
And it's not used anywhere in our codebase.

Solution:
Deprecate it.
2025-04-06 02:13:13 +00:00
phanium
28e8190185 fix(vim.hl): nvim_buf_del_extmark on invalid buffer #33331
Problem:
nvim_buf_del_extmark error if buffer is destroyed before timer stops

Solution:
check nvim_buf_is_valid.
2025-04-05 15:56:40 -07:00
Justin M. Keyes
f9dec1228d build: bump NVIM_API_LEVEL #33340
Bumping NVIM_API_LEVEL is pretty much required after every major
release, because it's also used to correlated Lua stdlib changes to
a Nvim version.
2025-04-05 22:48:28 +00:00
Justin M. Keyes
57d99a515f docs: clipboard, eval #33223 2025-04-05 06:01:40 -07:00
zeertzjq
e8785c2e94 vim-patch:9.1.1276: inline word diff treats multibyte chars as word char (#33323)
Problem:  inline word diff treats multibyte chars as word char
          (after 9.1.1243)
Solution: treat all non-alphanumeric characters as non-word characters
          (Yee Cheng Chin)

Previously inline word diff simply used Vim's definition of keyword to
determine what is a word, which leads to multi-byte character classes
such as emojis and CJK (Chinese/Japanese/Korean) characters all
classifying as word characters, leading to entire sentences being
grouped as a single word which does not provide meaningful information
in a diff highlight.

Fix this by treating all non-alphanumeric characters (with class number
above 2) as non-word characters, as there is usually no benefit in using
word diff on them. These include CJK characters, emojis, and also
subscript/superscript numbers. Meanwhile, multi-byte characters like
Cyrillic and Greek letters will still continue to considered as words.

Note that this is slightly inconsistent with how words are defined
elsewhere, as Vim usually considers any character with class >=2 to be
a "word".

related: vim/vim#16881 (diff inline highlight)
closes: vim/vim#17050

9aa120f7ad

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-04-05 09:42:00 +08:00
zeertzjq
1e1384b6dd vim-patch:b8d5c85: runtime(doc): update WinScrolled documentation (#33322)
closes: vim/vim#17036

b8d5c85099

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-05 08:02:32 +08:00
Lewis Russell
a8edf6e445 feat(lsp.util): deprecate vim.lsp.util.stylize_markdown
It's not used anywhere.
2025-04-04 14:34:33 +01:00
Lewis Russell
379c37fa0b fix: bug in stylize_markdown
`stripped` and `markdown_lines` are iterated together so must have the same length.
2025-04-04 14:33:50 +01:00
luukvbaal
98f5aa2564 fix(messages): verbose message emitted without kind #33305
Problem:  Successive autocmd verbose messages may be emitted without a kind.

Solution: Always set the kind when preparing to emit a verbose message.
2025-04-04 05:24:17 -07:00
Yochem van Rosmalen
b10cb0296a feat(defaults): store spellfile in stdpath('data') #33048
Problem:
First rtp directory is unpredictable and not in line with XDG
base spec.

Solution:
Use stdpath('data')/spell as directory if 'spellfile' is not set.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-04-04 05:21:57 -07:00
Christian Clason
4983fa45fc vim-patch:9.1.1271: filetype: Power Query files are not recognized
Problem:  filetype: Power Query files are not recognized
Solution: detect '*.pq' as pq filetype, include pq syntax and filetype
          plugin (Anarion Dunedain)

Microsoft Power Query provides a powerful data import experience that
encompasses many features. Power Query works with desktop Analysis
Services, Excel, and Power BI workbooks, in addition to many online
services, such as Fabric, Power BI service, Power Apps, Microsoft 365
Customer Insights, and more. A core capability of Power Query is to
filter and combine, that is, to mash-up data from one or more of a rich
collection of supported data sources. Any such data mashup is expressed
using the Power Query M formula language. The M language is a
functional, case sensitive language similar to F#.

Reference:
- Power Query M formula language overview:
  https://learn.microsoft.com/en-us/powerquery-m/

closes: vim/vim#17045

e74ec3f523

Co-authored-by: Anarion Dunedain <anarion80@gmail.com>
2025-04-04 10:43:18 +02:00
Christian Clason
b788c7fa6c vim-patch:6099db9: runtime(sh): Update syntax file, command substitution opening paren at EOL
Allow the opening parenthesis of a command substitution to appear at
EOL.

This fixes the issue raised in
https://github.com/vim/vim/issues/17026#issuecomment-2774112284.

closes: vim/vim#17044

6099db9a60

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-04-04 10:43:18 +02:00
zeertzjq
74edfebbde Merge pull request #33282 from glepnir/vim-9.1.1269
vim-patch:9.1.{1269,1272}
2025-04-04 14:13:51 +08:00
glepnir
b01921cb55 vim-patch:9.1.1272: completion: in keyword completion Ctrl_P cannot go back after Ctrl_N
Problem:  completion: in keyword completion Ctrl_P cannot go back after
          Ctrl_N
Solution: in find_compl_when_fuzzy() always return first match of array, after Ctrl_P
          use compl_shown_match->cp_next instead of compl_first_match.
          (glepnir)

closes: vim/vim#17043

3e50a28a03

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-04 13:52:04 +08:00
tstsrt
d9405c7935 test(plugin/shada_spec): failure if timezone isn't a whole hour ahead of UTC (#33257)
Problem: When running functional tests locally, test `syntax/shada.vim works`
fails if the local timezone is not a whole number of hours ahead of UTC.

Solution: Use '!%M' for minute format so that UTC is used in the expected
timestamp instead of the local timezone, just like '%H' for hours.
2025-04-04 11:59:29 +08:00
zeertzjq
4ef9dcb1eb test(lua/hl_spec): fix hang on exit with ASAN (#33298) 2025-04-04 01:19:13 +00:00
Evgeni Chasnovski
71e133e5e6 docs(diagnostic): mention severity in Opts.VirtualLines (#33293)
Problem: `severity` field is recognized by
  `vim.diagnostic.Opts.VirtualLines`, but it is not explicitly
  documented.

Solution: document it.
2025-04-03 10:19:37 -05:00
Siddhant Agarwal
eae2d3b145 feat(vim.hl): allow multiple timed highlights simultaneously #33283
Problem: Currently vim.hl.range only allows one timed highlight.
Creating another one, removes the old one.

Solution: vim.hl.range now returns a timer and a function. The timer
keeps track of how much time is left in the highlight and the function
allows you to clear it, letting the user decide what to do with old
highlights.
2025-04-03 07:26:56 -07:00
zeertzjq
974a3aa2c4 test(lua/secure_spec): fix failure with long path (#33280)
Ref #33278
2025-04-03 21:32:17 +08:00
Deveshi Dwivedi
9722bd7b1b feat(clipboard): g:clipboard="foo" forces the "foo" clipboard tool #33235 2025-04-03 06:14:08 -07:00
Christian Clason
5cdfa3324f vim-patch:9.1.1268: filetype: dax files are not recognized
Problem:  filetype: dax files are not recognized
Solution: detect "*.dax" as dax filetype, include dax filetype and
          syntax plugin (Anarion Dunedain)

Data Analysis Expressions (DAX) is a formula expression language used in
Analysis Services, Power BI, and Power Pivot in Excel. DAX formulas
include functions, operators, and values to perform advanced
calculations and queries on data in related tables and columns in
tabular data models.

DAX language overview:
- https://learn.microsoft.com/en-us/dax/dax-overview

closes: vim/vim#17035

7f518e044f

Co-authored-by: Anarion Dunedain <anarion80@gmail.com>
2025-04-03 10:15:11 +02:00
glepnir
8cf413e450 vim-patch:9.1.1269: completion: compl_shown_match is updated when starting keyword completion
Problem:  compl_shown_match is updated when starting keyword completion
          and does not include fuzzy matching.
Solution: Do not update compl_shown_match when starting keyword
          completion, since it is the one already selected by the
          keyword completion direction. (glepnir)

closes: vim/vim#17033

e4e4d1c381

Co-authored-by: glepnir <glephunter@gmail.com>
2025-04-03 14:21:37 +08:00
zeertzjq
18caa5fb23 Merge pull request #33279 from zeertzjq/vim-8293574
vim-patch: zip plugin updates
2025-04-03 07:10:53 +08:00
zeertzjq
8e2a9cbaa3 vim-patch:a359c9c: runtime(zip): add *.whl to the list of zip extensions
This commits adds the extension *.whl to the list of zip extensions.
Wheel (WHL) files are binary distribution files for python packages.

Reference:
https://packaging.python.org/en/latest/specifications/binary-distribution-format/

fixes: vim/vim#17038

a359c9c25e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-03 06:47:58 +08:00
zeertzjq
d9149a9a09 vim-patch:8293574: runtime(doc): update pi_zip.txt with current list of zip file extensions
closes: vim/vim#17037

8293574c8b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-04-03 06:47:57 +08:00
phanium
0b61bc8982 fix(events): crash on SIGTSTP (Ctrl-Z) #33258
Problem:
Nvim crashes on receive SIGTSTP (Ctrl-Z) since 4dabeff308.

Solution:
* Don't exit on SIGTSTP (not a deadly signal).
* Avoid SIGTSTP handler in os/signal.c.

Co-authored-by: 27Onion Nebell <zzy20080201@gmail.com>
2025-04-02 15:12:19 +00:00
luukvbaal
3af43cffa0 fix(highlight): no match highlight during :substitute prompt #33262
Problem:  Redrawing during a substitute confirm prompt causes the match
          highlight to disappear.
Solution: Unset `highlight_match` after the prompt has returned.
          Use global highlight definitions in searchhl_spec.lua.
2025-04-02 05:14:11 -07:00
zeertzjq
e5ddf7ae7d vim-patch:9.1.1266: MS-Windows: type conversion warnings (#33264)
Problem:  MS-Windows: type conversion warnings
Solution: cast the variables (Yegappan Lakshmanan)

closes: vim/vim#17027

7b6add0b4a

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-04-02 01:39:12 +00:00
Lewis Russell
9b239a6a86 Merge pull request #32686 from lewis6991/lsp-rpc-perf
perf(lsp): improve rpc loop performance (with shim)
2025-04-01 13:49:45 +01:00
tstsrt
ec18ebcb41 fix(api): nvim_set_keymap() throws error even in pcall() #33228
Problem: When `nvim_set_keymap` tries to overwrite a `<unique>` mapping,
it throws an error even when called in `pcall`.

Solution: src/nvim/mapping.c:buf_do_map no longer calls `semsg`. Its
callers now decide whether to ignore the error, or use
`semsg` (not caught)/`api_set_error` (caught by `pcall`).
2025-04-01 05:30:00 -07:00
luukvbaal
0e7479bb76 fix(window): crash on negative window height with 'winbar' #33250
Problem:  Negative window and grid height with 'winbar'.
Solution: Clamp the height when subtracting the 'winbar' height.
2025-04-01 05:02:24 -07:00
Sean Dewar
ec6670080a docs(eval): fix dict param type of mapset
Match maparg's return type.
2025-04-01 10:55:39 +01:00
Sean Dewar
4a36f234ac docs(eval): fix lnum type for functions using tv_get_lnum
These occurrences also accept string, which is used like in getline.

Also make the lnum field of vim.fn.sign_placelist.list.item optional, as it can
be omitted like vim.fn.sign_place.dict's.
2025-04-01 10:55:39 +01:00
zeertzjq
2322ae403b vim-patch:4ac995b: runtime(rust): set formatprg to rustfmt (#33245)
closes: vim/vim#16967

4ac995bf93

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2025-04-01 17:20:11 +08:00
luukvbaal
7e8b7bba21 fix(display): wrong cursor column with 'concealcursor' = "n" and virt_text (#33218)
Problem:  Inline virtual text placed in a decor provider callback
          invalidates `w_virtcol`, which must be valid for `win_line()`.
Solution: Call `validate_virtcol()` after "line" decor provider callbacks.
2025-04-01 07:56:36 +02:00
luukvbaal
32325a66ca fix(move): adjust for concealed lines above topline after scrolling up (#33211)
Problem:  Scrolling up does not adjust `w_topline` for concealed lines
          directly above it, resulting in (non-visual) asymmetry when
          scrolling up/down.
Solution: Adjust `w_topline` for concealed lines after scrolling up.
2025-04-01 07:56:16 +02:00
zeertzjq
8a40213eb3 vim-patch:9.1.1265: tests: no tests for typing normal char during completion (#33239)
Problem:  tests: no tests for typing normal char during completion
Solution: add a test verifying the default behaviour (see :h
          popupmenu-completion)

related: vim/vim#17019

71f17fdd5f

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Girish Palya <girishji@gmail.com>
2025-04-01 08:41:48 +08:00
Lewis Russell
e76a7e8afb refactor: add basic stringbuffer shim 2025-03-31 16:51:18 +01:00
Mathias Fussenegger
f517fcd148 perf(lsp): use string.buffer for rpc loop
Avoids some table allocations.
In a quick test over 50000 iterations it reduces the time from 130ms to
74 ms

For the test setup details see:

https://github.com/mfussenegger/nvim-dap/pull/1394#issue-2725352391
2025-03-31 16:44:33 +01:00
Mathias Fussenegger
42657e70b8 perf(lsp): optimize content length extraction from rpc headers
- No redundant `:gsub` to turn `-` in `Content-Length` into `_`
- No table allocations only to add and later get the content-length
  header
2025-03-31 16:44:33 +01:00
Lewis Russell
2ee896201c fix(lsp): better handling of "*" configs
Problem:

If a config name contains "*" it causes rtp discovery of `lsp/` to
consider the `*` as a wildcard and could lead to strange and unintended
behaviour. For example, accessing the `'*'` config from a `lsp/` file
would cause an infinite loop.

Solution:

- Explicitly disallow a config name from containing wildcards, with the
  exception of `'*'`.
- When Resolving `'*'` config, skip the rtp step.
2025-03-31 16:42:25 +01:00
zeertzjq
04901f4ee7 test(float): restore border tests (#33222) 2025-03-31 14:08:54 +00:00
zeertzjq
089c28b1e8 vim-patch:649a237: runtime(debversions): Add release name for Debian 15 - duke (#33207)
https://lists.debian.org/debian-devel-announce/2025/01/msg00004.html

closes: vim/vim#17010

649a237bc8

Co-authored-by: James McCoy <jamessan@jamessan.com>
2025-03-31 21:54:02 +08:00
glepnir
216cc893bf feat(float): 'winborder' "bold" style #33189 2025-03-31 06:39:50 -07:00
Ghjuvan Lacambre
57b4fb5c53 fix(defaults): enable :terminal [[,]] motion in operator-pending mode #33217
This enables y]] to copy a command and its output.
2025-03-31 06:22:21 -07:00
Skoh
4dabeff308 feat(editor): 'autowriteall' on SIGHUP/SIGQUIT #32843
Problem:
Upon receiving a deadly signal, Nvim doesn't write buffers even if
the option 'autowriteall' is set.

Solution:
Write to all writable buffers upon SIGHUP or SIGQUIT (but not
SIGTERM), if the option 'autowriteall' is set.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-03-31 06:14:45 -07:00
bfredl
2e5958186a Merge pull request #32440 from fredizzimo/message-attach
fix(ui): send multigrid message position and size when the UI is refreshed
2025-03-31 11:23:25 +02:00
Tan, Long
28eaec5e15 fix(treesitter): don't memoize modified headings (#33186)
Problem: repeated gO in markdown etc. adds extra toc indentation

Solution: don't memoize heading table which gets modified
2025-03-31 11:22:57 +02:00
phanium
ee143aaf65 fix(terminal): emit Termrequest for all OSC sequences #33181
Problem: osc 0/1/2/52 didn't emit TermRequest.

Solution: emit `TermRequest` for all recognized osc.
2025-03-30 21:08:01 +00:00
Yegor Yefremov
8a7c9c971f build: ignore out-of-source build folder #33191
Create a .gitignore file inside a build folder. This way this folder
will be ignored by git and hence, no entry in the root .gitignore is
required.

For more information see this post:
https://www.scivision.dev/cmake-auto-gitignore-build-dir/
2025-03-30 13:37:42 -07:00
Justin M. Keyes
b41e066aa1 docs: lsp config/commands #33122
fix #33075
2025-03-30 13:29:36 -07:00
msaher
cb247e06f0 fix(defaults): visual-mode [[,]] for :terminal shell prompts #33201
Problem:
:terminal shell prompt jump mappings ]]/[[ don't work in visual mode.

Solution:
Also define them for in visual mode.
2025-03-30 12:33:37 -07:00
Michael Strobel
90d15227c5 feat(lsp): workspace_required #31824
Problem:
Some language servers do not work properly without a workspace folder.

Solution:
Add `workspace_required`, which skips starting the lsp client if no
workspace folder is found.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-03-30 11:07:53 -07:00
Tighearnán Carroll
de96063bda docs(lsp): vim.api.buf_request_sync can also take function as params #33170 2025-03-30 08:51:49 -07:00
Bartłomiej Maryńczak
49756ebc70 fix(vim.lsp.inlay_hint): requesting inlay_hints even when disabled #32999
Problem:
Nvim needlessly requests inlay_hints even if they are disabled for a given buffer.

Solution:
Add the missing `enabled` check in `on_refresh`.
Rest of the code has this check already so that's the only needed one to fix this.
2025-03-30 08:39:10 -07:00
Phạm Bình An
87b4469adc docs: faq, lua packages #33183
Problem:
- `health#check()` seems to have been removed for a while, but `:h faq`
  still refers to it.
- `news-0.11.txt` doesn't mention #33044
2025-03-30 08:18:23 -07:00
zeertzjq
76cbe9c8f8 vim-patch:9.1.1263: string length wrong in get_last_inserted_save() (#33194)
Problem:  string length wrong in get_last_inserted_save()
          (after v9.1.1222)
Solution: when removing trailing ESC, also decrease the string length
          (Christ van Willegen)

closes: vim/vim#16961

583f5aee96

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2025-03-30 14:30:18 +00:00
zeertzjq
e87d2ae383 fix(checkhealth): check outdated pynvim version properly #33175
Fixes #33174, a regression from #22962.
2025-03-30 07:02:59 -07:00
zeertzjq
e4f37481ff vim-patch:9.1.1261: No test for 'pummaxwidth' non-truncated items (#33193)
Problem:  No test for 'pummaxwidth' non-truncated items (after v9.1.1250)
Solution: Add shorter items to Test_pum_maxwidth_multibyte() (zeertzjq).

closes: vim/vim#17007

c6336acfe3
2025-03-30 21:45:07 +08:00
zeertzjq
431c037709 vim-patch:9.1.1260: Hang when filtering buffer with NUL bytes (#33192)
Problem:  Hang when filtering buffer with NUL bytes (after 9.1.1050).
Solution: Don't subtract "written" from "lplen" repeatedly (zeertzjq).

related: neovim/neovim#33173
closes: vim/vim#17011

53fed23cb7
2025-03-30 13:41:05 +00:00
Justin M. Keyes
75fe540500 feat(checkhealth): emoji for OK/WARN/ERROR #33172
Problem:
Health status can be much more visually distinct.

Solution:
Use emoji next to each status.
2025-03-30 06:33:12 -07:00
zeertzjq
99529577cc fix(api): use E226 instead of E227 for duplicate abbreviation (#33159) 2025-03-30 07:12:01 +08:00
Justin M. Keyes
5f9f5bc04d fix(checkhealth): check g:loaded_xx_provider for all providers #33168 2025-03-29 13:35:06 -07:00
Sathya Pramodh
b4906577c9 fix(provider): misleading :checkhealth if user sets g:loaded_python3_provider=1 #32696
Problem:
:checkhealth shows a confusing message if user sets
g:loaded_python3_provider=1.

Solution:
- Show a warning if that var is set to 1.
- Update provider modules to default to 0. Any user code that is
  checking for 1, is like already broken because these may be set to 2.
2025-03-29 11:06:23 -07:00
Riley Bruins
f4fc769c81 refactor(treesitter): migrate to ts parser callback API #33141
Remove the `set_timeout` functions for `TSParser` and instead add a timeout
parameter to the regular parse function. Remove these deprecated tree-sitter
API functions and replace them with the preferred `TSParseOptions` style.
2025-03-29 10:57:22 -07:00
Daniel Kusai
6e12ef4a7b fix(desktop): cannot open filename with spaces using OS file manager #33161
Problem:
When activated from OS "filetype handling", Nvim cannot handle filenames containing spaces.

Solution:
Quote the filename in the .desktop config.
2025-03-29 08:49:21 -07:00
zeertzjq
295ab46ea0 Merge pull request #33114 from zeertzjq/vim-9.1.1250
vim-patch:9.1.{1250,1255,1257}: 'pummaxwidth'
2025-03-29 21:33:13 +08:00
Christian Clason
d6a5bc4e8b vim-patch:1054b18: runtime(java): Make changes for JDK 24 in syntax script
- "Demote" SecurityManager from the list of java.lang class
  types to javaLangDeprecated.
- Reintroduce supported syntax-preview-feature numbers 455
  and 476 as _new numbers_ 488 and 494, respectively.

References:
- https://openjdk.org/jeps/486 (Permanently Disable the Security Manager)
- https://openjdk.org/jeps/488 (Primitive Types in Patterns etc.)
- https://openjdk.org/jeps/494 (Module Import Declarations)

closes: vim/vim#16977

1054b18291

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2025-03-29 14:29:26 +01:00
Christian Clason
ab00aec67b vim-patch:0dc9a0b: runtime(lf): add lf r34 keywords to syntax script
closes: vim/vim#17002

0dc9a0bc60

Co-authored-by: Andis Spriņķis <andis@sprinkis.com>
2025-03-29 14:29:26 +01:00
Gregory Anders
0d73ec5834 fix(api): use original LHS in keymap error message #33135
When setting a keymap with "unique" that already exists the error
message contains the LHS of the keymap with termcodes replaced. In
particular this means that keys like <Tab> show as an actual tab
character, meaning the error message displays as "Mapping already exists
for ", which is hard to debug for users.

Instead, display the original LHS (without any simplification or parsed
termcodes). This rperesents exactly what the user passed to the `lhs`
argument of `nvim_set_keymap`, which makes it easier to find where the
offending keymap is.
2025-03-29 06:29:06 -07:00
zeertzjq
52b19e0124 vim-patch:9.1.1257: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw()
Problem:  Mixing vim_strsize() with mb_ptr2cells() in pum_redraw().
Solution: Change vim_strsize() to mb_string2cells() (zeertzjq).

Since vim_strsize() uses ptr2cells() for the cell width of each char, it
is strange to mix it with mb_ptr2cells(), which is used both just below
and in pum_screen_puts_with_attr(), and screen_puts_len() also uses
something similar.  Meanwhile mb_string2cells() uses mb_ptr2cells() for
the cell width of each char.

Note that the vim_strsize() and mb_string2cells() actually return the
same value here, as the transstr() above makes sure the string only
contains printable chars, and ptr2cells() and mb_ptr2cells() only return
different values for unprintable chars.

closes: vim/vim#17003

90e52490b3
2025-03-29 21:12:32 +08:00
zeertzjq
686e7aca40 fix(pum): simplify 'pummaxwidth' truncation and avoid crash 2025-03-29 21:12:32 +08:00
zeertzjq
675ee057e0 vim-patch:9.1.1255: missing test condition for 'pummaxwidth' setting
Problem:  missing test condition for 'pummaxwidth' setting, pummaxwidth
          not effective when width is 32 and height is 10
          (after v9.1.1250)
Solution: add missing comparison condition in pum_width()
          (glepnir)

closes: vim/vim#16999

532c5aec6f

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-29 21:12:32 +08:00
zeertzjq
62da4e2949 vim-patch:9.1.1250: cannot set the maximum popup menu width
Problem:  cannot set the maximum popup menu width
          (Lucas Mior)
Solution: add the new global option value 'pummaxwidth'
          (glepnir)

fixes: vim/vim#10901
closes: vim/vim#16943

88d75934c3

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-29 21:12:32 +08:00
zeertzjq
89bc945554 vim-patch:9.1.1258: regexp: max \U and \%U value is limited by INT_MAX (#33156)
Problem:  regexp: max \U and \%U value is limited by INT_MAX but gives a
          confusing error message (related: v8.1.0985).
Solution: give a better error message when the value reaches INT_MAX

When searching Vim allows to get up to 8 hex characters using the /\V
and /\%V regex atoms.  However, when using "/\UFFFFFFFF" the code point is
already above what an integer variable can hold, which is 2,147,483,647.

Since patch v8.1.0985, Vim already limited the max codepoint to INT_MAX
(otherwise it caused a crash in the nfa regex engine), but instead of
error'ing out it silently fell back to parse the number as a backslash
value and not as a codepoint value and as such this "/[\UFFFFFFFF]" will
happily find a "\" or an literal "F".  And this "/[\d127-\UFFFFFFFF]"
will error out as "reverse range in character class).

Interestingly, the max Unicode codepoint value is U+10FFFF which still
fits into an ordinary integer value,  which means, that we don't even
need to parse 8 hex characters, but 6 should have been enough.

However, let's not limit Vim to search for only max 6 hex characters
(which would be a backward incompatible change), but instead allow all 8
characters and only if the codepoint reaches INT_MAX, give a more
precise error message (about what the max unicode codepoint value is).
This allows to search for "[\U7FFFFFFE]" (will likely return "E486
Pattern not found") and "[/\U7FFFFFF]" now errors "E1517: Value too
large, max Unicode codepoint is U+10FFFF".

While this change is straight forward on architectures where long is 8
bytes, this is not so simple on Windows or 32bit architectures where long
is 4 bytes (and therefore the test fails there).  To account for that,
let's make use of the vimlong_T number type and make a few corresponding
changes in the regex engine code and cast the value to the expected data
type. This however may not work correctly on systems that doesn't have
the long long datatype (e.g. OpenVMS) and probably the test will fail
there.

fixes: vim/vim#16949
closes: vim/vim#16994

f2b16986a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-29 13:05:03 +00:00
phanium
78d2e0b43e fix(checkhealth): don't override user "q" keymap #33132 2025-03-29 05:55:17 -07:00
Ricardo Casía
874e214993 fix: remove exec permission from .gitattributes #33140
Problem:
.gitattributes was marked as executable, which isn’t needed for a config
file and goes against the principle of least privilege.

Solution:
Set file mode to 100644 to reflect its intended use.
2025-03-29 05:30:30 -07:00
zeertzjq
6ef5dd5266 refactor(diff): remove unreachable code (#33149) 2025-03-29 11:01:57 +08:00
zeertzjq
2681e1fce3 fix(pum): fix heap-buffer-overflow with 'rightleft' (#33146) 2025-03-29 02:07:14 +00:00
zeertzjq
cb31663663 vim-patch:9.1.1252: typos in code and docs related to 'diffopt' "inline:" (#33143)
Problem:  Typos in code and docs related to 'diffopt' "inline:".
          (after v9.1.1243)
Solution: Fix typos and slightly improve the docs.
          (zeertzjq)

closes: vim/vim#16997

5a307c361c
2025-03-29 07:01:49 +08:00
luukvbaal
f4ee0ab2f1 fix(cmdline): avoid empty @: register after :<CR> (#33126)
Fix https://github.com/neovim/neovim/issues/33125
2025-03-28 19:48:17 +01:00
Micah Halter
5554fcc286 fix(lsp): warn on missing config in :checkhealth #33087
Problem
When calling `:checkhealth vim.lsp` after the user has enabled a language
server with `vim.lsp.enable` that has no configuration a runtime error
is hit because the code expects for a configuration to exist.

Solution:
Check if a configuration was returned before parsing it, if it isn't
returned then warn the user that the server has been enabled but a
configuration was not found.
2025-03-28 05:46:10 -07:00
luukvbaal
95ab723995 fix(cmdline): empty ext_cmdline block events for :<CR> #33118
Problem:  An ext_cmdline block event that should be empty after :<CR>
          re-emits the previous cmdline.
Solution: Clear `last_cmdline` even when `new_last_cmdline == NULL`.
2025-03-28 04:52:57 -07:00
v1nh1shungry
ade58885c4 fix(provider)!: drop Python 3.7, 3.8 support #33088
Problem: #33022 didn't update `min_version` to 3.9, therefore Python 3.7
and 3.8 are still available.

Solution: Update `min_version` to 3.9.
2025-03-28 04:49:10 -07:00
Riley Bruins
75cbd9a8ae refactor(treesitter): simplify injection retrieval #33104
Simplify the logic for retrieving the injection ranges for the language
tree. The trees are now also sorted by starting position, regardless of
whether they are part of a combined injection or not. This would be
helpful if ranges are ever to be stored in an interval tree or other
kind of sorted tree structure.
2025-03-28 04:38:47 -07:00
Shadman
18fa61049a fix(mouse): crash with click on win-separator in statusline (#33091)
Problem: Clicking on window separator in statusline crashes Nvim due
to out of bound memory access

Solution: Check if the click location is within clicking range before
applying it.
2025-03-28 15:09:02 +08:00
zeertzjq
edb9d0d21e Merge pull request #33086 from zeertzjq/vim-9.1.1243
vim-patch:9.1.{1243,1246}
2025-03-28 15:07:20 +08:00
zeertzjq
e2e0f92f17 vim-patch:9.1.1246: coverity complains about some changes in v9.1.1243
Problem:  coverity complains about some changes in v9.1.1243
Solution: remove duplicate code in diff_find_changed() (Yee Cheng Chin)

closes: vim/vim#16988

4f9b1243e3

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-28 14:46:21 +08:00
zeertzjq
2331c52aff vim-patch:9.1.1243: diff mode is lacking for changes within lines
Problem:  Diff mode's inline highlighting is lackluster. It only
          performs a line-by-line comparison, and calculates a single
          shortest range within a line that could encompass all the
          changes. In lines with multiple changes, or those that span
          multiple lines, this approach tends to end up highlighting
          much more than necessary.

Solution: Implement new inline highlighting modes by doing per-character
          or per-word diff within the diff block, and highlight only the
          relevant parts, add "inline:simple" to the defaults (which is
          the old behaviour)

This change introduces a new diffopt option "inline:<type>". Setting to
"none" will disable all inline highlighting, "simple" (the default) will
use the old behavior, "char" / "word" will perform a character/word-wise
diff of the texts within each diff block and only highlight the
differences.

The new char/word inline diff only use the internal xdiff, and will
respect diff options such as algorithm choice, icase, and misc iwhite
options. indent-heuristics is always on to perform better sliding.

For character highlight, a post-process of the diff results is first
applied before we show the highlight. This is because a naive diff will
create a result with a lot of small diff chunks and gaps, due to the
repetitive nature of individual characters. The post-process is a
heuristic-based refinement that attempts to merge adjacent diff blocks
if they are separated by a short gap (1-3 characters), and can be
further tuned in the future for better results. This process results in
more characters than necessary being highlighted but overall less visual
noise.

For word highlight, always use first buffer's iskeyword definition.
Otherwise if each buffer has different iskeyword settings we would not
be able to group words properly.

The char/word diffing is always per-diff block, not per line, meaning
that changes that span multiple lines will show up correctly.
Added/removed newlines are not shown by default, but if the user has
'list' set (with "eol" listchar defined), the eol character will be be
highlighted correctly for the specific newline characters.

Also, add a new "DiffTextAdd" highlight group linked to "DiffText" by
default. It allows color schemes to use different colors for texts that
have been added within a line versus modified.

This doesn't interact with linematch perfectly currently. The linematch
feature splits up diff blocks into multiple smaller blocks for better
visual matching, which makes inline highlight less useful especially for
multi-line change (e.g. a line is broken into two lines). This could be
addressed in the future.

As a side change, this also removes the bounds checking introduced to
diff_read() as they were added to mask existing logic bugs that were
properly fixed in vim/vim#16768.

closes: vim/vim#16881

9943d4790e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-28 14:45:01 +08:00
zeertzjq
ae98d0a560 vim-patch:9.1.1247: fragile setup to get (preferred) keys from key_name_entry (#33102)
Problem:  fragile setup to get (preferred) keys from key_name_entry
          (after v9.1.1179)
Solution: refactor the code further, fix a bug with "pref_name" key
          entry introduced in v9.1.1180 (Yee Cheng Chin)

The optimization introduced for using bsearch() with key_name_entry
in vim/vim#16788 was fragile as it required synchronizing a non-obvious index
(e.g. IDX_KEYNAME_SWU) with the array that could be accidentally changed
by any one adding a key to it. Furthermore, the "pref_name" that was
introduced in that change was unnecessary, and in fact introduced a bug,
as we don't always want to use the canonical name.

The bug is triggered when the user triggers auto-complete using a
keycode, such as `:set <Scroll<Tab>`. The bug would end up showing two
copies of `<ScrollWheelUp>` because both entries end up using the
canonical name.

In this change, remove `pref_name`, and simply use a boolean to track
whether an entry is an alt name or not and modify logic to respect that.

Add test to make sure auto-complete works with alt names

closes: vim/vim#16987

7d8e7df551

In Nvim there is no `enabled` field, so put `is_alt` before `name` to
reduce the size of the struct.

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-28 08:08:36 +08:00
zeertzjq
59e02ee93b Merge pull request #33101 from zeertzjq/vim-052b86b
vim-patch: runtime file updates
2025-03-28 08:06:12 +08:00
zeertzjq
d96a685fae vim-patch:f9f4e27: runtime(hyprlang): save and restore cpo setting in syntax script
fixes: vim/vim#16970
closes: vim/vim#16973

f9f4e27ad7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-28 07:21:54 +08:00
zeertzjq
558de3d9ad vim-patch:052b86b: runtime(solidity): update syntax script with error definitions
closes: vim/vim#16978

References:
- https://docs.soliditylang.org/en/latest/contracts.html#transient-storage
- https://soliditylang.org/blog/2021/04/21/custom-errors/

052b86ba63

Co-authored-by: S0AndS0 <strangerthanbland@gmail.com>
2025-03-28 07:21:42 +08:00
Eisuke Kawashima
07f048a8d7 fix(health): message should mention "vim.provider" #33095 2025-03-27 16:19:54 -07:00
zeertzjq
e1f1386d5e Merge pull request #33098 from zeertzjq/vim-9.1.1245
vim-patch:9.1.{1245,1249}
2025-03-28 07:15:33 +08:00
zeertzjq
e4172bcbdf vim-patch:9.1.1249: tests: no test that 'listchars' "eol" doesn't affect "gM"
Problem:  No test that 'listchars' "eol" doesn't affect "gM".
Solution: Add a test (zeertzjq).

closes: vim/vim#16990

757c37da6d
2025-03-28 06:56:18 +08:00
zeertzjq
b20fc95c1a vim-patch:9.1.1245: need some more tests for curly braces evaluation
Problem:  need some more tests for curly braces evaluation
Solution: Add a test for the regression introduced by patch v9.1.1242
          (Yegappan Lakshmanan)

closes: vim/vim#16986

d9b82cfe84

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-03-28 06:56:04 +08:00
zeertzjq
d01d476480 refactor(eval): move diff functions to diff.c (#33085)
They were moved in Vim in patch 8.1.1989.
This change is required to port patch 9.1.1243.
2025-03-27 13:35:20 +00:00
luukvbaal
703f4037c4 fix(ui): wincmd _ should not increase 'cmdheight' above 0 (#33056) 2025-03-27 12:52:46 +01:00
luukvbaal
ce0c0c31a0 fix(display): scroll logic does not take into account concealed topline (#33054) 2025-03-27 12:51:57 +01:00
Fred Sundvik
424d30fe97 fix(ui): send multigrid message position and size when the UI is refreshed 2025-03-27 18:41:57 +07:00
zeertzjq
c5044bd021 vim-patch:51a06ec: runtime(sh): consider sh as POSIX shell by default (#33078)
Also, do not set g:is_kornshell when g:is_posix is set. BSD shells are
POSIX but many are derived from the ash shell.

closes: vim/vim#16939

51a06ecee0

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2025-03-27 11:22:22 +08:00
zeertzjq
750e1836af vim-patch:9.1.1224: cannot :put while keeping indent (#33076)
Problem:  cannot :put while keeping indent (Peter Aronoff)
Solution: add the :iput ex command (64-bitman)

fixes: vim/vim#16225
closes: vim/vim#16886

e08f10a55c

Cherry-pick test_put.vim changes from patch 8.2.1593.

N/A patches:
vim-patch:9.1.1213: cannot :put while keeping indent
vim-patch:9.1.1215: Patch 9.1.1213 has some issues

Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-03-27 01:06:46 +00:00
zeertzjq
8f40ffdb92 Merge pull request #32953 from glepnir/vim-9.1.1214
vim-patch:9.1.{1214,1217,1219}: matchfuzzy() "camelcase"
2025-03-27 08:54:32 +08:00
zeertzjq
797195e0ea vim-patch:9.1.1219: Strange error with wrong type for matchfuzzy() "camelcase"
Problem:  Strange error with type for matchfuzzy() "camelcase".
Solution: Show the error "Invalid value for argument camelcase" instead
          of "Invalid argument: camelcase" (zeertzjq).

Note that using tv_get_string() will lead to confusion, as when the
value cannot be converted to a string tv_get_string() will also give an
error about that, but "camelcase" takes a boolean, not a string.  Also
don't use tv_get_string() for the "limit" argument above.

closes: vim/vim#16926

c4815c157b
2025-03-27 08:25:12 +08:00
zeertzjq
f9280cde0a vim-patch:9.1.1217: tests: typos in test_matchfuzzy.vim
Problem:  tests: typos in test_matchfuzzy.vim (after 9.1.1214).
Solution: Fix the typos.  Consistently put the function call on the
          second line in assertions for camelcase (zeertzjq).

closes: vim/vim#16907

85627732e0
2025-03-27 08:20:32 +08:00
glepnir
162edf7b30 vim-patch:9.1.1214: matchfuzzy() can be improved for camel case matches
Problem:  When searching for "Cur", CamelCase matches like "lCursor" score
          higher than exact prefix matches like Cursor, which is
          counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
          CamelCase bonuses when needed, making prefix matches rank higher.
          (glepnir)

fixes: vim/vim#16504
closes: vim/vim#16797

28e40a7b55

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 08:19:25 +08:00
zeertzjq
ce590e2077 Merge pull request #30189 from zeertzjq/vim-9.1.0598
vim-patch: 'completefuzzycollect' option
2025-03-27 08:02:45 +08:00
zeertzjq
0af780e8df vim-patch:9.1.1228: completion: current position column wrong after got a match
Problem:  The current_pos.col was incorrectly updated to the length of
          the matching text. This will cause the next search to start
          from the wrong position.
Solution: current_pos has already been updated in search_str_in_line and
          does not need to be changed (glepnir)

closes: vim/vim#16941

5753084042

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
e39cdafed9 vim-patch:9.1.1201: 'completefuzzycollect' does not handle dictionary correctly
Problem:  'completefuzzycollect' does not handle dictionary correctly
Solution: check for ctrl_x_mode_dictionary (glepnir)

closes: vim/vim#16867

587601671c

Cherry-pick a documentation fix from later.

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
5975ddbdb8 vim-patch:1dc731a: runtime(doc): make :h 'completefuzzycollect' a bit clearer
- Fix grammar
- Use "matches" instead of "items" ("completion candidates" is used in
  some other places, but it's a bit verbose)
- "When set" is a bit vague, instead use "For specified modes"

closes: vim/vim#16871

1dc731a49f
2025-03-27 07:26:42 +08:00
zeertzjq
28f6199474 vim-patch:9.1.1197: process_next_cpt_value() uses wrong condition
Problem:  process_next_cpt_value() uses wrong condition
Solution: use cfc_has_mode() instead and remove redundant else if branch
          (glepnir)

closes: vim/vim#16833

53b14578e0

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
cd95ea5d48 vim-patch:9.1.1185: endless loop with completefuzzycollect and no match found
Problem:  endless loop with completefuzzycollect and no match found
Solution: move pointer to line end and break loop

closes: vim/vim#16820

dd42b05f8a

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
10fde593f1 vim-patch:9.1.1182: No cmdline completion for 'completefuzzycollect'
Problem:  No cmdline completion for the 'completefuzzycollect' option
          (after v9.1.1178)
Solution: Add cmdline completion for the 'completefuzzycollect' option,
          improve its description in optwin.vim (zeertzjq).

closes: vim/vim#16813

53d59ecc1d

No code change is needed in Nvim as Nvim uses expand_set_str_generic()
by default.
2025-03-27 07:26:42 +08:00
zeertzjq
17db70f3af vim-patch:9.1.1181: Unnecessary STRLEN() calls in insexpand.c
Problem:  Unnecessary STRLEN() calls in insexpand.c (after 9.1.1178).
Solution: Use the already available length (zeertzjq).

closes: vim/vim#16814

4422de6316
2025-03-27 07:26:42 +08:00
zeertzjq
90d59e6c8a vim-patch:9.1.1178: not possible to generate completion candidates using fuzzy matching
Problem:  not possible to generate completion candidates using fuzzy
          matching
Solution: add the 'completefuzzycollect' option for (some) ins-completion
          modes (glepnir)

fixes vim/vim#15296
fixes vim/vim#15295
fixes vim/vim#15294
closes: vim/vim#16032

f31cfa29bf

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
3029357520 vim-patch:9.1.1131: potential out-of-memory issue in search.c
Problem:  potential out-of-memory issue in search.c
Solution: improve situation and refactor search.c slightly
          (John Marriott)

- In function update_search_stat():
  add a check for a theoretical null pointer reference, set and remember
  the length of lastpat, remove the three calls to STRLEN() and use the
  various string's associated lengths instead, add a check for an
  out-of-memory condition.

- In function search_for_fuzz_match():
  remove a call to strnsave() and thus avoid having to add a check for
  an out-of-memory condition, also replace the call to STRLEN() by
  ml_get_buf_len().

closes: vim/vim#16689

b79fa3d9c8

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-27 07:26:42 +08:00
zeertzjq
c17caca9b7 vim-patch:9.1.1008: tests: test for patch 9.1.1006 doesn't fail without the patch
Problem:  tests: test for patch 9.1.1006 doesn't fail without the patch
          (after v9.1.1006)
Solution: Add ctermbg=NONE to the highlight groups (zeertzjq).

closes: vim/vim#16425

faf250c9e4
2025-03-27 07:26:42 +08:00
zeertzjq
44f70b4be1 vim-patch:9.1.1006: PmenuMatch completion highlight can be combined
Problem:  PmenuMatch completion highlight can be combined
Solution: Combine highlight groups PmenuMatch with Pmenu and
          PmenuMatchSel with PmenuSel (glepnir)

fixes: vim/vim#15563
closes: vim/vim#16408

9eff3ee818

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
fbac254511 vim-patch:9.1.0733: keyword completion does not work with fuzzy
Problem:  keyword completion does not work with fuzzy
          (egesip)
Solution: handle ctrl_x_mode_normal() specifically
          (glepnir)

fixes: vim/vim#15412
closes: vim/vim#15424

7cfe693f9b

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
bf62672d59 vim-patch:26e4b00: runtime(doc): Revert outdated comment in completeopt's fuzzy documentation
Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

26e4b00002

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
767a52ba30 vim-patch:9.1.0705: Sorting of fuzzy filename completion is not stable
Problem:  Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal.  Fix some typos.
          (zeertzjq)

closes: vim/vim#15593

58d705238c
2025-03-27 07:26:42 +08:00
zeertzjq
f4ddbaeb9e vim-patch:9.1.0654: completion does not respect completeslash with fuzzy
Problem:  completion does not respect completeslash with fuzzy
          (egesip)
Solution: Change path separator on Windows, depending on 'completeslash'
          option value (glepnir)

fixes: vim/vim#15392
closes: vim/vim#15418

b9de1a057f

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
d9f4c1db23 vim-patch:9.1.0634: Ctrl-P not working by default
Problem:  Ctrl-P not working by default
          (Jesse Pavel, after v9.1.0598)
Solution: Revert part of v9.1.0598 and set cur_match_pos
          correctly according to compl_dir_forward()

fixes: vim/vim#15370
closes: vim/vim#15379

13032a49b7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-27 07:26:42 +08:00
zeertzjq
9757b11aaf vim-patch:9.1.0631: wrong completion list displayed with non-existing dir + fuzzy completion
Problem:  wrong completion list displayed with non-existing dir + fuzzy
          completion (kawarimidoll)
Solution: clear list of matches, if leader did not use fuzzy match
          (glepnir)

fixes: vim/vim#15357
closes: vim/vim#15365

6b6280c4a2

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
a9aedfbc58 vim-patch:9.1.0605: internal error with fuzzy completion
Problem:  internal error with fuzzy completion
          (techntools)
Solution: only fuzzy complete the pattern after directory separator
          (glepnir)

fixes: vim/vim#15287
closes: vim/vim#15291

0be03e14b9

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
zeertzjq
d5a6040967 vim-patch:9.1.0598: fuzzy completion does not work with default completion
Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

8159fb18a9

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:41 +08:00
Gregory Anders
9acb52c8f3 refactor(diagnostic)!: remove deprecated diagnostic APIs (#33072) 2025-03-26 13:56:23 -05:00
Christian Clason
c5f3b4ca02 revert: "refactor(tui): disable kitty key event reporting"
This reverts commit 466f20dd70.
2025-03-26 17:23:53 +01:00
Justin M. Keyes
c46b7ab9a3 docs: news 0.12 #33065 2025-03-26 07:50:46 -07:00
Justin M. Keyes
2e68e9c051 fix: temporarily disable 0.12 deprecation tests
Re-enable these after release.
2025-03-26 14:49:23 +01:00
Justin M. Keyes
0926098e9d version bump 2025-03-26 14:49:03 +01:00
1130 changed files with 90339 additions and 37168 deletions

View File

@@ -18,6 +18,7 @@ Checks: >
-bugprone-not-null-terminated-result,
-bugprone-suspicious-memory-comparison,
-bugprone-switch-missing-default-case,
-bugprone-tagged-union-member-count,
-cert-env33-c,
-cert-err33-c,
-cert-err34-c,
@@ -63,6 +64,7 @@ Checks: >
Aliases. These are just duplicates of other warnings and should always be ignored,
-bugprone-narrowing-conversions,
-cert-arr39-c,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-exp42-c,

25
.emmyrc.json Normal file
View File

@@ -0,0 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
"format": {
"externalTool": {
"program": "stylua",
"args": [
"-",
"--stdin-filepath",
"${file}"
]
}
},
"diagnostics": {
"disable": [
"unnecessary-if"
]
},
"codeAction": {
"insertSpace": true
},
"strict": {
"typeCall": true,
"arrayIndex": true
}
}

0
.gitattributes vendored Executable file → Normal file
View File

5
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,5 @@
<!--
Thank you for contributing to Neovim!
If this is your first time, check out https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#pull-requests-prs
for our PR guidelines.
-->

View File

@@ -57,6 +57,7 @@ module.exports = async ({ github, context }) => {
if (labels.includes("lsp")) {
reviewers.add("MariaSolOs");
reviewers.add("ribru17");
}
if (labels.includes("netrw")) {
@@ -89,6 +90,7 @@ module.exports = async ({ github, context }) => {
reviewers.add("clason");
reviewers.add("lewis6991");
reviewers.add("wookayin");
reviewers.add("ribru17");
}
if (labels.includes("tui")) {

View File

@@ -11,9 +11,9 @@ jobs:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/create-github-app-token@v1
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP }}

View File

@@ -28,7 +28,7 @@ jobs:
test: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.test }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- run: |
cmake -S cmake.deps --preset ci -D ENABLE_WASMTIME=ON
@@ -44,7 +44,7 @@ jobs:
CMAKE_URL: 'https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh'
CMAKE_VERSION: '3.16.0'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Install minimum required version of cmake
@@ -73,7 +73,7 @@ jobs:
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Build bundled dependencies

View File

@@ -22,7 +22,7 @@ jobs:
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Initialize CodeQL

View File

@@ -8,7 +8,7 @@ jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Download Coverity

View File

@@ -10,7 +10,7 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Generate docs

View File

@@ -9,7 +9,7 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/labeler@v5
with:
configuration-path: .github/scripts/labeler_configuration.yml

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci:skip-news')
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

View File

@@ -36,7 +36,7 @@ Note: On Windows "Server" you may need to [install vcruntime140.dll](https://lea
### Linux (x86_64)
If your system does not have the [required glibc version](https://neovim.io/doc/user/support.html#supported-platforms), try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases).
If your system does not have the required glibc version, try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases).
#### AppImage
@@ -54,7 +54,7 @@ If your system does not have the [required glibc version](https://neovim.io/doc/
2. Extract: `tar xzvf nvim-linux-x86_64.tar.gz`
3. Run `./nvim-linux-x86_64/bin/nvim`
### Linux (arm64) - Untested
### Linux (arm64)
#### AppImage
@@ -75,5 +75,3 @@ If your system does not have the [required glibc version](https://neovim.io/doc/
### Other
- Install by [package manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package)
## SHA256 Checksums

View File

@@ -55,7 +55,7 @@ jobs:
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# Perform a full checkout #13471
fetch-depth: 0
@@ -101,7 +101,7 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# Perform a full checkout #13471
fetch-depth: 0
@@ -132,9 +132,9 @@ jobs:
windows:
needs: setup
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# Perform a full checkout #13471
fetch-depth: 0
@@ -166,9 +166,9 @@ jobs:
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gettext-base
@@ -193,25 +193,13 @@ jobs:
echo 'PRERELEASE=') >> $GITHUB_ENV
gh release delete stable --yes || true
git push origin :stable || true
# `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
# containing folder from the output.
- run: |
for i in nvim-*; do
(
cd $i || exit
sha256sum * >> $GITHUB_WORKSPACE/shasum.txt
)
done
- name: Publish release
env:
NVIM_VERSION: ${{ needs.linux.outputs.version }}
DEBUG: api
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
echo '```' >> "$RUNNER_TEMP/notes.md"
cat shasum.txt >> "$RUNNER_TEMP/notes.md"
echo '```' >> "$RUNNER_TEMP/notes.md"
if [ "$TAG_NAME" != "nightly" ]; then
gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/* shasum.txt
gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/*
fi
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/* shasum.txt
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/*

View File

@@ -13,7 +13,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/github-script@v7
with:
script: |
@@ -27,7 +27,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/github-script@v7
with:
script: |

View File

@@ -10,7 +10,7 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: 'Request reviewers'
uses: actions/github-script@v7
with:

View File

@@ -8,7 +8,7 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: 'Remove reviewers'
uses: actions/github-script@v7
with:

View File

@@ -28,17 +28,17 @@ env:
jobs:
lint:
runs-on: ubuntu-24.04
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
env:
CC: clang
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Install stylua
run: |
wget --directory-prefix="$BIN_DIR" https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip
wget --directory-prefix="$BIN_DIR" https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-aarch64.zip
(cd "$BIN_DIR"; unzip stylua*.zip)
- name: Build third-party deps
@@ -82,12 +82,12 @@ jobs:
run: cmake --build build --target lintc-uncrustify
clang-analyzer:
runs-on: ubuntu-24.04
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
env:
CC: clang
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Build third-party deps
run: |
@@ -111,7 +111,7 @@ jobs:
{ runner: ubuntu-24.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
{ runner: ubuntu-24.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
{ runner: ubuntu-24.04, os: ubuntu, flavor: release, cc: gcc, flags: -D CMAKE_BUILD_TYPE=Release -D ENABLE_TRANSLATIONS=ON },
# { runner: ubuntu-24.04-arm, os: ubuntu, flavor: arm, cc: gcc, flags: -D CMAKE_BUILD_TYPE=RelWithDebInfo },
{ runner: ubuntu-24.04-arm, os: ubuntu, flavor: arm, cc: clang, flags: -D CMAKE_BUILD_TYPE=RelWithDebInfo },
{ runner: macos-13, os: macos, flavor: intel, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: macos-15, os: macos, flavor: arm, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: ubuntu-24.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
@@ -124,12 +124,17 @@ jobs:
build: { flavor: puc-lua }
- test: oldtest
build: { flavor: tsan }
- test: unittest
build: { runner: ubuntu-24.04-arm }
- test: oldtest
build: { runner: ubuntu-24.04-arm }
runs-on: ${{ matrix.build.runner }}
timeout-minutes: 45
env:
CC: ${{ matrix.build.cc }}
NVIM_TEST_INTEG: ${{ matrix.build.flavor == 'release' && '1' || '0' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
install_flags: "--test"
@@ -201,16 +206,35 @@ jobs:
name: Show logs
run: cat $(find "$LOG_DIR" -type f)
zig-build:
runs-on: ubuntu-24.04
timeout-minutes: 45
name: build using zig build (linux)
steps:
- uses: actions/checkout@v5
- uses: mlugg/setup-zig@v2
with:
version: 0.14.1
- run: sudo apt-get install -y inotify-tools
- run: zig build test_nlua0
- run: zig build nvim && ./zig-out/bin/nvim --version
- run: zig build unittest
- run: zig build functionaltest
# `zig build nvim` uses a lua script for doctags in order to support cross-compiling
# compare with the builtin generator that they match
- run: cd runtime; ../zig-out/bin/nvim -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
- run: diff -u runtime/doc/tags zig-out/runtime/doc/tags
windows:
uses: ./.github/workflows/test_windows.yml
with-external-deps:
runs-on: ubuntu-24.04
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
env:
CC: gcc
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Install dependencies

View File

@@ -18,7 +18,7 @@ jobs:
matrix:
test: [functional, old]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: Build deps

View File

@@ -15,11 +15,11 @@ jobs:
VERSION_BRANCH: marvim/ci-version-update
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
repository: vim/vim
path: ${{ env.VIM_SOURCE_DIR }}

3
.gitignore vendored
View File

@@ -10,7 +10,8 @@ compile_commands.json
/.idea/
# Build/deps dir
/build/
/.zig-cache/
/zig-out/
/.deps/
/tmp/
/.clangd/

View File

@@ -49,6 +49,7 @@ exclude_files = {
'runtime/lua/vim/_meta/vimfn.lua',
'runtime/lua/vim/_meta/api.lua',
'runtime/lua/vim/re.lua',
'runtime/lua/uv/_meta.lua',
'runtime/lua/coxpcall.lua',
'src/nvim/eval.lua',
}

View File

@@ -5,13 +5,12 @@
},
"workspace": {
"library": [
"runtime/lua",
"${3rd}/busted/library",
"${3rd}/luv/library"
"${3rd}/busted/library"
],
"ignoreDir": [
"test",
"_vim9script.lua"
".deps",
"build",
"test"
],
"checkThirdParty": "Disable"
},

8
.stylua2.toml Normal file
View File

@@ -0,0 +1,8 @@
# Alternative settings for special snowflakes like: decorations_spec.lua, multigrid_spec.lua, etc.
column_width = 140
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Input"

View File

@@ -1,14 +1,15 @@
/build/
/.deps/
/runtime/lua/coxpcall.lua
/runtime/lua/vim/_meta
/runtime/lua/vim/re.lua
build/
.deps/
runtime/lua/coxpcall.lua
runtime/lua/uv/_meta.lua
runtime/lua/vim/_meta
runtime/lua/vim/re.lua
# These are formatted explicitly by the "formatlua2" build task.
test/functional/ui/decorations_spec.lua
test/functional/ui/float_spec.lua
test/functional/ui/multigrid_spec.lua
/test/functional/fixtures/lua/syntax_error.lua
/test/functional/legacy/030_fileformats_spec.lua
/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
/test/functional/lua/luaeval_spec.lua
test/functional/fixtures/lua/syntax_error.lua
test/functional/legacy/030_fileformats_spec.lua
test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua

View File

@@ -165,11 +165,40 @@ https://github.com/cascent/neovim-cygwin was built on Cygwin 2.9.0. Newer `libuv
mingw32-make install
```
### Windows WSL
Build Ubuntu/Debian linux binary on [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) (Windows Subsystem for Linux).
```bash
# Install build prerequisites
sudo apt-get install ninja-build gettext cmake build-essential
# Build the linux binary in WSL
make CMAKE_BUILD_TYPE=RelWithDebInfo
# Install the linux binary in WSL (with `<arch>` either `x86_64` or `arm64`)
cd build && cpack -G DEB && sudo dpkg -i nvim-linux-<arch>.deb
# Verify the installation
nvim --version && which nvim # should be debug build in /usr/bin/nvim
```
**Note**: If you encounter linker errors or segfaults during the build, Windows libraries in your PATH may be interfering. Use a clean PATH to avoid conflicts:
```bash
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" make CMAKE_BUILD_TYPE=RelWithDebInfo
```
## Localization
### Localization build
A normal build will create `.mo` files in `build/src/nvim/po`.
Translations are turned off by default. Enable by building Nvim with the CMake flag `ENABLE_TRANSLATIONS=ON`.
Doing this will create `.mo` files in `build/src/nvim/po`. Example:
```
make CMAKE_EXTRA_FLAGS="-DENABLE_TRANSLATIONS=ON"
```
* If you see `msgfmt: command not found`, you need to install [`gettext`](http://en.wikipedia.org/wiki/Gettext). On most systems, the package is just called `gettext`.
@@ -223,7 +252,7 @@ rebuild:
## Third-party dependencies
Reference the [Debian package](https://packages.debian.org/sid/source/neovim) (or alternatively, the [Homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/neovim.rb)) for the precise list of dependencies/versions.
Reference the [Debian package](https://packages.debian.org/sid/source/neovim) (or alternatively, the [Homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/n/neovim.rb)) for the precise list of dependencies/versions.
To build the bundled dependencies using CMake:
@@ -259,6 +288,29 @@ cmake --build build
- Using `ninja` is strongly recommended.
4. If treesitter parsers are not bundled, they need to be available in a `parser/` runtime directory (e.g. `/usr/share/nvim/runtime/parser/`).
### How to build static binary (on Linux)
1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking)
2. Run make passing the `STATIC_BUILD` variable: `make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"`
In case you are not using Alpine Linux you can use a container to do the build the binary:
```bash
podman run \
--rm \
-it \
-v "$PWD:/workdir" \
-w /workdir \
alpine:latest \
bash -c 'apk add build-base cmake coreutils curl gettext-tiny-dev git && make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"'
```
The resulting binary in `build/bin/nvim` will have all the dependencies statically linked:
```
build/bin/nvim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=b93fa8e678d508ac0a76a2e3da20b119105f1b2d, with debug_info, not stripped
```
#### Debian 10 (Buster) example:
```sh
@@ -294,31 +346,31 @@ Platform-specific requirements are listed below.
### Ubuntu / Debian
```sh
sudo apt-get install ninja-build gettext cmake curl build-essential
sudo apt-get install ninja-build gettext cmake curl build-essential git
```
### RHEL / Fedora
```
sudo dnf -y install ninja-build cmake gcc make gettext curl glibc-gconv-extra
sudo dnf -y install ninja-build cmake gcc make gettext curl glibc-gconv-extra git
```
### openSUSE
```
sudo zypper install ninja cmake gcc-c++ gettext-tools curl
sudo zypper install ninja cmake gcc-c++ gettext-tools curl git
```
### Arch Linux
```
sudo pacman -S base-devel cmake ninja curl
sudo pacman -S base-devel cmake ninja curl git
```
### Alpine Linux
```
apk add build-base cmake coreutils curl gettext-tiny-dev
apk add build-base cmake coreutils curl gettext-tiny-dev git
```
### Void Linux
@@ -382,7 +434,7 @@ or a specific SHA1 like `--override-input neovim-src github:neovim/neovim/89dc8f
### FreeBSD
```
sudo pkg install cmake gmake sha wget gettext curl
sudo pkg install cmake gmake sha wget gettext curl git
```
If you get an error regarding a `sha256sum` mismatch, where the actual SHA-256 hash is `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, then this is your issue (that's the `sha256sum` of an empty file).
@@ -390,7 +442,7 @@ If you get an error regarding a `sha256sum` mismatch, where the actual SHA-256 h
### OpenBSD
```sh
doas pkg_add gmake cmake curl gettext-tools
doas pkg_add gmake cmake curl gettext-tools git
```
Build can sometimes fail when using the top level `Makefile`, apparently due to some third-party component (see [#2445-comment](https://github.com/neovim/neovim/issues/2445#issuecomment-108124236)). The following instructions use CMake:
@@ -415,7 +467,7 @@ gmake
2. Install [Homebrew](http://brew.sh)
3. Install Neovim build dependencies:
```
brew install ninja cmake gettext curl
brew install ninja cmake gettext curl git
```
- **Note**: If you see Wget certificate errors (for older macOS versions less than 10.10):
```sh
@@ -433,7 +485,7 @@ gmake
2. Install [MacPorts](http://www.macports.org)
3. Install Neovim build dependencies:
```
sudo port install ninja cmake gettext
sudo port install ninja cmake gettext git
```
- **Note**: If you see Wget certificate errors (for older macOS versions less than 10.10):
```sh

View File

@@ -35,6 +35,11 @@ include(InstallHelpers)
include(PreventInTreeBuilds)
include(Util)
if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
# Auto-create a .gitignore in the specified "build" directory.
file(GENERATE OUTPUT .gitignore CONTENT "*")
endif()
#-------------------------------------------------------------------------------
# User settings
#-------------------------------------------------------------------------------
@@ -140,19 +145,19 @@ endif()
# If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 11)
set(NVIM_VERSION_MINOR 12)
set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
# API level
set(NVIM_API_LEVEL 13) # Bump this after any API/stdlib change.
set(NVIM_API_LEVEL 14) # Bump this after any API/stdlib change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE false)
set(NVIM_API_PRERELEASE true)
# We _want_ assertions in RelWithDebInfo build-type.
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "-DNDEBUG" "-DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/DNDEBUG" "/DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE " " " " CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") # Remove duplicate whitespace
endif()
@@ -236,7 +241,7 @@ set(STYLUA_DIRS runtime scripts src test contrib)
add_glob_target(
TARGET lintlua-luacheck
COMMAND $<TARGET_FILE:nvim_bin>
FLAGS -ll ${PROJECT_SOURCE_DIR}/test/lua_runner.lua ${CMAKE_BINARY_DIR}/usr luacheck -q
FLAGS -ll ${PROJECT_SOURCE_DIR}/test/lua_runner.lua ${CMAKE_BINARY_DIR}/usr/share/lua/5.1 luacheck -q
GLOB_DIRS runtime scripts src test
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
@@ -249,6 +254,16 @@ add_glob_target(
GLOB_DIRS ${STYLUA_DIRS}
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
# Special handling of some files (which are ignored in .styluaignore).
# Workaround because stylua doesn't(?) support file-specific settings.
add_custom_target(lintlua-stylua2
COMMAND ${STYLUA_PRG} --config-path "${PROJECT_SOURCE_DIR}/.stylua2.toml"
--color=always --check
"${PROJECT_SOURCE_DIR}/test/functional/ui/decorations_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/float_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/multigrid_spec.lua"
)
add_dependencies(lintlua-stylua lintlua-stylua2)
add_custom_target(lintlua)
add_dependencies(lintlua lintlua-luacheck lintlua-stylua)
@@ -262,7 +277,7 @@ add_glob_target(
TOUCH_STRATEGY PER_DIR)
add_custom_target(lintcommit
COMMAND $<TARGET_FILE:nvim_bin> -u NONE -l ${PROJECT_SOURCE_DIR}/scripts/lintcommit.lua main)
COMMAND $<TARGET_FILE:nvim_bin> --clean -l ${PROJECT_SOURCE_DIR}/scripts/lintcommit.lua main)
add_dependencies(lintcommit nvim_bin)
add_custom_target(lint)
@@ -276,7 +291,15 @@ add_glob_target(
GLOB_DIRS ${STYLUA_DIRS}
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
# Special handling of some files (which are ignored in .styluaignore).
# Workaround because stylua doesn't(?) support file-specific settings.
add_custom_target(formatlua2
COMMAND ${STYLUA_PRG} --config-path "${PROJECT_SOURCE_DIR}/.stylua2.toml"
"${PROJECT_SOURCE_DIR}/test/functional/ui/decorations_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/float_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/multigrid_spec.lua"
)
add_dependencies(formatlua formatlua2)
add_custom_target(format)
add_dependencies(format formatc formatlua)
@@ -323,13 +346,13 @@ else()
add_custom_target(lua_dev_deps)
endif()
if (CMAKE_SYSTEM_PROCESSOR MATCHES arm64)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch")
set(LUALS_ARCH arm64)
else()
set(LUALS_ARCH x64)
endif()
set(LUALS_VERSION 3.13.9)
set(LUALS_VERSION 3.15.0)
set(LUALS "lua-language-server-${LUALS_VERSION}-${CMAKE_SYSTEM_NAME}-${LUALS_ARCH}")
set(LUALS_TARBALL ${LUALS}.tar.gz)
set(LUALS_URL https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/${LUALS_TARBALL})

View File

@@ -273,7 +273,7 @@ If you need to modify or debug the documentation flow, these are the main files:
runtime/lua/vim/* => runtime/doc/lua.txt
runtime/lua/vim/lsp/ => runtime/doc/lsp.txt
src/nvim/api/* => runtime/doc/api.txt
src/nvim/eval.lua => runtime/doc/builtin.txt
src/nvim/eval.lua => runtime/doc/vimfn.txt
src/nvim/options.lua => runtime/doc/options.txt
```
@@ -299,7 +299,7 @@ types, etc. See [:help dev-lua-doc][dev-lua-doc].
- If possible, add type information (`table`, `string`, `number`, ...). Multiple valid types are separated by a bar (`string|table`). Indicate optional parameters via `type|nil`.
- If a function in your Lua module should _not_ be documented, add `@nodoc`.
- If the function is internal or otherwise non-public add `@private`.
- Private functions usually should be underscore-prefixed (named "_foo", not "foo").
- Private functions usually should be underscore-prefixed (named "_foo", not "foo"). Prefixing with an underscore implies `@nodoc`.
- Mark deprecated functions with `@deprecated`.
Third-party dependencies

View File

@@ -62,15 +62,17 @@ Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim
- Add the `bin` folder (e.g. `C:\Program Files\nvim\bin`) to your PATH.
- This makes it easy to run `nvim` from anywhere.
- If `:set spell` does not work, create the `C:/Users/foo/AppData/Local/nvim/site/spell` folder.
- If `:set spell` does not work, create the `%LOCALAPPDATA%/nvim-data/site/spell` folder.
You can then copy your spell files over (for English, located
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.spl) and
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.sug));
- For Python plugins you need the `pynvim` module. "Virtual envs" are recommended. After activating the virtual env do `pip install pynvim` (in *both*). Edit your `init.vim` so that it contains the path to the env's Python executable:
```vim
let g:python3_host_prog='C:/Users/foo/Envs/neovim3/Scripts/python.exe'
- For Python plugins you need the `pynvim` module. Installation via uv
(https://docs.astral.sh/uv/) is recommended; the `--upgrade` switch ensures
installation of the latest version:
```
- Run `:checkhealth` and read `:help provider-python`.
uv tool install --upgrade pynvim
```
- Run `:checkhealth` and read `:help provider-python` for more details.
- **init.vim ("vimrc"):** If you already have Vim installed you can copy `%userprofile%\_vimrc` to `%userprofile%\AppData\Local\nvim\init.vim` to use your Vim config with Neovim.

View File

@@ -289,3 +289,8 @@ IV) It is not allowed to remove this license from the distribution of the Vim
license for previous Vim releases instead of the license that they came
with, at your option.
====
In addition, different license conditions may apply to some runtime files
included with Vim; these will be specified in the header of each respective
file.

View File

@@ -81,7 +81,7 @@ When a (non-experimental) feature is slated to be removed it should:
as described for Lua features.
- `vim.deprecate(…, 'x.y.z')` where major version `x` is greater than the
current Nvim major version, is always treated as _soft_ deprecation.
2. Be _hard_ deprecated in a following a release in which it was soft deprecated.
2. Be _hard_ deprecated in a release following the release in which it was soft deprecated.
- Use of the deprecated feature will still work but should issue a warning.
- Features implemented in C will need bespoke implementations to communicate
to users that the feature is deprecated.
@@ -127,7 +127,9 @@ Some can be auto-bumped by `scripts/bump_deps.lua`.
* [LuaJIT](https://github.com/LuaJIT/LuaJIT)
* [Lua](https://www.lua.org/download.html)
* [Luv](https://github.com/luvit/luv)
* When bumping, also sync [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs.md).
* When bumping, also sync
- [our bundled meta file](https://github.com/neovim/neovim/blob/master/runtime/lua/uv/_meta.lua) with [the upstream meta file](https://github.com/luvit/luv/blob/master/docs/meta.lua);
- [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs/docs.md).
* [gettext](https://ftp.gnu.org/pub/gnu/gettext/)
* [libiconv](https://ftp.gnu.org/pub/gnu/libiconv)
* [libuv](https://github.com/libuv/libuv)
@@ -152,7 +154,7 @@ These dependencies are "vendored" (inlined), we must update the sources manually
* `src/nvim/tui/terminfo_defs.h`: terminfo definitions
* Run `scripts/update_terminfo.sh` to update these definitions.
* `runtime/lua/vim/lsp/_meta/protocol.lua`: LSP specification
* Run `scripts/gen_lsp.lua` to update.
* Run `src/gen/gen_lsp.lua` to update.
* `runtime/lua/vim/_meta/lpeg.lua`: LPeg definitions.
* Refer to [`LuaCATS/lpeg`](https://github.com/LuaCATS/lpeg) for updates.
* Update the git SHA revision from which the documentation was taken.

View File

@@ -182,3 +182,9 @@ appimage-%:
bash scripts/genappimage.sh $*
.PHONY: test clean distclean nvim libnvim cmake deps install appimage checkprefix benchmark $(FORMAT) $(LINT) $(TEST)
.PHONY: emmylua-check
emmylua-check:
-emmylua_check runtime/lua \
--config .luarc.json \
--config .emmyrc.json

462
build.zig Normal file
View File

@@ -0,0 +1,462 @@
const std = @import("std");
const LazyPath = std.Build.LazyPath;
const build_lua = @import("src/build_lua.zig");
const gen = @import("src/gen/gen_steps.zig");
const runtime = @import("runtime/gen_runtime.zig");
const tests = @import("test/run_tests.zig");
const version = struct {
const major = 0;
const minor = 12;
const patch = 0;
const prerelease = "-dev";
const api_level = 14;
const api_level_compat = 0;
const api_prerelease = true;
};
// TODO(bfredl): this is for an upstream issue
pub fn lazyArtifact(d: *std.Build.Dependency, name: []const u8) ?*std.Build.Step.Compile {
var found: ?*std.Build.Step.Compile = null;
for (d.builder.install_tls.step.dependencies.items) |dep_step| {
const inst = dep_step.cast(std.Build.Step.InstallArtifact) orelse continue;
if (std.mem.eql(u8, inst.artifact.name, name)) {
if (found != null) std.debug.panic("artifact name '{s}' is ambiguous", .{name});
found = inst.artifact;
}
}
return found;
}
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const t = target.result;
const os_tag = t.os.tag;
const is_windows = (os_tag == .windows);
const is_linux = (os_tag == .linux);
const is_darwin = os_tag.isDarwin();
const modern_unix = is_darwin or os_tag.isBSD() or is_linux;
const cross_compiling = b.option(bool, "cross", "cross compile") orelse false;
// TODO(bfredl): option to set nlua0 target explicitly when cross compiling?
const target_host = if (cross_compiling) b.graph.host else target;
const optimize_host = .ReleaseSafe;
// puc lua 5.1 is not ReleaseSafe "safe"
const optimize_lua = if (optimize == .Debug or optimize == .ReleaseSafe) .ReleaseSmall else optimize;
const arch = t.cpu.arch;
const default_luajit = (is_linux and arch == .x86_64) or (is_darwin and arch == .aarch64);
const use_luajit = b.option(bool, "luajit", "use luajit") orelse default_luajit;
const host_use_luajit = if (cross_compiling) false else use_luajit;
const E = enum { luajit, lua51 };
const ziglua = b.dependency("zlua", .{
.target = target,
.optimize = optimize_lua,
.lang = if (use_luajit) E.luajit else E.lua51,
.shared = false,
});
const ziglua_host = if (cross_compiling) b.dependency("zlua", .{
.target = target_host,
.optimize = optimize_lua,
.lang = if (host_use_luajit) E.luajit else E.lua51,
.shared = false,
}) else ziglua;
const lpeg = b.dependency("lpeg", .{});
const iconv = if (is_windows or is_darwin) b.lazyDependency("libiconv", .{ .target = target, .optimize = optimize }) else null;
// this is currently not necessary, as ziglua currently doesn't use lazy dependencies
// to circumvent ziglua.artifact() failing in a bad way.
const lua = lazyArtifact(ziglua, "lua") orelse return;
if (cross_compiling) {
_ = lazyArtifact(ziglua_host, "lua") orelse return;
}
// const lua = ziglua.artifact("lua");
const libuv_dep = b.dependency("libuv", .{ .target = target, .optimize = optimize });
const libuv = libuv_dep.artifact("uv");
const libluv = try build_lua.build_libluv(b, target, optimize, lua, libuv);
const libluv_host = if (cross_compiling) libluv_host: {
const libuv_dep_host = b.dependency("libuv", .{ .target = target_host, .optimize = optimize_host });
const libuv_host = libuv_dep_host.artifact("uv");
break :libluv_host try build_lua.build_libluv(b, target_host, optimize_host, ziglua_host.artifact("lua"), libuv_host);
} else libluv;
const utf8proc = b.dependency("utf8proc", .{ .target = target, .optimize = optimize });
const unibilium = b.dependency("unibilium", .{ .target = target, .optimize = optimize });
// TODO(bfredl): fix upstream bugs with UBSAN
const treesitter = b.dependency("treesitter", .{ .target = target, .optimize = .ReleaseFast });
const nlua0 = build_lua.build_nlua0(b, target_host, optimize_host, host_use_luajit, ziglua_host, lpeg, libluv_host);
// usual caveat emptor: might need to force a rebuild if the only change is
// addition of new .c files, as those are not seen by any hash
const subdirs = [_][]const u8{
"", // src/nvim itself
"os/",
"api/",
"api/private/",
"msgpack_rpc/",
"tui/",
"tui/termkey/",
"event/",
"eval/",
"lib/",
"lua/",
"viml/",
"viml/parser/",
"vterm/",
};
// source names _relative_ src/nvim/, not including other src/ subdircs
var nvim_sources = try std.ArrayList(gen.SourceItem).initCapacity(b.allocator, 100);
var nvim_headers = try std.ArrayList([]u8).initCapacity(b.allocator, 100);
// both source headers and the {module}.h.generated.h files
var api_headers = try std.ArrayList(std.Build.LazyPath).initCapacity(b.allocator, 10);
// TODO(bfredl): these should just become subdirs..
const windows_only = [_][]const u8{ "pty_proc_win.c", "pty_proc_win.h", "pty_conpty_win.c", "pty_conpty_win.h", "os_win_console.c", "win_defs.h" };
const unix_only = [_][]const u8{ "unix_defs.h", "pty_proc_unix.c", "pty_proc_unix.h" };
const exclude_list = if (is_windows) &unix_only else &windows_only;
const src_dir = b.build_root.handle;
for (subdirs) |s| {
var dir = try src_dir.openDir(b.fmt("src/nvim/{s}", .{s}), .{ .iterate = true });
defer dir.close();
var it = dir.iterateAssumeFirstIteration();
const api_export = std.mem.eql(u8, s, "api/");
const os_check = std.mem.eql(u8, s, "os/");
entries: while (try it.next()) |entry| {
if (entry.name.len < 3) continue;
if (entry.name[0] < 'a' or entry.name[0] > 'z') continue;
if (os_check) {
for (exclude_list) |name| {
if (std.mem.eql(u8, name, entry.name)) {
continue :entries;
}
}
}
if (std.mem.eql(u8, ".c", entry.name[entry.name.len - 2 ..])) {
try nvim_sources.append(.{ .name = b.fmt("{s}{s}", .{ s, entry.name }), .api_export = api_export });
}
if (std.mem.eql(u8, ".h", entry.name[entry.name.len - 2 ..])) {
try nvim_headers.append(b.fmt("{s}{s}", .{ s, entry.name }));
if (api_export and !std.mem.eql(u8, "ui_events.in.h", entry.name)) {
try api_headers.append(b.path(b.fmt("src/nvim/{s}{s}", .{ s, entry.name })));
}
}
}
}
const support_unittests = use_luajit;
const gen_config = b.addWriteFiles();
const version_lua = gen_config.add("nvim_version.lua", lua_version_info(b));
var config_str = b.fmt("zig build -Doptimize={s}", .{@tagName(optimize)});
if (cross_compiling) {
config_str = b.fmt("{s} -Dcross -Dtarget={s} (host: {s})", .{ config_str, try t.linuxTriple(b.allocator), try b.graph.host.result.linuxTriple(b.allocator) });
}
const versiondef_step = b.addConfigHeader(.{ .style = .{ .cmake = b.path("cmake.config/versiondef.h.in") } }, .{
.NVIM_VERSION_MAJOR = version.major,
.NVIM_VERSION_MINOR = version.minor,
.NVIM_VERSION_PATCH = version.patch,
.NVIM_VERSION_PRERELEASE = version.prerelease,
.NVIM_VERSION_MEDIUM = "",
.VERSION_STRING = "TODO", // TODO(bfredl): not sure what to put here. summary already in "config_str"
.CONFIG = config_str,
});
_ = gen_config.addCopyFile(versiondef_step.getOutput(), "auto/versiondef.h"); // run_preprocessor() workaronnd
const ptrwidth = t.ptrBitWidth() / 8;
const sysconfig_step = b.addConfigHeader(.{ .style = .{ .cmake = b.path("cmake.config/config.h.in") } }, .{
.SIZEOF_INT = t.cTypeByteSize(.int),
.SIZEOF_INTMAX_T = t.cTypeByteSize(.longlong), // TODO
.SIZEOF_LONG = t.cTypeByteSize(.long),
.SIZEOF_SIZE_T = ptrwidth,
.SIZEOF_VOID_PTR = ptrwidth,
.PROJECT_NAME = "nvim",
.HAVE__NSGETENVIRON = is_darwin,
.HAVE_FD_CLOEXEC = modern_unix,
.HAVE_FSEEKO = modern_unix,
.HAVE_LANGINFO_H = modern_unix,
.HAVE_NL_LANGINFO_CODESET = modern_unix,
.HAVE_NL_MSG_CAT_CNTR = t.isGnuLibC(),
.HAVE_PWD_FUNCS = modern_unix,
.HAVE_READLINK = modern_unix,
.HAVE_STRNLEN = modern_unix,
.HAVE_STRCASECMP = modern_unix,
.HAVE_STRINGS_H = modern_unix,
.HAVE_STRNCASECMP = modern_unix,
.HAVE_STRPTIME = modern_unix,
.HAVE_XATTR = is_linux,
.HAVE_SYS_SDT_H = false,
.HAVE_SYS_UTSNAME_H = modern_unix,
.HAVE_SYS_WAIT_H = false, // unused
.HAVE_TERMIOS_H = modern_unix,
.HAVE_WORKING_LIBINTL = t.isGnuLibC(),
.UNIX = modern_unix,
.CASE_INSENSITIVE_FILENAME = is_darwin or is_windows,
.HAVE_SYS_UIO_H = modern_unix,
.HAVE_READV = modern_unix,
.HAVE_DIRFD_AND_FLOCK = modern_unix,
.HAVE_FORKPTY = modern_unix and !is_darwin, // also on Darwin but we lack the headers :(
.HAVE_BE64TOH = modern_unix and !is_darwin,
.ORDER_BIG_ENDIAN = t.cpu.arch.endian() == .big,
.ENDIAN_INCLUDE_FILE = "endian.h",
.HAVE_EXECINFO_BACKTRACE = modern_unix and !t.isMuslLibC(),
.HAVE_BUILTIN_ADD_OVERFLOW = true,
.HAVE_WIMPLICIT_FALLTHROUGH_FLAG = true,
.HAVE_BITSCANFORWARD64 = null,
.VTERM_TEST_FILE = "test/vterm_test_output", // TODO(bfredl): revisit when porting libvterm tests
});
_ = gen_config.addCopyFile(sysconfig_step.getOutput(), "auto/config.h"); // run_preprocessor() workaronnd
_ = gen_config.add("auto/pathdef.h", b.fmt(
\\char *default_vim_dir = "/usr/local/share/nvim";
\\char *default_vimruntime_dir = "";
\\char *default_lib_dir = "/usr/local/lib/nvim";
, .{}));
// TODO(bfredl): include git version when available
const medium = b.fmt("v{}.{}.{}{s}+zig", .{ version.major, version.minor, version.patch, version.prerelease });
const versiondef_git = gen_config.add("auto/versiondef_git.h", b.fmt(
\\#define NVIM_VERSION_MEDIUM "{s}"
\\#define NVIM_VERSION_BUILD "???"
\\
, .{medium}));
// TODO(zig): using getEmittedIncludeTree() is ugly af. we want unittests
// to reuse the std.build.Module include_path thing
const unittest_include_path = [_]LazyPath{
b.path("src/"),
gen_config.getDirectory(),
lua.getEmittedIncludeTree(),
libuv.getEmittedIncludeTree(),
libluv.getEmittedIncludeTree(),
utf8proc.artifact("utf8proc").getEmittedIncludeTree(),
unibilium.artifact("unibilium").getEmittedIncludeTree(),
treesitter.artifact("tree-sitter").getEmittedIncludeTree(),
if (iconv) |dep| dep.artifact("iconv").getEmittedIncludeTree() else b.path("UNUSED_PATH/"),
};
const gen_headers, const funcs_data = try gen.nvim_gen_sources(b, nlua0, &nvim_sources, &nvim_headers, &api_headers, versiondef_git, version_lua);
const test_config_step = b.addWriteFiles();
_ = test_config_step.add("test/cmakeconfig/paths.lua", try test_config(b));
const test_gen_step = b.step("gen_headers", "debug: output generated headers");
const config_install = b.addInstallDirectory(.{ .source_dir = gen_config.getDirectory(), .install_dir = .prefix, .install_subdir = "config/" });
test_gen_step.dependOn(&config_install.step);
test_gen_step.dependOn(&b.addInstallDirectory(.{ .source_dir = gen_headers.getDirectory(), .install_dir = .prefix, .install_subdir = "headers/" }).step);
const nvim_exe = b.addExecutable(.{
.name = "nvim",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
nvim_exe.rdynamic = true; // -E
nvim_exe.linkLibrary(lua);
nvim_exe.linkLibrary(libuv);
nvim_exe.linkLibrary(libluv);
if (iconv) |dep| nvim_exe.linkLibrary(dep.artifact("iconv"));
nvim_exe.linkLibrary(utf8proc.artifact("utf8proc"));
nvim_exe.linkLibrary(unibilium.artifact("unibilium"));
nvim_exe.linkLibrary(treesitter.artifact("tree-sitter"));
if (is_windows) {
nvim_exe.linkSystemLibrary("netapi32");
}
nvim_exe.addIncludePath(b.path("src"));
nvim_exe.addIncludePath(gen_config.getDirectory());
nvim_exe.addIncludePath(gen_headers.getDirectory());
build_lua.add_lua_modules(nvim_exe.root_module, lpeg, use_luajit, false);
var unit_test_sources = try std.ArrayList([]u8).initCapacity(b.allocator, 10);
if (support_unittests) {
var unit_test_fixtures = try src_dir.openDir("test/unit/fixtures/", .{ .iterate = true });
defer unit_test_fixtures.close();
var it = unit_test_fixtures.iterateAssumeFirstIteration();
while (try it.next()) |entry| {
if (entry.name.len < 3) continue;
if (std.mem.eql(u8, ".c", entry.name[entry.name.len - 2 ..])) {
try unit_test_sources.append(b.fmt("test/unit/fixtures/{s}", .{entry.name}));
}
}
}
const src_paths = try b.allocator.alloc([]u8, nvim_sources.items.len + unit_test_sources.items.len);
for (nvim_sources.items, 0..) |s, i| {
src_paths[i] = b.fmt("src/nvim/{s}", .{s.name});
}
@memcpy(src_paths[nvim_sources.items.len..], unit_test_sources.items);
const flags = [_][]const u8{
"-std=gnu99",
"-DZIG_BUILD",
"-D_GNU_SOURCE",
if (support_unittests) "-DUNIT_TESTING" else "",
if (use_luajit) "" else "-DNVIM_VENDOR_BIT",
if (is_windows) "-DMSWIN" else "",
if (is_windows) "-DWIN32_LEAN_AND_MEAN" else "",
if (is_windows) "-DUTF8PROC_STATIC" else "",
};
nvim_exe.addCSourceFiles(.{ .files = src_paths, .flags = &flags });
nvim_exe.addCSourceFiles(.{ .files = &.{
"src/xdiff/xdiffi.c",
"src/xdiff/xemit.c",
"src/xdiff/xhistogram.c",
"src/xdiff/xpatience.c",
"src/xdiff/xprepare.c",
"src/xdiff/xutils.c",
"src/cjson/lua_cjson.c",
"src/cjson/fpconv.c",
"src/cjson/strbuf.c",
}, .flags = &flags });
const nvim_exe_step = b.step("nvim_bin", "only the binary (not a fully working install!)");
const nvim_exe_install = b.addInstallArtifact(nvim_exe, .{});
nvim_exe_step.dependOn(&nvim_exe_install.step);
const gen_runtime = try runtime.nvim_gen_runtime(b, nlua0, funcs_data);
const runtime_install = b.addInstallDirectory(.{ .source_dir = gen_runtime.getDirectory(), .install_dir = .prefix, .install_subdir = "runtime/" });
const nvim = b.step("nvim", "build the editor");
nvim.dependOn(&nvim_exe_install.step);
nvim.dependOn(&runtime_install.step);
const lua_dev_deps = b.dependency("lua_dev_deps", .{});
const test_deps = b.step("test_deps", "test prerequisites");
test_deps.dependOn(&nvim_exe_install.step);
test_deps.dependOn(&runtime_install.step);
test_deps.dependOn(test_fixture(b, "shell-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "tty-test", libuv, target, optimize));
test_deps.dependOn(test_fixture(b, "pwsh-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "printargs-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "printenv-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "streams-test", libuv, target, optimize));
const parser_c = b.dependency("treesitter_c", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "c", parser_c.path("."), false, target, optimize));
const parser_markdown = b.dependency("treesitter_markdown", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "markdown", parser_markdown.path("tree-sitter-markdown/"), true, target, optimize));
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize));
const parser_vim = b.dependency("treesitter_vim", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "vim", parser_vim.path("."), true, target, optimize));
const parser_vimdoc = b.dependency("treesitter_vimdoc", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "vimdoc", parser_vimdoc.path("."), false, target, optimize));
const parser_lua = b.dependency("treesitter_lua", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "lua", parser_lua.path("."), true, target, optimize));
const parser_query = b.dependency("treesitter_query", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "query", parser_query.path("."), false, target, optimize));
const unit_headers: ?[]const LazyPath = if (support_unittests) &(unittest_include_path ++ .{gen_headers.getDirectory()}) else null;
try tests.test_steps(b, nvim_exe, test_deps, lua_dev_deps.path("."), test_config_step.getDirectory(), unit_headers);
}
pub fn test_fixture(
b: *std.Build,
name: []const u8,
libuv: ?*std.Build.Step.Compile,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) *std.Build.Step {
const fixture = b.addExecutable(.{
.name = name,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
const source = if (std.mem.eql(u8, name, "pwsh-test")) "shell-test" else name;
fixture.addCSourceFile(.{ .file = b.path(b.fmt("./test/functional/fixtures/{s}.c", .{source})) });
fixture.linkLibC();
if (libuv) |uv| fixture.linkLibrary(uv);
return &b.addInstallArtifact(fixture, .{}).step;
}
pub fn add_ts_parser(
b: *std.Build,
name: []const u8,
parser_dir: LazyPath,
scanner: bool,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) *std.Build.Step {
const parser = b.addLibrary(.{
.name = name,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .dynamic,
});
parser.addCSourceFile(.{ .file = parser_dir.path(b, "src/parser.c") });
if (scanner) parser.addCSourceFile(.{ .file = parser_dir.path(b, "src/scanner.c") });
parser.addIncludePath(parser_dir.path(b, "src"));
parser.linkLibC();
const parser_install = b.addInstallArtifact(parser, .{ .dest_sub_path = b.fmt("parser/{s}.so", .{name}) });
return &parser_install.step;
}
pub fn lua_version_info(b: *std.Build) []u8 {
const v = version;
return b.fmt(
\\return {{
\\ {{"major", {}}},
\\ {{"minor", {}}},
\\ {{"patch", {}}},
\\ {{"prerelease", {}}},
\\ {{"api_level", {}}},
\\ {{"api_compatible", {}}},
\\ {{"api_prerelease", {}}},
\\}}
, .{ v.major, v.minor, v.patch, v.prerelease.len > 0, v.api_level, v.api_level_compat, v.api_prerelease });
}
pub fn test_config(b: *std.Build) ![]u8 {
var buf: [std.fs.max_path_bytes]u8 = undefined;
const src_path = try b.build_root.handle.realpath(".", &buf);
// we don't use test/cmakeconfig/paths.lua.in because it contains cmake specific logic
return b.fmt(
\\local M = {{}}
\\
\\M.apple_sysroot = ""
\\M.translations_enabled = "$ENABLE_TRANSLATIONS" == "ON"
\\M.is_asan = "$ENABLE_ASAN_UBSAN" == "ON"
\\M.is_zig_build = true
\\M.vterm_test_file = "test/vterm_test_output"
\\M.test_build_dir = "{[bin_dir]s}" -- bull
\\M.test_source_path = "{[src_path]s}"
\\M.test_lua_prg = ""
\\M.test_luajit_prg = ""
\\ -- include path passed on the cmdline, see test/lua_runner.lua
\\M.include_paths = _G.c_include_path or {{}}
\\
\\return M
, .{ .bin_dir = b.install_path, .src_path = src_path });
}

72
build.zig.zon Normal file
View File

@@ -0,0 +1,72 @@
.{
.name = .neovim,
.fingerprint = 0x66eb090879307a38,
.version = "0.12.0",
.minimum_zig_version = "0.14.0",
.dependencies = .{
.zlua = .{
.url = "git+https://github.com/natecraddock/ziglua#6889b2d90ee6ae96810a9f04ec7c62d9aa91d088",
.hash = "zlua-0.1.0-hGRpCxctBQDEQgDArJ0Kc4RDIsD-Hw3pw9pPPw_kGmmY",
},
.lpeg = .{
.url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz",
.hash = "N-V-__8AAMnaAwCEutreuREG3QayBVEZqUTDQFY1Nsrv2OIt",
},
.luv = .{
.url = "git+https://github.com/luvit/luv?ref=1.51.0-1#4c9fbc6cf6f3338bb0e0426710cf885ee557b540",
.hash = "N-V-__8AAMlNDwCY07jUoMiq3iORXdZy0uFWKiHsy8MaDBJA",
},
.lua_compat53 = .{
.url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.13.tar.gz",
.hash = "N-V-__8AADi-AwDnVoXwDCQvv2wcYOmN0bJLqZ44J3lwoQY2",
},
.treesitter = .{
.url = "git+https://github.com/tree-sitter/tree-sitter#d87921bb9c39b0b06c811f2082f9a9991cdca027",
.hash = "tree_sitter-0.26.0-Tw2sRxO7CwC0NyDrSygSi7UXRHMNUFEF8GRq6dK81lRF",
},
.libuv = .{
.url = "git+https://github.com/allyourcodebase/libuv#a2dfd385bd2a00d6d290fda85a40a55a9d6cffc5",
.hash = "libuv-1.51.0-htqqv6liAADxBLIBCZT-qUh_3nRRwtNYsOFQOUmrd_sx",
},
.utf8proc = .{ .path = "./deps/utf8proc/" },
.unibilium = .{ .path = "./deps/unibilium/" },
.libiconv = .{
.url = "git+https://github.com/allyourcodebase/libiconv#9def4c8a1743380e85bcedb80f2c15b455e236f3",
.hash = "libiconv-1.18.0-p9sJwWnqAACzVYeWgXB5r5lOQ74XwTPlptixV0JPRO28",
.lazy = true,
},
.lua_dev_deps = .{
.url = "https://github.com/neovim/deps/raw/06ef2b58b0876f8de1a3f5a710473dcd7afff251/opt/lua-dev-deps.tar.gz",
.hash = "N-V-__8AAGevEQCHAkCozca5AIdN9DFc3Luf3g3r2AcbyOrm",
},
.treesitter_c = .{
.url = "git+https://github.com/tree-sitter/tree-sitter-c?ref=v0.24.1#7fa1be1b694b6e763686793d97da01f36a0e5c12",
.hash = "N-V-__8AANxPSABzw3WBTSH_YkwaGAfrK6PBqAMqQedkDDim",
},
.treesitter_markdown = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-markdown?ref=v0.5.0#afaa4138517363362f54c89330c9d79391e81168",
.hash = "N-V-__8AAIIZUwD3CGdyI2DiHu7Suj2jIF_EAVlM6REFGwju",
},
.treesitter_lua = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-lua?ref=v0.4.0#4569d1c361129e71a205b94a05e158bd71b1709f",
.hash = "N-V-__8AAEF5CABqSL9zqc03aQsT6Nni54ZCcL98pnuDL2D3",
},
.treesitter_vim = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-vim?ref=v0.7.0#3dd4747082d1b717b8978211c06ef7b6cd16125b",
.hash = "N-V-__8AAMArVAB4uo2wg2XRs8HBviQ4Pq366cC_iRolX4Vc",
},
.treesitter_vimdoc = .{
.url = "git+https://github.com/neovim/tree-sitter-vimdoc?ref=v4.0.0#9f6191a98702edc1084245abd5523279d4b681fb",
.hash = "N-V-__8AAI4YCgD7OqxCEAmz2RqT_ohl6eA4F0fGMtLIe7nb",
},
.treesitter_query = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-query?ref=v0.6.2#8a43889f89fd0667289936341bff3a77bafade17",
.hash = "N-V-__8AAARLBACBLGiXGFTijEzLv8AwiqT_kJpmVjir1BgX",
},
},
.paths = .{
// TODO(bfredl): explicitly list the subdirs which actually are used
"",
},
}

View File

@@ -12,6 +12,10 @@
#endif
#define NVIM_VERSION_CFLAGS "${VERSION_STRING}"
#define NVIM_VERSION_BUILD_TYPE "$<CONFIG>"
#ifdef ZIG_BUILD
# define NVIM_VERSION_BUILD_TYPE "${CONFIG}"
#else
# define NVIM_VERSION_BUILD_TYPE "$<CONFIG>"
#endif
#endif // AUTO_VERSIONDEF_H

View File

@@ -73,7 +73,7 @@ if(HAS_OG_FLAG)
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif()
set(DEPS_INCLUDE_FLAGS "-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
set(DEPS_INCLUDE_FLAGS "-I\"${DEPS_INSTALL_DIR}/include\" -I\"${DEPS_INSTALL_DIR}/include/luajit-2.1\"")
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),
# fall back to local system version. Needs to be done here and in top-level CMakeLists.txt.
@@ -96,10 +96,10 @@ else()
find_package(Lua 5.1 EXACT)
if(LUAJIT_FOUND)
set(LUA_ENGINE LuaJit)
string(APPEND DEPS_INCLUDE_FLAGS " -I${LUAJIT_INCLUDE_DIR}")
string(APPEND DEPS_INCLUDE_FLAGS " -I\"${LUAJIT_INCLUDE_DIR}\"")
elseif(LUA_FOUND)
set(LUA_ENGINE Lua)
string(APPEND DEPS_INCLUDE_FLAGS " -I${LUA_INCLUDE_DIR}")
string(APPEND DEPS_INCLUDE_FLAGS " -I\"${LUA_INCLUDE_DIR}\"")
else()
message(FATAL_ERROR "Could not find system lua or luajit")
endif()

View File

@@ -42,7 +42,7 @@ if(APPLE)
endif()
if(UNIX)
BuildLuaJit(INSTALL_COMMAND ${BUILDCMD_UNIX}
BuildLuajit(INSTALL_COMMAND ${BUILDCMD_UNIX}
CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR}
${DEPLOYMENT_TARGET} install)
@@ -53,7 +53,7 @@ elseif(MINGW)
else()
set(LUAJIT_MAKE_PRG ${CMAKE_MAKE_PROGRAM})
endif()
BuildLuaJit(BUILD_COMMAND ${LUAJIT_MAKE_PRG} CC=${DEPS_C_COMPILER}
BuildLuajit(BUILD_COMMAND ${LUAJIT_MAKE_PRG} CC=${DEPS_C_COMPILER}
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS+=-DLUA_USE_APICHECK
CFLAGS+=-funwind-tables
@@ -75,7 +75,7 @@ elseif(MINGW)
)
elseif(MSVC)
BuildLuaJit(
BuildLuajit(
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir ${DEPS_BUILD_DIR}/src/luajit/src ${DEPS_BUILD_DIR}/src/luajit/src/msvcbuild.bat
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/luajit.exe ${DEPS_BIN_DIR}

View File

@@ -7,5 +7,6 @@ ExternalProject_Add(wasmtime
-D WASMTIME_FASTEST_RUNTIME=ON # build with full LTO
-D WASMTIME_DISABLE_ALL_FEATURES=ON # don't need all that crap...
-D WASMTIME_FEATURE_CRANELIFT=ON # ...except this one (compiles wasm to platform code)
-D WASMTIME_FEATURE_GC_DRC=ON # ...and this one (needed by ts to create engines)
USES_TERMINAL_BUILD TRUE
${EXTERNALPROJECT_OPTIONS})

View File

@@ -1,8 +1,8 @@
LIBUV_URL https://github.com/libuv/libuv/archive/v1.50.0.tar.gz
LIBUV_SHA256 b1ec56444ee3f1e10c8bd3eed16ba47016ed0b94fe42137435aaf2e0bd574579
LIBUV_URL https://github.com/libuv/libuv/archive/v1.51.0.tar.gz
LIBUV_SHA256 27e55cf7083913bfb6826ca78cde9de7647cded648d35f24163f2d31bb9f51cd
LUAJIT_URL https://github.com/luajit/luajit/archive/538a82133ad6fddfd0ca64de167c4aca3bc1a2da.tar.gz
LUAJIT_SHA256 7acbc36be8f21072422eb9a5e5fc468d0eaa55bec1b70260d651e845684621e2
LUAJIT_URL https://github.com/luajit/luajit/archive/871db2c84ecefd70a850e03a6c340214a81739f0.tar.gz
LUAJIT_SHA256 ab3f16d82df6946543565cfb0d2810d387d79a3a43e0431695b03466188e2680
LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz
LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
@@ -10,8 +10,8 @@ LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
UNIBILIUM_URL https://github.com/neovim/unibilium/archive/v2.1.2.tar.gz
UNIBILIUM_SHA256 370ecb07fbbc20d91d1b350c55f1c806b06bf86797e164081ccc977fc9b3af7a
LUV_URL https://github.com/luvit/luv/archive/1.50.0-1.tar.gz
LUV_SHA256 bb4f0570571e40c1d2a7644f6f9c1309a6ccdb19bf4d397e8d7bfd0c6b88e613
LUV_URL https://github.com/luvit/luv/archive/1.51.0-1.tar.gz
LUV_SHA256 d4a11178ae8e16ba5886799ea91905dd9b0b479c75aebd67866d37373e41526f
LPEG_URL https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz
LPEG_SHA256 4b155d67d2246c1ffa7ad7bc466c1ea899bbc40fef0257cc9c03cecbaed4352a
@@ -34,25 +34,25 @@ LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313
UTF8PROC_URL https://github.com/JuliaStrings/utf8proc/archive/v2.10.0.tar.gz
UTF8PROC_SHA256 6f4f1b639daa6dca9f80bc5db1233e9cbaa31a67790887106160b33ef743f136
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.23.4.tar.gz
TREESITTER_C_SHA256 b66c5043e26d84e5f17a059af71b157bcf202221069ed220aa1696d7d1d28a7a
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.3.0.tar.gz
TREESITTER_LUA_SHA256 a34cc70abfd8d2d4b0fabf01403ea05f848e1a4bc37d8a4bfea7164657b35d31
TREESITTER_VIM_URL https://github.com/tree-sitter-grammars/tree-sitter-vim/archive/v0.5.0.tar.gz
TREESITTER_VIM_SHA256 90019d12d2da0751c027124f27f5335babf069a050457adaed53693b5e9cf10a
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v3.0.1.tar.gz
TREESITTER_VIMDOC_SHA256 76b65e5bee9ff78eb21256619b1995aac4d80f252c19e1c710a4839481ded09e
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.5.1.tar.gz
TREESITTER_QUERY_SHA256 fe8c712880a529d454347cd4c58336ac2db22243bae5055bdb5844fb3ea56192
TREESITTER_MARKDOWN_URL https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/v0.4.1.tar.gz
TREESITTER_MARKDOWN_SHA256 e0fdb2dca1eb3063940122e1475c9c2b069062a638c95939e374c5427eddee9f
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.25.3.tar.gz
TREESITTER_SHA256 862fac52653bc7bc9d2cd0630483e6bdf3d02bcd23da956ca32663c4798a93e3
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.24.1.tar.gz
TREESITTER_C_SHA256 25dd4bb3dec770769a407e0fc803f424ce02c494a56ce95fedc525316dcf9b48
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.4.0.tar.gz
TREESITTER_LUA_SHA256 b0977aced4a63bb75f26725787e047b8f5f4a092712c840ea7070765d4049559
TREESITTER_VIM_URL https://github.com/tree-sitter-grammars/tree-sitter-vim/archive/v0.7.0.tar.gz
TREESITTER_VIM_SHA256 44eabc31127c4feacda19f2a05a5788272128ff561ce01093a8b7a53aadcc7b2
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v4.0.0.tar.gz
TREESITTER_VIMDOC_SHA256 8096794c0f090b2d74b7bff94548ac1be3285b929ec74f839bd9b3ff4f4c6a0b
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.6.2.tar.gz
TREESITTER_QUERY_SHA256 90682e128d048fbf2a2a17edca947db71e326fa0b3dba4136e041e096538b4eb
TREESITTER_MARKDOWN_URL https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/v0.5.0.tar.gz
TREESITTER_MARKDOWN_SHA256 14c2c948ccf0e9b606eec39b09286c59dddf28307849f71b7ce2b1d1ef06937e
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.25.8.tar.gz
TREESITTER_SHA256 178b575244d967f4920a4642408dc4edf6de96948d37d7f06e5b78acee9c0b4e
WASMTIME_URL https://github.com/bytecodealliance/wasmtime/archive/v29.0.1.tar.gz
WASMTIME_SHA256 b94b6c6fd6aebaf05d4c69c1b12b5dc217b0d42c1a95f435b33af63dddfa5304
UNCRUSTIFY_URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.80.1.tar.gz
UNCRUSTIFY_SHA256 0e2616ec2f78e12816388c513f7060072ff7942b42f1175eb28b24cb75aaec48
UNCRUSTIFY_URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.81.0.tar.gz
UNCRUSTIFY_SHA256 484623dc16b92206adc6ac0770077c6c67c6e441102148c2a121a19549330ff9
LUA_DEV_DEPS_URL https://github.com/neovim/deps/raw/06ef2b58b0876f8de1a3f5a710473dcd7afff251/opt/lua-dev-deps.tar.gz
LUA_DEV_DEPS_SHA256 49f8399e453103064a23c65534f266f3067cda716b6502f016bfafeed5799354

View File

@@ -7,6 +7,7 @@ set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share)
set(ENV{XDG_STATE_HOME} ${BUILD_DIR}/Xtest_xdg/state)
unset(ENV{XDG_DATA_DIRS})
unset(ENV{NVIM}) # Clear $NVIM in case tests are running from Nvim. #11009
unset(ENV{TMUX}) # Nvim TUI shouldn't think it's running in tmux. #34173
# TODO(dundargoc): The CIRRUS_CI environment variable isn't passed to here from
# the main CMakeLists.txt, so we have to manually pass it to this script and
@@ -68,7 +69,7 @@ endif()
execute_process(
# Note: because of "-ll" (low-level interpreter mode), some modules like
# _editor.lua are not loaded.
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR} busted -v -o test.busted.outputHandlers.nvim
COMMAND ${NVIM_PRG} -ll ${WORKING_DIR}/test/lua_runner.lua ${DEPS_INSTALL_DIR}/share/lua/5.1/ busted -v -o test.busted.outputHandlers.nvim
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua
--lpath=${WORKING_DIR}/src/?.lua
@@ -78,7 +79,6 @@ execute_process(
${TEST_PATH}
TIMEOUT $ENV{TEST_TIMEOUT}
WORKING_DIRECTORY ${WORKING_DIR}
ERROR_VARIABLE err
RESULT_VARIABLE res
${EXTRA_ARGS})
@@ -87,11 +87,6 @@ file(REMOVE_RECURSE ${RM_FILES})
if(res)
message(STATUS "Tests exited non-zero: ${res}")
if("${err}" STREQUAL "")
message(STATUS "No output to stderr.")
else()
message(STATUS "Output to stderr:\n${err}")
endif()
# Dump the logfile on CI (if not displayed and moved already).
if(CI_BUILD)

30
deps/unibilium/build.zig vendored Normal file
View File

@@ -0,0 +1,30 @@
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("unibilium", .{});
const lib = b.addLibrary(.{
.name = "unibilium",
.linkage = .static,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
lib.addIncludePath(upstream.path(""));
lib.installHeader(upstream.path("unibilium.h"), "unibilium.h");
lib.linkLibC();
lib.addCSourceFiles(.{ .root = upstream.path(""), .files = &.{
"unibilium.c",
"uninames.c",
"uniutil.c",
}, .flags = &.{"-DTERMINFO_DIRS=\"/etc/terminfo:/usr/share/terminfo\""} });
b.installArtifact(lib);
}

12
deps/unibilium/build.zig.zon vendored Normal file
View File

@@ -0,0 +1,12 @@
.{
.name = "unibilium",
.version = "2.1.2",
.paths = .{""},
.dependencies = .{
.unibilium = .{
.url = "git+https://github.com/neovim/unibilium?ref=v2.1.2#bfcb0350129dd76893bc90399cf37c45812268a2",
.hash = "N-V-__8AADO1CgCggvx73yptnBlXbEm7TjOSO6VGIqc0CvYR",
},
},
}

27
deps/utf8proc/build.zig vendored Normal file
View File

@@ -0,0 +1,27 @@
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("utf8proc", .{});
const lib = b.addLibrary(.{
.name = "utf8proc",
.linkage = .static,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
lib.addIncludePath(upstream.path(""));
lib.installHeader(upstream.path("utf8proc.h"), "utf8proc.h");
lib.linkLibC();
lib.addCSourceFiles(.{ .root = upstream.path(""), .files = &.{
"utf8proc.c",
}, .flags = &.{"-DUTF8PROC_STATIC"} });
b.installArtifact(lib);
}

12
deps/utf8proc/build.zig.zon vendored Normal file
View File

@@ -0,0 +1,12 @@
.{
.name = "utf8proc",
.version = "2.10.0",
.paths = .{""},
.dependencies = .{
.utf8proc = .{
.url = "git+https://github.com/JuliaStrings/utf8proc?ref=v2.10.0#a1b99daa2a3393884220264c927a48ba1251a9c6",
.hash = "N-V-__8AAPJfKADYDOC95xuKyudrlob6eFqgzfFl8NbpOoU9",
},
},
}

View File

@@ -12,12 +12,17 @@ get_directory_property(LUA_GEN_DEPS DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEF
add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} ${GENERATED_SYN_VIM} ${FUNCS_DATA}
${PROJECT_SOURCE_DIR}/src/nvim/options.lua
${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
${PROJECT_SOURCE_DIR}/src/nvim/vvars.lua
DEPENDS
${LUA_GEN_DEPS}
${SYN_VIM_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
${PROJECT_SOURCE_DIR}/src/nvim/options.lua
${PROJECT_SOURCE_DIR}/src/nvim/vvars.lua
${PROJECT_SOURCE_DIR}/src/nvim/eval.c
${FUNCS_DATA}
)

View File

@@ -1,859 +0,0 @@
----------------------------------------
-- This file is generated via github.com/tjdevries/vim9jit
-- For any bugs, please first consider reporting there.
----------------------------------------
-- Ignore "value assigned to a local variable is unused" because
-- we can't guarantee that local variables will be used by plugins
-- luacheck: ignore
--- @diagnostic disable
local vim9 = require('_vim9script')
local M = {}
local prepended = nil
local grepCache = nil
local Complete = nil
local GetAddition = nil
local Tag2item = nil
local Dict2info = nil
local ParseTagline = nil
local Tagline2item = nil
local Tagcmd2extra = nil
local Nextitem = nil
local StructMembers = nil
local SearchMembers = nil
-- vim9script
-- # Vim completion script
-- # Language: C
-- # Maintainer: The Vim Project <https://github.com/vim/vim>
-- # Last Change: 2023 Aug 10
-- # Rewritten in Vim9 script by github user lacygoill
-- # Former Maintainer: Bram Moolenaar <Bram@vim.org>
prepended = ''
grepCache = vim.empty_dict()
-- # This function is used for the 'omnifunc' option.
Complete = function(findstart, abase)
findstart = vim9.bool(findstart)
if vim9.bool(findstart) then
-- # Locate the start of the item, including ".", "->" and "[...]".
local line = vim9.fn.getline('.')
local start = vim9.fn.charcol('.') - 1
local lastword = -1
while start > 0 do
if vim9.ops.RegexpMatches(vim9.index(line, vim9.ops.Minus(start, 1)), '\\w') then
start = start - 1
elseif
vim9.bool(vim9.ops.RegexpMatches(vim9.index(line, vim9.ops.Minus(start, 1)), '\\.'))
then
if lastword == -1 then
lastword = start
end
start = start - 1
elseif
vim9.bool(
start > 1
and vim9.index(line, vim9.ops.Minus(start, 2)) == '-'
and vim9.index(line, vim9.ops.Minus(start, 1)) == '>'
)
then
if lastword == -1 then
lastword = start
end
start = vim9.ops.Minus(start, 2)
elseif vim9.bool(vim9.index(line, vim9.ops.Minus(start, 1)) == ']') then
-- # Skip over [...].
local n = 0
start = start - 1
while start > 0 do
start = start - 1
if vim9.index(line, start) == '[' then
if n == 0 then
break
end
n = n - 1
elseif vim9.bool(vim9.index(line, start) == ']') then
n = n + 1
end
end
else
break
end
end
-- # Return the column of the last word, which is going to be changed.
-- # Remember the text that comes before it in prepended.
if lastword == -1 then
prepended = ''
return vim9.fn.byteidx(line, start)
end
prepended = vim9.slice(line, start, vim9.ops.Minus(lastword, 1))
return vim9.fn.byteidx(line, lastword)
end
-- # Return list of matches.
local base = prepended .. abase
-- # Don't do anything for an empty base, would result in all the tags in the
-- # tags file.
if base == '' then
return {}
end
-- # init cache for vimgrep to empty
grepCache = {}
-- # Split item in words, keep empty word after "." or "->".
-- # "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc.
-- # We can't use split, because we need to skip nested [...].
-- # "aa[...]" -> ['aa', '[...]'], "aa.bb[...]" -> ['aa', 'bb', '[...]'], etc.
local items = {}
local s = 0
local arrays = 0
while 1 do
local e = vim9.fn.charidx(base, vim9.fn.match(base, '\\.\\|->\\|\\[', s))
if e < 0 then
if s == 0 or vim9.index(base, vim9.ops.Minus(s, 1)) ~= ']' then
vim9.fn.add(items, vim9.slice(base, s, nil))
end
break
end
if s == 0 or vim9.index(base, vim9.ops.Minus(s, 1)) ~= ']' then
vim9.fn.add(items, vim9.slice(base, s, vim9.ops.Minus(e, 1)))
end
if vim9.index(base, e) == '.' then
-- # skip over '.'
s = vim9.ops.Plus(e, 1)
elseif vim9.bool(vim9.index(base, e) == '-') then
-- # skip over '->'
s = vim9.ops.Plus(e, 2)
else
-- # Skip over [...].
local n = 0
s = e
e = e + 1
while e < vim9.fn.strcharlen(base) do
if vim9.index(base, e) == ']' then
if n == 0 then
break
end
n = n - 1
elseif vim9.bool(vim9.index(base, e) == '[') then
n = n + 1
end
e = e + 1
end
e = e + 1
vim9.fn.add(items, vim9.slice(base, s, vim9.ops.Minus(e, 1)))
arrays = arrays + 1
s = e
end
end
-- # Find the variable items[0].
-- # 1. in current function (like with "gd")
-- # 2. in tags file(s) (like with ":tag")
-- # 3. in current file (like with "gD")
local res = {}
if vim9.fn.searchdecl(vim9.index(items, 0), false, true) == 0 then
-- # Found, now figure out the type.
-- # TODO: join previous line if it makes sense
local line = vim9.fn.getline('.')
local col = vim9.fn.charcol('.')
if vim9.fn.stridx(vim9.slice(line, nil, vim9.ops.Minus(col, 1)), ';') >= 0 then
-- # Handle multiple declarations on the same line.
local col2 = vim9.ops.Minus(col, 1)
while vim9.index(line, col2) ~= ';' do
col2 = col2 - 1
end
line = vim9.slice(line, vim9.ops.Plus(col2, 1), nil)
col = vim9.ops.Minus(col, col2)
end
if vim9.fn.stridx(vim9.slice(line, nil, vim9.ops.Minus(col, 1)), ',') >= 0 then
-- # Handle multiple declarations on the same line in a function
-- # declaration.
local col2 = vim9.ops.Minus(col, 1)
while vim9.index(line, col2) ~= ',' do
col2 = col2 - 1
end
if
vim9.ops.RegexpMatches(
vim9.slice(line, vim9.ops.Plus(col2, 1), vim9.ops.Minus(col, 1)),
' *[^ ][^ ]* *[^ ]'
)
then
line = vim9.slice(line, vim9.ops.Plus(col2, 1), nil)
col = vim9.ops.Minus(col, col2)
end
end
if vim9.fn.len(items) == 1 then
-- # Completing one word and it's a local variable: May add '[', '.' or
-- # '->'.
local match = vim9.index(items, 0)
local kind = 'v'
if vim9.fn.match(line, '\\<' .. match .. '\\s*\\[') > 0 then
match = match .. '['
else
res = Nextitem(vim9.slice(line, nil, vim9.ops.Minus(col, 1)), { '' }, 0, true)
if vim9.fn.len(res) > 0 then
-- # There are members, thus add "." or "->".
if vim9.fn.match(line, '\\*[ \\t(]*' .. match .. '\\>') > 0 then
match = match .. '->'
else
match = match .. '.'
end
end
end
res = { { ['match'] = match, ['tagline'] = '', ['kind'] = kind, ['info'] = line } }
elseif vim9.bool(vim9.fn.len(items) == vim9.ops.Plus(arrays, 1)) then
-- # Completing one word and it's a local array variable: build tagline
-- # from declaration line
local match = vim9.index(items, 0)
local kind = 'v'
local tagline = '\t/^' .. line .. '$/'
res = { { ['match'] = match, ['tagline'] = tagline, ['kind'] = kind, ['info'] = line } }
else
-- # Completing "var.", "var.something", etc.
res =
Nextitem(vim9.slice(line, nil, vim9.ops.Minus(col, 1)), vim9.slice(items, 1, nil), 0, true)
end
end
if vim9.fn.len(items) == 1 or vim9.fn.len(items) == vim9.ops.Plus(arrays, 1) then
-- # Only one part, no "." or "->": complete from tags file.
local tags = {}
if vim9.fn.len(items) == 1 then
tags = vim9.fn.taglist('^' .. base)
else
tags = vim9.fn.taglist('^' .. vim9.index(items, 0) .. '$')
end
vim9.fn_mut('filter', {
vim9.fn_mut('filter', {
tags,
function(_, v)
return vim9.ternary(vim9.fn.has_key(v, 'kind'), function()
return v.kind ~= 'm'
end, true)
end,
}, { replace = 0 }),
function(_, v)
return vim9.ops.Or(
vim9.ops.Or(
vim9.prefix['Bang'](vim9.fn.has_key(v, 'static')),
vim9.prefix['Bang'](vim9.index(v, 'static'))
),
vim9.fn.bufnr('%') == vim9.fn.bufnr(vim9.index(v, 'filename'))
)
end,
}, { replace = 0 })
res = vim9.fn.extend(
res,
vim9.fn.map(tags, function(_, v)
return Tag2item(v)
end)
)
end
if vim9.fn.len(res) == 0 then
-- # Find the variable in the tags file(s)
local diclist = vim9.fn.filter(
vim9.fn.taglist('^' .. vim9.index(items, 0) .. '$'),
function(_, v)
return vim9.ternary(vim9.fn.has_key(v, 'kind'), function()
return v.kind ~= 'm'
end, true)
end
)
res = {}
for _, i in vim9.iter(vim9.fn.range(vim9.fn.len(diclist))) do
-- # New ctags has the "typeref" field. Patched version has "typename".
if vim9.bool(vim9.fn.has_key(vim9.index(diclist, i), 'typename')) then
res = vim9.fn.extend(
res,
StructMembers(
vim9.index(vim9.index(diclist, i), 'typename'),
vim9.slice(items, 1, nil),
true
)
)
elseif vim9.bool(vim9.fn.has_key(vim9.index(diclist, i), 'typeref')) then
res = vim9.fn.extend(
res,
StructMembers(
vim9.index(vim9.index(diclist, i), 'typeref'),
vim9.slice(items, 1, nil),
true
)
)
end
-- # For a variable use the command, which must be a search pattern that
-- # shows the declaration of the variable.
if vim9.index(vim9.index(diclist, i), 'kind') == 'v' then
local line = vim9.index(vim9.index(diclist, i), 'cmd')
if vim9.slice(line, nil, 1) == '/^' then
local col =
vim9.fn.charidx(line, vim9.fn.match(line, '\\<' .. vim9.index(items, 0) .. '\\>'))
res = vim9.fn.extend(
res,
Nextitem(
vim9.slice(line, 2, vim9.ops.Minus(col, 1)),
vim9.slice(items, 1, nil),
0,
true
)
)
end
end
end
end
if vim9.fn.len(res) == 0 and vim9.fn.searchdecl(vim9.index(items, 0), true) == 0 then
-- # Found, now figure out the type.
-- # TODO: join previous line if it makes sense
local line = vim9.fn.getline('.')
local col = vim9.fn.charcol('.')
res =
Nextitem(vim9.slice(line, nil, vim9.ops.Minus(col, 1)), vim9.slice(items, 1, nil), 0, true)
end
-- # If the last item(s) are [...] they need to be added to the matches.
local last = vim9.fn.len(items) - 1
local brackets = ''
while last >= 0 do
if vim9.index(vim9.index(items, last), 0) ~= '[' then
break
end
brackets = vim9.index(items, last) .. brackets
last = last - 1
end
return vim9.fn.map(res, function(_, v)
return Tagline2item(v, brackets)
end)
end
M['Complete'] = Complete
GetAddition = function(line, match, memarg, bracket)
bracket = vim9.bool(bracket)
-- # Guess if the item is an array.
if vim9.bool(vim9.ops.And(bracket, vim9.fn.match(line, match .. '\\s*\\[') > 0)) then
return '['
end
-- # Check if the item has members.
if vim9.fn.len(SearchMembers(memarg, { '' }, false)) > 0 then
-- # If there is a '*' before the name use "->".
if vim9.fn.match(line, '\\*[ \\t(]*' .. match .. '\\>') > 0 then
return '->'
else
return '.'
end
end
return ''
end
Tag2item = function(val)
-- # Turn the tag info "val" into an item for completion.
-- # "val" is is an item in the list returned by taglist().
-- # If it is a variable we may add "." or "->". Don't do it for other types,
-- # such as a typedef, by not including the info that GetAddition() uses.
local res = vim9.convert.decl_dict({ ['match'] = vim9.index(val, 'name') })
res[vim9.index_expr('extra')] =
Tagcmd2extra(vim9.index(val, 'cmd'), vim9.index(val, 'name'), vim9.index(val, 'filename'))
local s = Dict2info(val)
if s ~= '' then
res[vim9.index_expr('info')] = s
end
res[vim9.index_expr('tagline')] = ''
if vim9.bool(vim9.fn.has_key(val, 'kind')) then
local kind = vim9.index(val, 'kind')
res[vim9.index_expr('kind')] = kind
if kind == 'v' then
res[vim9.index_expr('tagline')] = '\t' .. vim9.index(val, 'cmd')
res[vim9.index_expr('dict')] = val
elseif vim9.bool(kind == 'f') then
res[vim9.index_expr('match')] = vim9.index(val, 'name') .. '('
end
end
return res
end
Dict2info = function(dict)
-- # Use all the items in dictionary for the "info" entry.
local info = ''
for _, k in vim9.iter(vim9.fn_mut('sort', { vim9.fn.keys(dict) }, { replace = 0 })) do
info = info .. k .. vim9.fn['repeat'](' ', 10 - vim9.fn.strlen(k))
if k == 'cmd' then
info = info
.. vim9.fn.substitute(
vim9.fn.matchstr(vim9.index(dict, 'cmd'), '/^\\s*\\zs.*\\ze$/'),
'\\\\\\(.\\)',
'\\1',
'g'
)
else
local dictk = vim9.index(dict, k)
if vim9.fn.typename(dictk) ~= 'string' then
info = info .. vim9.fn.string(dictk)
else
info = info .. dictk
end
end
info = info .. '\n'
end
return info
end
ParseTagline = function(line)
-- # Parse a tag line and return a dictionary with items like taglist()
local l = vim9.fn.split(line, '\t')
local d = vim.empty_dict()
if vim9.fn.len(l) >= 3 then
d[vim9.index_expr('name')] = vim9.index(l, 0)
d[vim9.index_expr('filename')] = vim9.index(l, 1)
d[vim9.index_expr('cmd')] = vim9.index(l, 2)
local n = 2
if vim9.ops.RegexpMatches(vim9.index(l, 2), '^/') then
-- # Find end of cmd, it may contain Tabs.
while n < vim9.fn.len(l) and vim9.ops.NotRegexpMatches(vim9.index(l, n), '/;"$') do
n = n + 1
d[vim9.index_expr('cmd')] = vim9.index(d, 'cmd') .. ' ' .. vim9.index(l, n)
end
end
for _, i in vim9.iter(vim9.fn.range(vim9.ops.Plus(n, 1), vim9.fn.len(l) - 1)) do
if vim9.index(l, i) == 'file:' then
d[vim9.index_expr('static')] = 1
elseif vim9.bool(vim9.ops.NotRegexpMatches(vim9.index(l, i), ':')) then
d[vim9.index_expr('kind')] = vim9.index(l, i)
else
d[vim9.index_expr(vim9.fn.matchstr(vim9.index(l, i), '[^:]*'))] =
vim9.fn.matchstr(vim9.index(l, i), ':\\zs.*')
end
end
end
return d
end
Tagline2item = function(val, brackets)
-- # Turn a match item "val" into an item for completion.
-- # "val['match']" is the matching item.
-- # "val['tagline']" is the tagline in which the last part was found.
local line = vim9.index(val, 'tagline')
local add = GetAddition(line, vim9.index(val, 'match'), { val }, brackets == '')
local res = vim9.convert.decl_dict({ ['word'] = vim9.index(val, 'match') .. brackets .. add })
if vim9.bool(vim9.fn.has_key(val, 'info')) then
-- # Use info from Tag2item().
res[vim9.index_expr('info')] = vim9.index(val, 'info')
else
-- # Parse the tag line and add each part to the "info" entry.
local s = Dict2info(ParseTagline(line))
if s ~= '' then
res[vim9.index_expr('info')] = s
end
end
if vim9.bool(vim9.fn.has_key(val, 'kind')) then
res[vim9.index_expr('kind')] = vim9.index(val, 'kind')
elseif vim9.bool(add == '(') then
res[vim9.index_expr('kind')] = 'f'
else
local s = vim9.fn.matchstr(line, '\\t\\(kind:\\)\\=\\zs\\S\\ze\\(\\t\\|$\\)')
if s ~= '' then
res[vim9.index_expr('kind')] = s
end
end
if vim9.bool(vim9.fn.has_key(val, 'extra')) then
res[vim9.index_expr('menu')] = vim9.index(val, 'extra')
return res
end
-- # Isolate the command after the tag and filename.
local s = vim9.fn.matchstr(
line,
'[^\\t]*\\t[^\\t]*\\t\\zs\\(/^.*$/\\|[^\\t]*\\)\\ze\\(;"\\t\\|\\t\\|$\\)'
)
if s ~= '' then
res[vim9.index_expr('menu')] = Tagcmd2extra(
s,
vim9.index(val, 'match'),
vim9.fn.matchstr(line, '[^\\t]*\\t\\zs[^\\t]*\\ze\\t')
)
end
return res
end
Tagcmd2extra = function(cmd, name, fname)
-- # Turn a command from a tag line to something that is useful in the menu
local x = ''
if vim9.ops.RegexpMatches(cmd, '^/^') then
-- # The command is a search command, useful to see what it is.
x = vim9.fn.substitute(
vim9.fn.substitute(
vim9.fn.matchstr(cmd, '^/^\\s*\\zs.*\\ze$/'),
'\\<' .. name .. '\\>',
'@@',
''
),
'\\\\\\(.\\)',
'\\1',
'g'
) .. ' - ' .. fname
elseif vim9.bool(vim9.ops.RegexpMatches(cmd, '^\\d*$')) then
-- # The command is a line number, the file name is more useful.
x = fname .. ' - ' .. cmd
else
-- # Not recognized, use command and file name.
x = cmd .. ' - ' .. fname
end
return x
end
Nextitem = function(lead, items, depth, all)
all = vim9.bool(all)
-- # Find composing type in "lead" and match items[0] with it.
-- # Repeat this recursively for items[1], if it's there.
-- # When resolving typedefs "depth" is used to avoid infinite recursion.
-- # Return the list of matches.
-- # Use the text up to the variable name and split it in tokens.
local tokens = vim9.fn.split(lead, '\\s\\+\\|\\<')
-- # Try to recognize the type of the variable. This is rough guessing...
local res = {}
local body = function(_, tidx)
-- # Skip tokens starting with a non-ID character.
if vim9.ops.NotRegexpMatches(vim9.index(tokens, tidx), '^\\h') then
return vim9.ITER_CONTINUE
end
-- # Recognize "struct foobar" and "union foobar".
-- # Also do "class foobar" when it's C++ after all (doesn't work very well
-- # though).
if
(
vim9.index(tokens, tidx) == 'struct'
or vim9.index(tokens, tidx) == 'union'
or vim9.index(tokens, tidx) == 'class'
) and vim9.ops.Plus(tidx, 1) < vim9.fn.len(tokens)
then
res = StructMembers(
vim9.index(tokens, tidx) .. ':' .. vim9.index(tokens, vim9.ops.Plus(tidx, 1)),
items,
all
)
return vim9.ITER_BREAK
end
-- # TODO: add more reserved words
if
vim9.fn.index(
{ 'int', 'short', 'char', 'float', 'double', 'static', 'unsigned', 'extern' },
vim9.index(tokens, tidx)
) >= 0
then
return vim9.ITER_CONTINUE
end
-- # Use the tags file to find out if this is a typedef.
local diclist = vim9.fn.taglist('^' .. vim9.index(tokens, tidx) .. '$')
local body = function(_, tagidx)
local item = vim9.convert.decl_dict(vim9.index(diclist, tagidx))
-- # New ctags has the "typeref" field. Patched version has "typename".
if vim9.bool(vim9.fn.has_key(item, 'typeref')) then
res = vim9.fn.extend(res, StructMembers(vim9.index(item, 'typeref'), items, all))
return vim9.ITER_CONTINUE
end
if vim9.bool(vim9.fn.has_key(item, 'typename')) then
res = vim9.fn.extend(res, StructMembers(vim9.index(item, 'typename'), items, all))
return vim9.ITER_CONTINUE
end
-- # Only handle typedefs here.
if vim9.index(item, 'kind') ~= 't' then
return vim9.ITER_CONTINUE
end
-- # Skip matches local to another file.
if
vim9.bool(
vim9.ops.And(
vim9.ops.And(vim9.fn.has_key(item, 'static'), vim9.index(item, 'static')),
vim9.fn.bufnr('%') ~= vim9.fn.bufnr(vim9.index(item, 'filename'))
)
)
then
return vim9.ITER_CONTINUE
end
-- # For old ctags we recognize "typedef struct aaa" and
-- # "typedef union bbb" in the tags file command.
local cmd = vim9.index(item, 'cmd')
local ei = vim9.fn.charidx(cmd, vim9.fn.matchend(cmd, 'typedef\\s\\+'))
if ei > 1 then
local cmdtokens = vim9.fn.split(vim9.slice(cmd, ei, nil), '\\s\\+\\|\\<')
if vim9.fn.len(cmdtokens) > 1 then
if
vim9.index(cmdtokens, 0) == 'struct'
or vim9.index(cmdtokens, 0) == 'union'
or vim9.index(cmdtokens, 0) == 'class'
then
local name = ''
-- # Use the first identifier after the "struct" or "union"
for _, ti in vim9.iter(vim9.fn.range((vim9.fn.len(cmdtokens) - 1))) do
if vim9.ops.RegexpMatches(vim9.index(cmdtokens, ti), '^\\w') then
name = vim9.index(cmdtokens, ti)
break
end
end
if name ~= '' then
res = vim9.fn.extend(
res,
StructMembers(vim9.index(cmdtokens, 0) .. ':' .. name, items, all)
)
end
elseif vim9.bool(depth < 10) then
-- # Could be "typedef other_T some_T".
res = vim9.fn.extend(
res,
Nextitem(vim9.index(cmdtokens, 0), items, vim9.ops.Plus(depth, 1), all)
)
end
end
end
return vim9.ITER_DEFAULT
end
for _, tagidx in vim9.iter(vim9.fn.range(vim9.fn.len(diclist))) do
local nvim9_status, nvim9_ret = body(_, tagidx)
if nvim9_status == vim9.ITER_BREAK then
break
elseif nvim9_status == vim9.ITER_RETURN then
return nvim9_ret
end
end
if vim9.fn.len(res) > 0 then
return vim9.ITER_BREAK
end
return vim9.ITER_DEFAULT
end
for _, tidx in vim9.iter(vim9.fn.range(vim9.fn.len(tokens))) do
local nvim9_status, nvim9_ret = body(_, tidx)
if nvim9_status == vim9.ITER_BREAK then
break
elseif nvim9_status == vim9.ITER_RETURN then
return nvim9_ret
end
end
return res
end
StructMembers = function(atypename, items, all)
all = vim9.bool(all)
-- # Search for members of structure "typename" in tags files.
-- # Return a list with resulting matches.
-- # Each match is a dictionary with "match" and "tagline" entries.
-- # When "all" is true find all, otherwise just return 1 if there is any member.
-- # Todo: What about local structures?
local fnames = vim9.fn.join(vim9.fn.map(vim9.fn.tagfiles(), function(_, v)
return vim9.fn.escape(v, ' \\#%')
end))
if fnames == '' then
return {}
end
local typename = atypename
local qflist = {}
local cached = 0
local n = ''
if vim9.bool(vim9.prefix['Bang'](all)) then
n = '1'
if vim9.bool(vim9.fn.has_key(grepCache, typename)) then
qflist = vim9.index(grepCache, typename)
cached = 1
end
else
n = ''
end
if vim9.bool(vim9.prefix['Bang'](cached)) then
while 1 do
vim.api.nvim_command(
'silent! keepjumps noautocmd '
.. n
.. 'vimgrep '
.. '/\\t'
.. typename
.. '\\(\\t\\|$\\)/j '
.. fnames
)
qflist = vim9.fn.getqflist()
if vim9.fn.len(qflist) > 0 or vim9.fn.match(typename, '::') < 0 then
break
end
-- # No match for "struct:context::name", remove "context::" and try again.
typename = vim9.fn.substitute(typename, ':[^:]*::', ':', '')
end
if vim9.bool(vim9.prefix['Bang'](all)) then
-- # Store the result to be able to use it again later.
grepCache[vim9.index_expr(typename)] = qflist
end
end
-- # Skip over [...] items
local idx = 0
local target = ''
while 1 do
if idx >= vim9.fn.len(items) then
target = ''
break
end
if vim9.index(vim9.index(items, idx), 0) ~= '[' then
target = vim9.index(items, idx)
break
end
idx = idx + 1
end
-- # Put matching members in matches[].
local matches = {}
for _, l in vim9.iter(qflist) do
local memb = vim9.fn.matchstr(vim9.index(l, 'text'), '[^\\t]*')
if vim9.ops.RegexpMatches(memb, '^' .. target) then
-- # Skip matches local to another file.
if
vim9.fn.match(vim9.index(l, 'text'), '\tfile:') < 0
or vim9.fn.bufnr('%')
== vim9.fn.bufnr(vim9.fn.matchstr(vim9.index(l, 'text'), '\\t\\zs[^\\t]*'))
then
local item =
vim9.convert.decl_dict({ ['match'] = memb, ['tagline'] = vim9.index(l, 'text') })
-- # Add the kind of item.
local s =
vim9.fn.matchstr(vim9.index(l, 'text'), '\\t\\(kind:\\)\\=\\zs\\S\\ze\\(\\t\\|$\\)')
if s ~= '' then
item[vim9.index_expr('kind')] = s
if s == 'f' then
item[vim9.index_expr('match')] = memb .. '('
end
end
vim9.fn.add(matches, item)
end
end
end
if vim9.fn.len(matches) > 0 then
-- # Skip over next [...] items
idx = idx + 1
while 1 do
if idx >= vim9.fn.len(items) then
return matches
end
if vim9.index(vim9.index(items, idx), 0) ~= '[' then
break
end
idx = idx + 1
end
-- # More items following. For each of the possible members find the
-- # matching following members.
return SearchMembers(matches, vim9.slice(items, idx, nil), all)
end
-- # Failed to find anything.
return {}
end
SearchMembers = function(matches, items, all)
all = vim9.bool(all)
-- # For matching members, find matches for following items.
-- # When "all" is true find all, otherwise just return 1 if there is any member.
local res = {}
for _, i in vim9.iter(vim9.fn.range(vim9.fn.len(matches))) do
local typename = ''
local line = ''
if vim9.bool(vim9.fn.has_key(vim9.index(matches, i), 'dict')) then
if vim9.bool(vim9.fn.has_key(vim9.index(vim9.index(matches, i), 'dict'), 'typename')) then
typename = vim9.index(vim9.index(vim9.index(matches, i), 'dict'), 'typename')
elseif vim9.bool(vim9.fn.has_key(vim9.index(vim9.index(matches, i), 'dict'), 'typeref')) then
typename = vim9.index(vim9.index(vim9.index(matches, i), 'dict'), 'typeref')
end
line = '\t' .. vim9.index(vim9.index(vim9.index(matches, i), 'dict'), 'cmd')
else
line = vim9.index(vim9.index(matches, i), 'tagline')
local eb = vim9.fn.matchend(line, '\\ttypename:')
local e = vim9.fn.charidx(line, eb)
if e < 0 then
eb = vim9.fn.matchend(line, '\\ttyperef:')
e = vim9.fn.charidx(line, eb)
end
if e > 0 then
-- # Use typename field
typename = vim9.fn.matchstr(line, '[^\\t]*', eb)
end
end
if typename ~= '' then
res = vim9.fn.extend(res, StructMembers(typename, items, all))
else
-- # Use the search command (the declaration itself).
local sb = vim9.fn.match(line, '\\t\\zs/^')
local s = vim9.fn.charidx(line, sb)
if s > 0 then
local e = vim9.fn.charidx(
line,
vim9.fn.match(line, '\\<' .. vim9.index(vim9.index(matches, i), 'match') .. '\\>', sb)
)
if e > 0 then
res =
vim9.fn.extend(res, Nextitem(vim9.slice(line, s, vim9.ops.Minus(e, 1)), items, 0, all))
end
end
end
if vim9.bool(vim9.ops.And(vim9.prefix['Bang'](all), vim9.fn.len(res) > 0)) then
break
end
end
return res
end
-- #}}}1
-- # vim: noet sw=2 sts=2
return M

View File

@@ -1,8 +1,682 @@
" Generated vim file by vim9jit. Please do not edit
let s:path = expand("<script>")
let s:lua_path = fnamemodify(s:path, ":r") . ".lua"
let s:nvim_module = luaeval('require("_vim9script").autoload(_A)', s:lua_path)
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Nov 14
function! ccomplete#Complete(findstart, abase) abort
return s:nvim_module.Complete(a:findstart, a:abase)
endfunction
let s:cpo_save = &cpo
set cpo&vim
" This function is used for the 'omnifunc' option.
func ccomplete#Complete(findstart, base)
if a:findstart
" Locate the start of the item, including ".", "->" and "[...]".
let line = getline('.')
let start = col('.') - 1
let lastword = -1
while start > 0
if line[start - 1] =~ '\w'
let start -= 1
elseif line[start - 1] =~ '\.'
if lastword == -1
let lastword = start
endif
let start -= 1
elseif start > 1 && line[start - 2] == '-' && line[start - 1] == '>'
if lastword == -1
let lastword = start
endif
let start -= 2
elseif line[start - 1] == ']'
" Skip over [...].
let n = 0
let start -= 1
while start > 0
let start -= 1
if line[start] == '['
if n == 0
break
endif
let n -= 1
elseif line[start] == ']' " nested []
let n += 1
endif
endwhile
else
break
endif
endwhile
" Return the column of the last word, which is going to be changed.
" Remember the text that comes before it in s:prepended.
if lastword == -1
let s:prepended = ''
return start
endif
let s:prepended = strpart(line, start, lastword - start)
return lastword
endif
" Return list of matches.
let base = s:prepended . a:base
" Don't do anything for an empty base, would result in all the tags in the
" tags file.
if base == ''
return []
endif
" init cache for vimgrep to empty
let s:grepCache = {}
" Split item in words, keep empty word after "." or "->".
" "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc.
" We can't use split, because we need to skip nested [...].
" "aa[...]" -> ['aa', '[...]'], "aa.bb[...]" -> ['aa', 'bb', '[...]'], etc.
let items = []
let s = 0
let arrays = 0
while 1
let e = match(base, '\.\|->\|\[', s)
if e < 0
if s == 0 || base[s - 1] != ']'
call add(items, strpart(base, s))
endif
break
endif
if s == 0 || base[s - 1] != ']'
call add(items, strpart(base, s, e - s))
endif
if base[e] == '.'
let s = e + 1 " skip over '.'
elseif base[e] == '-'
let s = e + 2 " skip over '->'
else
" Skip over [...].
let n = 0
let s = e
let e += 1
while e < len(base)
if base[e] == ']'
if n == 0
break
endif
let n -= 1
elseif base[e] == '[' " nested [...]
let n += 1
endif
let e += 1
endwhile
let e += 1
call add(items, strpart(base, s, e - s))
let arrays += 1
let s = e
endif
endwhile
if complete_check()
" return v:none
return []
endif
" Find the variable items[0].
" 1. in current function (like with "gd")
" 2. in tags file(s) (like with ":tag")
" 3. in current file (like with "gD")
let res = []
if searchdecl(items[0], 0, 1) == 0
" Found, now figure out the type.
" TODO: join previous line if it makes sense
let line = getline('.')
let col = col('.')
if stridx(strpart(line, 0, col), ';') != -1
" Handle multiple declarations on the same line.
let col2 = col - 1
while line[col2] != ';'
if complete_check()
return res
endif
let col2 -= 1
endwhile
let line = strpart(line, col2 + 1)
let col -= col2
endif
if stridx(strpart(line, 0, col), ',') != -1
" Handle multiple declarations on the same line in a function
" declaration.
let col2 = col - 1
while line[col2] != ','
if complete_check()
return res
endif
let col2 -= 1
endwhile
if strpart(line, col2 + 1, col - col2 - 1) =~ ' *[^ ][^ ]* *[^ ]'
let line = strpart(line, col2 + 1)
let col -= col2
endif
endif
if len(items) == 1
" Completing one word and it's a local variable: May add '[', '.' or
" '->'.
let match = items[0]
let kind = 'v'
if match(line, '\<' . match . '\s*\[') > 0
let match .= '['
else
let res = s:Nextitem(strpart(line, 0, col), [''], 0, 1)
if len(res) > 0
" There are members, thus add "." or "->".
if match(line, '\*[ \t(]*' . match . '\>') > 0
let match .= '->'
else
let match .= '.'
endif
endif
endif
let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}]
elseif len(items) == arrays + 1
" Completing one word and it's a local array variable: build tagline
" from declaration line
let match = items[0]
let kind = 'v'
let tagline = "\t/^" . line . '$/'
let res = [{'match': match, 'tagline' : tagline, 'kind' : kind, 'info' : line}]
else
" Completing "var.", "var.something", etc.
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
endif
endif
if len(items) == 1 || len(items) == arrays + 1
" Only one part, no "." or "->": complete from tags file.
if len(items) == 1
let tags = taglist('^' . base)
else
let tags = taglist('^' . items[0] . '$')
endif
" Remove members, these can't appear without something in front.
call filter(tags, 'has_key(v:val, "kind") ? v:val["kind"] != "m" : 1')
" Remove static matches in other files.
call filter(tags, '!has_key(v:val, "static") || !v:val["static"] || bufnr("%") == bufnr(v:val["filename"])')
call extend(res, map(tags, 's:Tag2item(v:val)'))
endif
if len(res) == 0
" Find the variable in the tags file(s)
let diclist = taglist('^' . items[0] . '$')
" Remove members, these can't appear without something in front.
call filter(diclist, 'has_key(v:val, "kind") ? v:val["kind"] != "m" : 1')
let res = []
for i in range(len(diclist))
if complete_check()
return res
endif
" New ctags has the "typeref" field. Patched version has "typename".
if has_key(diclist[i], 'typename')
call extend(res, s:StructMembers(diclist[i]['typename'], items[1:], 1))
elseif has_key(diclist[i], 'typeref')
call extend(res, s:StructMembers(diclist[i]['typeref'], items[1:], 1))
endif
" For a variable use the command, which must be a search pattern that
" shows the declaration of the variable.
if diclist[i]['kind'] == 'v'
let line = diclist[i]['cmd']
if line[0] == '/' && line[1] == '^'
let col = match(line, '\<' . items[0] . '\>')
call extend(res, s:Nextitem(strpart(line, 2, col - 2), items[1:], 0, 1))
endif
endif
endfor
endif
if len(res) == 0 && searchdecl(items[0], 1) == 0
" Found, now figure out the type.
" TODO: join previous line if it makes sense
let line = getline('.')
let col = col('.')
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
endif
" If the last item(s) are [...] they need to be added to the matches.
let last = len(items) - 1
let brackets = ''
while last >= 0
if complete_check()
return res
endif
if items[last][0] != '['
break
endif
let brackets = items[last] . brackets
let last -= 1
endwhile
return map(res, 's:Tagline2item(v:val, brackets)')
endfunc
func s:GetAddition(line, match, memarg, bracket)
" Guess if the item is an array.
if a:bracket && match(a:line, a:match . '\s*\[') > 0
return '['
endif
" Check if the item has members.
if len(s:SearchMembers(a:memarg, [''], 0)) > 0
" If there is a '*' before the name use "->".
if match(a:line, '\*[ \t(]*' . a:match . '\>') > 0
return '->'
else
return '.'
endif
endif
return ''
endfunc
" Turn the tag info "val" into an item for completion.
" "val" is is an item in the list returned by taglist().
" If it is a variable we may add "." or "->". Don't do it for other types,
" such as a typedef, by not including the info that s:GetAddition() uses.
func s:Tag2item(val)
let res = {'match': a:val['name']}
let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
let s = s:Dict2info(a:val)
if s != ''
let res['info'] = s
endif
let res['tagline'] = ''
if has_key(a:val, "kind")
let kind = a:val['kind']
let res['kind'] = kind
if kind == 'v'
let res['tagline'] = "\t" . a:val['cmd']
let res['dict'] = a:val
elseif kind == 'f'
let res['match'] = a:val['name'] . '('
endif
endif
return res
endfunc
" Use all the items in dictionary for the "info" entry.
func s:Dict2info(dict)
let info = ''
for k in sort(keys(a:dict))
if complete_check()
return info
endif
let info .= k . repeat(' ', 10 - len(k))
if k == 'cmd'
let info .= substitute(matchstr(a:dict['cmd'], '/^\s*\zs.*\ze$/'), '\\\(.\)', '\1', 'g')
else
let info .= a:dict[k]
endif
let info .= "\n"
endfor
return info
endfunc
" Parse a tag line and return a dictionary with items like taglist()
func s:ParseTagline(line)
let l = split(a:line, "\t")
let d = {}
if len(l) >= 3
let d['name'] = l[0]
let d['filename'] = l[1]
let d['cmd'] = l[2]
let n = 2
if l[2] =~ '^/'
" Find end of cmd, it may contain Tabs.
while n < len(l) && l[n] !~ '/;"$'
let n += 1
let d['cmd'] .= " " . l[n]
endwhile
endif
for i in range(n + 1, len(l) - 1)
if complete_check()
return d
endif
if l[i] == 'file:'
let d['static'] = 1
elseif l[i] !~ ':'
let d['kind'] = l[i]
else
let d[matchstr(l[i], '[^:]*')] = matchstr(l[i], ':\zs.*')
endif
endfor
endif
return d
endfunc
" Turn a match item "val" into an item for completion.
" "val['match']" is the matching item.
" "val['tagline']" is the tagline in which the last part was found.
func s:Tagline2item(val, brackets)
let line = a:val['tagline']
let add = s:GetAddition(line, a:val['match'], [a:val], a:brackets == '')
let res = {'word': a:val['match'] . a:brackets . add }
if has_key(a:val, 'info')
" Use info from Tag2item().
let res['info'] = a:val['info']
else
" Parse the tag line and add each part to the "info" entry.
let s = s:Dict2info(s:ParseTagline(line))
if s != ''
let res['info'] = s
endif
endif
if has_key(a:val, 'kind')
let res['kind'] = a:val['kind']
elseif add == '('
let res['kind'] = 'f'
else
let s = matchstr(line, '\t\(kind:\)\=\zs\S\ze\(\t\|$\)')
if s != ''
let res['kind'] = s
endif
endif
if has_key(a:val, 'extra')
let res['menu'] = a:val['extra']
return res
endif
" Isolate the command after the tag and filename.
let s = matchstr(line, '[^\t]*\t[^\t]*\t\zs\(/^.*$/\|[^\t]*\)\ze\(;"\t\|\t\|$\)')
if s != ''
let res['menu'] = s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t'))
endif
return res
endfunc
" Turn a command from a tag line to something that is useful in the menu
func s:Tagcmd2extra(cmd, name, fname)
if a:cmd =~ '^/^'
" The command is a search command, useful to see what it is.
let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/')
let x = substitute(x, '\<' . a:name . '\>', '@@', '')
let x = substitute(x, '\\\(.\)', '\1', 'g')
let x = x . ' - ' . a:fname
elseif a:cmd =~ '^\d*$'
" The command is a line number, the file name is more useful.
let x = a:fname . ' - ' . a:cmd
else
" Not recognized, use command and file name.
let x = a:cmd . ' - ' . a:fname
endif
return x
endfunc
" Find composing type in "lead" and match items[0] with it.
" Repeat this recursively for items[1], if it's there.
" When resolving typedefs "depth" is used to avoid infinite recursion.
" Return the list of matches.
func s:Nextitem(lead, items, depth, all)
" Use the text up to the variable name and split it in tokens.
let tokens = split(a:lead, '\s\+\|\<')
" Try to recognize the type of the variable. This is rough guessing...
let res = []
for tidx in range(len(tokens))
if complete_check()
return res
endif
" Skip tokens starting with a non-ID character.
if tokens[tidx] !~ '^\h'
continue
endif
" Recognize "struct foobar" and "union foobar".
" Also do "class foobar" when it's C++ after all (doesn't work very well
" though).
if (tokens[tidx] == 'struct' || tokens[tidx] == 'union' || tokens[tidx] == 'class') && tidx + 1 < len(tokens)
let res = s:StructMembers(tokens[tidx] . ':' . tokens[tidx + 1], a:items, a:all)
break
endif
" TODO: add more reserved words
if index(['int', 'short', 'char', 'float', 'double', 'static', 'unsigned', 'extern'], tokens[tidx]) >= 0
continue
endif
" Use the tags file to find out if this is a typedef.
let diclist = taglist('^' . tokens[tidx] . '$')
for tagidx in range(len(diclist))
if complete_check()
return res
endif
let item = diclist[tagidx]
" New ctags has the "typeref" field. Patched version has "typename".
if has_key(item, 'typeref')
call extend(res, s:StructMembers(item['typeref'], a:items, a:all))
continue
endif
if has_key(item, 'typename')
call extend(res, s:StructMembers(item['typename'], a:items, a:all))
continue
endif
" Only handle typedefs here.
if item['kind'] != 't'
continue
endif
" Skip matches local to another file.
if has_key(item, 'static') && item['static'] && bufnr('%') != bufnr(item['filename'])
continue
endif
" For old ctags we recognize "typedef struct aaa" and
" "typedef union bbb" in the tags file command.
let cmd = item['cmd']
let ei = matchend(cmd, 'typedef\s\+')
if ei > 1
let cmdtokens = split(strpart(cmd, ei), '\s\+\|\<')
if len(cmdtokens) > 1
if cmdtokens[0] == 'struct' || cmdtokens[0] == 'union' || cmdtokens[0] == 'class'
let name = ''
" Use the first identifier after the "struct" or "union"
for ti in range(len(cmdtokens) - 1)
if cmdtokens[ti] =~ '^\w'
let name = cmdtokens[ti]
break
endif
endfor
if name != ''
call extend(res, s:StructMembers(cmdtokens[0] . ':' . name, a:items, a:all))
endif
elseif a:depth < 10
" Could be "typedef other_T some_T".
call extend(res, s:Nextitem(cmdtokens[0], a:items, a:depth + 1, a:all))
endif
endif
endif
endfor
if len(res) > 0
break
endif
endfor
return res
endfunc
" Search for members of structure "typename" in tags files.
" Return a list with resulting matches.
" Each match is a dictionary with "match" and "tagline" entries.
" When "all" is non-zero find all, otherwise just return 1 if there is any
" member.
func s:StructMembers(typename, items, all)
" Todo: What about local structures?
let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")'))
if fnames == ''
return []
endif
let typename = a:typename
let qflist = []
let cached = 0
if a:all == 0
let n = '1' " stop at first found match
if has_key(s:grepCache, a:typename)
let qflist = s:grepCache[a:typename]
let cached = 1
endif
else
let n = ''
endif
if !cached
while 1
if complete_check()
return []
endif
exe 'silent! keepj noautocmd ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames
let qflist = getqflist()
if len(qflist) > 0 || match(typename, "::") < 0
break
endif
" No match for "struct:context::name", remove "context::" and try again.
let typename = substitute(typename, ':[^:]*::', ':', '')
endwhile
if a:all == 0
" Store the result to be able to use it again later.
let s:grepCache[a:typename] = qflist
endif
endif
" Skip over [...] items
let idx = 0
while 1
if complete_check()
return []
endif
if idx >= len(a:items)
let target = '' " No further items, matching all members
break
endif
if a:items[idx][0] != '['
let target = a:items[idx]
break
endif
let idx += 1
endwhile
" Put matching members in matches[].
let matches = []
for l in qflist
let memb = matchstr(l['text'], '[^\t]*')
if memb =~ '^' . target
" Skip matches local to another file.
if match(l['text'], "\tfile:") < 0 || bufnr('%') == bufnr(matchstr(l['text'], '\t\zs[^\t]*'))
let item = {'match': memb, 'tagline': l['text']}
" Add the kind of item.
let s = matchstr(l['text'], '\t\(kind:\)\=\zs\S\ze\(\t\|$\)')
if s != ''
let item['kind'] = s
if s == 'f'
let item['match'] = memb . '('
endif
endif
call add(matches, item)
endif
endif
endfor
if len(matches) > 0
" Skip over next [...] items
let idx += 1
while 1
if complete_check()
return matches
endif
if idx >= len(a:items)
return matches " No further items, return the result.
endif
if a:items[idx][0] != '['
break
endif
let idx += 1
endwhile
" More items following. For each of the possible members find the
" matching following members.
return s:SearchMembers(matches, a:items[idx :], a:all)
endif
" Failed to find anything.
return []
endfunc
" For matching members, find matches for following items.
" When "all" is non-zero find all, otherwise just return 1 if there is any
" member.
func s:SearchMembers(matches, items, all)
let res = []
for i in range(len(a:matches))
if complete_check()
return res
endif
let typename = ''
if has_key(a:matches[i], 'dict')
if has_key(a:matches[i].dict, 'typename')
let typename = a:matches[i].dict['typename']
elseif has_key(a:matches[i].dict, 'typeref')
let typename = a:matches[i].dict['typeref']
endif
let line = "\t" . a:matches[i].dict['cmd']
else
let line = a:matches[i]['tagline']
let e = matchend(line, '\ttypename:')
if e < 0
let e = matchend(line, '\ttyperef:')
endif
if e > 0
" Use typename field
let typename = matchstr(line, '[^\t]*', e)
endif
endif
if typename != ''
call extend(res, s:StructMembers(typename, a:items, a:all))
else
" Use the search command (the declaration itself).
let s = match(line, '\t\zs/^')
if s > 0
let e = match(line, '\<' . a:matches[i]['match'] . '\>', s)
if e > 0
call extend(res, s:Nextitem(strpart(line, s, e - s), a:items, 0, a:all))
endif
endif
endif
if a:all == 0 && len(res) > 0
break
endif
endfor
return res
endfunc
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: noet sw=2 sts=2

View File

@@ -2,6 +2,21 @@
" Maintainer: Gregory Anders
" Last Change: 2024-09-03
" Based on: https://github.com/hashivim/vim-terraform
" License: ISC
"
" Copyright (c) 2014-2016 Mark Cornick <mark@markcornick.com>
"
" Permission to use, copy, modify, and/or distribute this software for any purpose
" with or without fee is hereby granted, provided that the above copyright notice
" and this permission notice appear in all copies.
"
" THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
" FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
" OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
" THIS SOFTWARE.
function! hcl#indentexpr(lnum)
" Beginning of the file should have no indent

View File

@@ -0,0 +1,192 @@
" HTML folding script, :h ft-html-plugin
" Latest Change: 2025 May 10
" Original Author: Aliaksei Budavei <0x000c70@gmail.com>
function! htmlfold#MapBalancedTags() abort
" Describe only _a capturable-name prefix_ for start and end patterns of
" a tag so that start tags with attributes spanning across lines can also be
" matched with a single call of "getline()".
let tag = '\m\c</\=\([0-9A-Za-z-]\+\)'
let names = []
let pairs = []
let ends = []
let pos = getpos('.')
try
call cursor(1, 1)
let [lnum, cnum] = searchpos(tag, 'cnW')
" Pair up nearest non-inlined tags in scope.
while lnum > 0
let name_attr = synIDattr(synID(lnum, cnum, 0), 'name')
if name_attr ==# 'htmlTag' || name_attr ==# 'htmlScriptTag'
let name = get(matchlist(getline(lnum), tag, (cnum - 1)), 1, '')
if !empty(name)
call insert(names, tolower(name), 0)
call insert(pairs, [lnum, -1], 0)
endif
elseif name_attr ==# 'htmlEndTag'
let name = get(matchlist(getline(lnum), tag, (cnum - 1)), 1, '')
if !empty(name)
let idx = index(names, tolower(name))
if idx >= 0
" Dismiss inlined balanced tags and opened-only tags.
if pairs[idx][0] != lnum
let pairs[idx][1] = lnum
call add(ends, lnum)
endif
" Claim a pair.
let names[: idx] = repeat([''], (idx + 1))
endif
endif
endif
" Advance the cursor, at "<", past "</a", "<a>", etc.
call cursor(lnum, (cnum + 3))
let [lnum, cnum] = searchpos(tag, 'cnW')
endwhile
finally
call setpos('.', pos)
endtry
if empty(ends)
return {}
endif
let folds = {}
let pending_end = ends[0]
let level = 0
while !empty(pairs)
let [start, end] = remove(pairs, -1)
if end < 0
continue
endif
if start >= pending_end
" Mark a sibling tag.
call remove(ends, 0)
while start >= ends[0]
" Mark a parent tag.
call remove(ends, 0)
let level -= 1
endwhile
let pending_end = ends[0]
else
" Mark a child tag.
let level += 1
endif
" Flatten the innermost inlined folds.
let folds[start] = get(folds, start, ('>' . level))
let folds[end] = get(folds, end, ('<' . level))
endwhile
return folds
endfunction
" See ":help vim9-mix".
if !has("vim9script")
finish
endif
def! g:htmlfold#MapBalancedTags(): dict<string>
# Describe only _a capturable-name prefix_ for start and end patterns of
# a tag so that start tags with attributes spanning across lines can also be
# matched with a single call of "getline()".
const tag: string = '\m\c</\=\([0-9A-Za-z-]\+\)'
var names: list<string> = []
var pairs: list<list<number>> = []
var ends: list<number> = []
const pos: list<number> = getpos('.')
try
cursor(1, 1)
var [lnum: number, cnum: number] = searchpos(tag, 'cnW')
# Pair up nearest non-inlined tags in scope.
while lnum > 0
const name_attr: string = synIDattr(synID(lnum, cnum, 0), 'name')
if name_attr ==# 'htmlTag' || name_attr ==# 'htmlScriptTag'
const name: string = get(matchlist(getline(lnum), tag, (cnum - 1)), 1, '')
if !empty(name)
insert(names, tolower(name), 0)
insert(pairs, [lnum, -1], 0)
endif
elseif name_attr ==# 'htmlEndTag'
const name: string = get(matchlist(getline(lnum), tag, (cnum - 1)), 1, '')
if !empty(name)
const idx: number = index(names, tolower(name))
if idx >= 0
# Dismiss inlined balanced tags and opened-only tags.
if pairs[idx][0] != lnum
pairs[idx][1] = lnum
add(ends, lnum)
endif
# Claim a pair.
names[: idx] = repeat([''], (idx + 1))
endif
endif
endif
# Advance the cursor, at "<", past "</a", "<a>", etc.
cursor(lnum, (cnum + 3))
[lnum, cnum] = searchpos(tag, 'cnW')
endwhile
finally
setpos('.', pos)
endtry
if empty(ends)
return {}
endif
var folds: dict<string> = {}
var pending_end: number = ends[0]
var level: number = 0
while !empty(pairs)
const [start: number, end: number] = remove(pairs, -1)
if end < 0
continue
endif
if start >= pending_end
# Mark a sibling tag.
remove(ends, 0)
while start >= ends[0]
# Mark a parent tag.
remove(ends, 0)
level -= 1
endwhile
pending_end = ends[0]
else
# Mark a child tag.
level += 1
endif
# Flatten the innermost inlined folds.
folds[start] = get(folds, start, ('>' .. level))
folds[end] = get(folds, end, ('<' .. level))
endwhile
return folds
enddef
" vim: fdm=syntax sw=2 ts=8 noet

View File

@@ -5,11 +5,11 @@
if exists('g:loaded_clipboard_provider')
finish
endif
" Default to 1. provider#clipboard#Executable() may set 2.
" Default to 0. provider#clipboard#Executable() may set 2.
" To force a reload:
" :unlet g:loaded_clipboard_provider
" :runtime autoload/provider/clipboard.vim
let g:loaded_clipboard_provider = 1
let g:loaded_clipboard_provider = 0
let s:copy = {}
let s:paste = {}
@@ -67,6 +67,113 @@ function! s:set_osc52() abort
return 'OSC 52'
endfunction
function! s:set_pbcopy() abort
let s:copy['+'] = ['pbcopy']
let s:paste['+'] = ['pbpaste']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
return 'pbcopy'
endfunction
function! s:set_wayland() abort
let s:copy['+'] = ['wl-copy', '--type', 'text/plain']
let s:paste['+'] = ['wl-paste', '--no-newline']
let s:copy['*'] = ['wl-copy', '--primary', '--type', 'text/plain']
let s:paste['*'] = ['wl-paste', '--no-newline', '--primary']
return 'wl-copy'
endfunction
function! s:set_wayclip() abort
let s:copy['+'] = ['waycopy']
let s:paste['+'] = ['waypaste']
let s:copy['*'] = ['waycopy', '-p']
let s:paste['*'] = ['waypaste', '-p']
return 'wayclip'
endfunction
function! s:set_xsel() abort
let s:copy['+'] = ['xsel', '--nodetach', '-i', '-b']
let s:paste['+'] = ['xsel', '-o', '-b']
let s:copy['*'] = ['xsel', '--nodetach', '-i', '-p']
let s:paste['*'] = ['xsel', '-o', '-p']
return 'xsel'
endfunction
function! s:set_xclip() abort
let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard']
let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard']
let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary']
let s:paste['*'] = ['xclip', '-o', '-selection', 'primary']
return 'xclip'
endfunction
function! s:set_lemonade() abort
let s:copy['+'] = ['lemonade', 'copy']
let s:paste['+'] = ['lemonade', 'paste']
let s:copy['*'] = ['lemonade', 'copy']
let s:paste['*'] = ['lemonade', 'paste']
return 'lemonade'
endfunction
function! s:set_doitclient() abort
let s:copy['+'] = ['doitclient', 'wclip']
let s:paste['+'] = ['doitclient', 'wclip', '-r']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'doitclient'
endfunction
function! s:set_win32yank() abort
if has('wsl') && getftype(exepath('win32yank.exe')) == 'link'
let win32yank = resolve(exepath('win32yank.exe'))
else
let win32yank = 'win32yank.exe'
endif
let s:copy['+'] = [win32yank, '-i', '--crlf']
let s:paste['+'] = [win32yank, '-o', '--lf']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'win32yank'
endfunction
function! s:set_putclip() abort
let s:copy['+'] = ['putclip']
let s:paste['+'] = ['getclip']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'putclip'
endfunction
function! s:set_clip() abort
let s:copy['+'] = ['clip']
let s:paste['+'] = ['powershell', '-NoProfile', '-NoLogo', '-Command', 'Get-Clipboard']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'clip'
endfunction
function! s:set_termux() abort
let s:copy['+'] = ['termux-clipboard-set']
let s:paste['+'] = ['termux-clipboard-get']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'termux-clipboard'
endfunction
function! s:set_tmux() abort
let tmux_v = v:lua.vim.version.parse(system(['tmux', '-V']))
if !empty(tmux_v) && !v:lua.vim.version.lt(tmux_v, [3,2,0])
let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-']
else
let s:copy['+'] = ['tmux', 'load-buffer', '-']
endif
let s:paste['+'] = ['tmux', 'save-buffer', '-']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'tmux'
endfunction
let s:cache_enabled = 1
let s:err = ''
@@ -78,9 +185,34 @@ function! provider#clipboard#Executable() abort
" Setting g:clipboard to v:false explicitly opts-in to using the "builtin" clipboard providers below
if exists('g:clipboard') && g:clipboard isnot# v:false
if v:t_string ==# type(g:clipboard)
" Handle string form of g:clipboard for all builtin providers
if 'osc52' == g:clipboard
" User opted-in to OSC 52 by manually setting g:clipboard.
return s:set_osc52()
elseif 'pbcopy' == g:clipboard
return s:set_pbcopy()
elseif 'wl-copy' == g:clipboard
return s:set_wayland()
elseif 'wayclip' == g:clipboard
return s:set_wayclip()
elseif 'xsel' == g:clipboard
return s:set_xsel()
elseif 'xclip' == g:clipboard
return s:set_xclip()
elseif 'lemonade' == g:clipboard
return s:set_lemonade()
elseif 'doitclient' == g:clipboard
return s:set_doitclient()
elseif 'win32yank' == g:clipboard
return s:set_win32yank()
elseif 'putclip' == g:clipboard
return s:set_putclip()
elseif 'clip' == g:clipboard
return s:set_clip()
elseif 'termux' == g:clipboard
return s:set_termux()
elseif 'tmux' == g:clipboard
return s:set_tmux()
endif
endif
@@ -102,88 +234,29 @@ function! provider#clipboard#Executable() abort
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard')
elseif has('mac')
let s:copy['+'] = ['pbcopy']
let s:paste['+'] = ['pbpaste']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
return 'pbcopy'
return s:set_pbcopy()
elseif !empty($WAYLAND_DISPLAY) && executable('wl-copy') && executable('wl-paste')
let s:copy['+'] = ['wl-copy', '--type', 'text/plain']
let s:paste['+'] = ['wl-paste', '--no-newline']
let s:copy['*'] = ['wl-copy', '--primary', '--type', 'text/plain']
let s:paste['*'] = ['wl-paste', '--no-newline', '--primary']
return 'wl-copy'
return s:set_wayland()
elseif !empty($WAYLAND_DISPLAY) && executable('waycopy') && executable('waypaste')
let s:copy['+'] = ['waycopy', '-t', 'text/plain']
let s:paste['+'] = ['waypaste', '-t', 'text/plain']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'wayclip'
return s:set_wayclip()
elseif !empty($DISPLAY) && executable('xsel') && s:cmd_ok('xsel -o -b')
let s:copy['+'] = ['xsel', '--nodetach', '-i', '-b']
let s:paste['+'] = ['xsel', '-o', '-b']
let s:copy['*'] = ['xsel', '--nodetach', '-i', '-p']
let s:paste['*'] = ['xsel', '-o', '-p']
return 'xsel'
return s:set_xsel()
elseif !empty($DISPLAY) && executable('xclip')
let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard']
let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard']
let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary']
let s:paste['*'] = ['xclip', '-o', '-selection', 'primary']
return 'xclip'
return s:set_xclip()
elseif executable('lemonade')
let s:copy['+'] = ['lemonade', 'copy']
let s:paste['+'] = ['lemonade', 'paste']
let s:copy['*'] = ['lemonade', 'copy']
let s:paste['*'] = ['lemonade', 'paste']
return 'lemonade'
return s:set_lemonade()
elseif executable('doitclient')
let s:copy['+'] = ['doitclient', 'wclip']
let s:paste['+'] = ['doitclient', 'wclip', '-r']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'doitclient'
return s:set_doitclient()
elseif executable('win32yank.exe')
if has('wsl') && getftype(exepath('win32yank.exe')) == 'link'
let win32yank = resolve(exepath('win32yank.exe'))
else
let win32yank = 'win32yank.exe'
endif
let s:copy['+'] = [win32yank, '-i', '--crlf']
let s:paste['+'] = [win32yank, '-o', '--lf']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'win32yank'
return s:set_win32yank()
elseif executable('putclip') && executable('getclip')
let s:copy['+'] = ['putclip']
let s:paste['+'] = ['getclip']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'putclip'
return s:set_putclip()
elseif executable('clip') && executable('powershell')
let s:copy['+'] = ['clip']
let s:paste['+'] = ['powershell', '-NoProfile', '-NoLogo', '-Command', 'Get-Clipboard']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'clip'
return s:set_clip()
elseif executable('termux-clipboard-set')
let s:copy['+'] = ['termux-clipboard-set']
let s:paste['+'] = ['termux-clipboard-get']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'termux-clipboard'
return s:set_termux()
elseif executable('tmux') && (!empty($TMUX) || 0 == jobwait([jobstart(['tmux', 'list-buffers'])], 2000)[0])
let tmux_v = v:lua.vim.version.parse(system(['tmux', '-V']))
if !empty(tmux_v) && !v:lua.vim.version.lt(tmux_v, [3,2,0])
let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-']
else
let s:copy['+'] = ['tmux', 'load-buffer', '-']
endif
let s:paste['+'] = ['tmux', 'save-buffer', '-']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'tmux'
return s:set_tmux()
elseif get(get(g:, 'termfeatures', {}), 'osc52') && &clipboard ==# ''
" Don't use OSC 52 when 'clipboard' is set. It can be slow and cause a lot
" of user prompts. Users can opt-in to it by setting g:clipboard manually.
@@ -195,13 +268,11 @@ function! provider#clipboard#Executable() abort
endfunction
function! s:clipboard.get(reg) abort
if type(s:paste[a:reg]) == v:t_func
return s:paste[a:reg]()
elseif s:selections[a:reg].owner > 0
if s:selections[a:reg].owner > 0
return s:selections[a:reg].data
end
let clipboard_data = s:try_cmd(s:paste[a:reg])
let clipboard_data = type(s:paste[a:reg]) == v:t_func ? s:paste[a:reg]() : s:try_cmd(s:paste[a:reg])
if match(&clipboard, '\v(unnamed|unnamedplus)') >= 0
\ && type(clipboard_data) == v:t_list
\ && get(s:selections[a:reg].data, 0, []) ==# clipboard_data
@@ -221,13 +292,12 @@ function! s:clipboard.set(lines, regtype, reg) abort
return 0
end
if type(s:copy[a:reg]) == v:t_func
call s:copy[a:reg](a:lines, a:regtype)
return 0
end
if s:cache_enabled == 0
call s:try_cmd(s:copy[a:reg], a:lines)
if s:cache_enabled == 0 || type(s:copy[a:reg]) == v:t_func
if type(s:copy[a:reg]) == v:t_func
call s:copy[a:reg](a:lines, a:regtype)
else
call s:try_cmd(s:copy[a:reg], a:lines)
endif
"Cache it anyway we can compare it later to get regtype of the yank
let s:selections[a:reg] = copy(s:selection)
let s:selections[a:reg].data = [a:lines, a:regtype]
@@ -284,4 +354,4 @@ function! provider#clipboard#Call(method, args) abort
endfunction
" eval_has_provider() decides based on this variable.
let g:loaded_clipboard_provider = empty(provider#clipboard#Executable()) ? 1 : 2
let g:loaded_clipboard_provider = empty(provider#clipboard#Executable()) ? 0 : 2

View File

@@ -1,7 +1,7 @@
if exists('g:loaded_node_provider')
finish
endif
let g:loaded_node_provider = 1
let g:loaded_node_provider = 0
function! s:is_minimum_version(version, min_version) abort
if empty(a:version)
@@ -152,7 +152,7 @@ endfunction
let s:err = ''
let [s:prog, s:_] = provider#node#Detect()
let g:loaded_node_provider = empty(s:prog) ? 1 : 2
let g:loaded_node_provider = empty(s:prog) ? 0 : 2
if g:loaded_node_provider != 2
let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'

View File

@@ -11,5 +11,5 @@ function! provider#perl#Require(host) abort
endfunction
let s:prog = v:lua.vim.provider.perl.detect()
let g:loaded_perl_provider = empty(s:prog) ? 1 : 2
let g:loaded_perl_provider = empty(s:prog) ? 0 : 2
call v:lua.require'vim.provider.perl'.start()

View File

@@ -11,5 +11,5 @@ function! provider#python3#Require(host) abort
endfunction
let s:prog = v:lua.vim.provider.python.detect_by_module('neovim')
let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
let g:loaded_python3_provider = empty(s:prog) ? 0 : 2
call v:lua.require'vim.provider.python'.start()

View File

@@ -11,6 +11,6 @@ function! provider#ruby#Call(method, args) abort
endfunction
let s:prog = v:lua.vim.provider.ruby.detect()
let g:loaded_ruby_provider = empty(s:prog) ? 1 : 2
let g:loaded_ruby_provider = empty(s:prog) ? 0 : 2
let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
call v:lua.require'vim.provider.ruby'.start(s:plugin_path)

View File

@@ -1,5 +1,8 @@
" Author: Stephen Sugden <stephen@stephensugden.com>
" Last Modified: 2023-09-11
" Last Change:
" 2025 Mar 31 by Vim project (rename s:RustfmtConfigOptions())
" 2025 Jul 14 by Vim project (don't parse rustfmt version automatically #17745)
"
" Adapted from https://github.com/fatih/vim-go
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
@@ -21,6 +24,12 @@ if !exists("g:rustfmt_fail_silently")
endif
function! rustfmt#DetectVersion()
let s:rustfmt_version = "0"
let s:rustfmt_help = ""
let s:rustfmt_unstable_features = ""
if !get(g:, 'rustfmt_detect_version', 0)
return s:rustfmt_version
endif
" Save rustfmt '--help' for feature inspection
silent let s:rustfmt_help = system(g:rustfmt_command . " --help")
let s:rustfmt_unstable_features = s:rustfmt_help =~# "--unstable-features"
@@ -29,9 +38,7 @@ function! rustfmt#DetectVersion()
silent let l:rustfmt_version_full = system(g:rustfmt_command . " --version")
let l:rustfmt_version_list = matchlist(l:rustfmt_version_full,
\ '\vrustfmt ([0-9]+[.][0-9]+[.][0-9]+)')
if len(l:rustfmt_version_list) < 3
let s:rustfmt_version = "0"
else
if len(l:rustfmt_version_list) >= 3
let s:rustfmt_version = l:rustfmt_version_list[1]
endif
return s:rustfmt_version
@@ -61,7 +68,13 @@ function! s:RustfmtWriteMode()
endif
endfunction
function! s:RustfmtConfigOptions()
function! rustfmt#RustfmtConfigOptions()
let default = '--edition 2018'
if !get(g:, 'rustfmt_find_toml', 0)
return default
endif
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
if l:rustfmt_toml !=# ''
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
@@ -73,7 +86,7 @@ function! s:RustfmtConfigOptions()
endif
" Default to edition 2018 in case no rustfmt.toml was found.
return '--edition 2018'
return default
endfunction
function! s:RustfmtCommandRange(filename, line1, line2)
@@ -84,7 +97,7 @@ function! s:RustfmtCommandRange(filename, line1, line2)
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
let l:write_mode = s:RustfmtWriteMode()
let l:rustfmt_config = s:RustfmtConfigOptions()
let l:rustfmt_config = rustfmt#RustfmtConfigOptions()
" FIXME: When --file-lines gets to be stable, add version range checking
" accordingly.
@@ -99,7 +112,7 @@ endfunction
function! s:RustfmtCommand()
let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display'
let config = s:RustfmtConfigOptions()
let config = rustfmt#RustfmtConfigOptions()
return join([g:rustfmt_command, write_mode, config, g:rustfmt_options])
endfunction

View File

@@ -12,6 +12,11 @@
" 2025 Feb 28 by Vim Project: add support for bzip3 (#16755)
" 2025 Mar 01 by Vim Project: fix syntax error in tar#Read()
" 2025 Mar 02 by Vim Project: escape the filename before using :read
" 2025 Mar 02 by Vim Project: determine the compression using readblob()
" instead of shelling out to file(1)
" 2025 Apr 16 by Vim Project: decouple from netrw by adding s:WinPath()
" 2025 May 19 by Vim Project: restore working directory after read/write
" 2025 Jul 13 by Vim Project: warn with path traversal attacks
"
" Contains many ideas from Michael Toren's <tar.vim>
"
@@ -30,9 +35,9 @@ if &cp || exists("g:loaded_tar")
finish
endif
let g:loaded_tar= "v32b"
if v:version < 702
if !has('nvim-0.12') && v:version < 900
echohl WarningMsg
echo "***warning*** this version of tar needs vim 7.2"
echo "***warning*** this version of tar needs vim 9.0"
echohl Normal
finish
endif
@@ -42,10 +47,10 @@ set cpo&vim
" ---------------------------------------------------------------------
" Default Settings: {{{1
if !exists("g:tar_browseoptions")
let g:tar_browseoptions= "Ptf"
let g:tar_browseoptions= "tf"
endif
if !exists("g:tar_readoptions")
let g:tar_readoptions= "pPxf"
let g:tar_readoptions= "pxf"
endif
if !exists("g:tar_cmd")
let g:tar_cmd= "tar"
@@ -54,6 +59,7 @@ if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf"
endif
if !exists("g:tar_delfile")
" Note: not supported on BSD
let g:tar_delfile="--delete -f"
endif
if !exists("g:netrw_cygwin")
@@ -102,10 +108,26 @@ if !exists("g:tar_shq")
endif
endif
let g:tar_secure=' -- '
let g:tar_leading_pat='^\%([.]\{,2\}/\)\+'
" ----------------
" Functions: {{{1
" ----------------
" ---------------------------------------------------------------------
" s:Msg: {{{2
fun! s:Msg(func, severity, msg)
redraw!
if a:severity =~? 'error'
echohl Error
else
echohl WarningMsg
endif
echo $"***{a:severity}*** ({a:func}) {a:msg}"
echohl None
endfunc
" ---------------------------------------------------------------------
" tar#Browse: {{{2
fun! tar#Browse(tarfile)
@@ -114,16 +136,14 @@ fun! tar#Browse(tarfile)
" sanity checks
if !executable(g:tar_cmd)
redraw!
echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
call s:Msg('tar#Browse', 'error', $"{g:tar_cmd} not available on your system")
let &report= repkeep
return
endif
if !filereadable(a:tarfile)
if a:tarfile !~# '^\a\+://'
" if it's an url, don't complain, let url-handlers such as vim do its thing
redraw!
echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
call s:Msg('tar#Browse', 'error', $"File not readable<{a:tarfile}>")
endif
let &report= repkeep
return
@@ -144,7 +164,7 @@ fun! tar#Browse(tarfile)
let lastline= line("$")
call setline(lastline+1,'" tar.vim version '.g:loaded_tar)
call setline(lastline+2,'" Browsing tarfile '.a:tarfile)
call setline(lastline+3,'" Select a file with cursor and press ENTER')
call setline(lastline+3,'" Select a file with cursor and press ENTER, "x" to extract a file')
keepj $put =''
keepj sil! 0d
keepj $
@@ -161,23 +181,19 @@ fun! tar#Browse(tarfile)
elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' ||
\ tarfile =~# '\.\(tzst\)$' || tarfile =~# '\.\(tlz4\)$'
if has("unix") && executable("file")
let filekind= system("file ".shellescape(tarfile,1))
else
let filekind= ""
endif
let header= s:Header(tarfile)
if filekind =~ "bzip2"
if header =~? 'bzip2'
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "bzip3"
elseif header =~? 'bzip3'
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "XZ"
elseif header =~? 'xz'
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "Zstandard"
elseif header =~? 'zstd'
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif filekind =~ "LZ4"
elseif header =~? 'lz4'
exe "sil! r! lz4 --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
elseif header =~? 'gzip'
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
endif
@@ -203,28 +219,18 @@ fun! tar#Browse(tarfile)
exe "sil! r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,1)
endif
if v:shell_error != 0
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) please check your g:tar_browseoptions<".g:tar_browseoptions.">"
call s:Msg('tar#Browse', 'warning', $"please check your g:tar_browseoptions '<{g:tar_browseoptions}>'")
return
endif
"
" The following should not be neccessary, since in case of errors the
" previous if statement should have caught the problem (because tar exited
" with a non-zero exit code).
" if line("$") == curlast || ( line("$") == (curlast + 1) &&
" \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' &&
" \ getline("$") =~ '\s' )
" redraw!
" echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
" keepj sil! %d
" let eikeep= &ei
" set ei=BufReadCmd,FileReadCmd
" exe "r ".fnameescape(a:tarfile)
" let &ei= eikeep
" keepj sil! 1d
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
" return
" endif
" remove tar: Removing leading '/' from member names
" Note: the message could be localized
if search('^tar: ') > 0 || search(g:tar_leading_pat) > 0
call append(3,'" Note: Path Traversal Attack detected!')
let b:leading_slash = 1
" remove the message output
sil g/^tar: /d
endif
" set up maps supported for tar
setlocal noma nomod ro
@@ -243,12 +249,7 @@ fun! s:TarBrowseSelect()
let repkeep= &report
set report=10
let fname= getline(".")
if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
redraw!
echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
return
endif
let ls= get(b:, 'leading_slash', 0)
" sanity check
if fname =~ '^"'
@@ -270,7 +271,8 @@ fun! s:TarBrowseSelect()
wincmd _
endif
let s:tblfile_{winnr()}= curfile
call tar#Read("tarfile:".tarfile.'::'.fname,1)
let b:leading_slash= ls
call tar#Read("tarfile:".tarfile.'::'.fname)
filetype detect
set nomod
exe 'com! -buffer -nargs=? -complete=file TarDiff :call tar#Diff(<q-args>,"'.fnameescape(fname).'")'
@@ -280,26 +282,18 @@ endfun
" ---------------------------------------------------------------------
" tar#Read: {{{2
fun! tar#Read(fname,mode)
fun! tar#Read(fname)
let repkeep= &report
set report=10
let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','')
" be careful not to execute special crafted files
let escape_file = fname->fnameescape()
" changing the directory to the temporary earlier to allow tar to extract the file with permissions intact
if !exists("*mkdir")
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
let &report= repkeep
return
endif
let escape_file = fname->substitute(g:tar_leading_pat, '', '')->fnameescape()
let curdir= getcwd()
let b:curdir= curdir
let tmpdir= tempname()
let b:curdir= tmpdir
let b:tmpdir= curdir
let b:tmpdir= tmpdir
if tmpdir =~ '\.'
let tmpdir= substitute(tmpdir,'\.[^.]*$','','e')
endif
@@ -307,10 +301,9 @@ fun! tar#Read(fname,mode)
" attempt to change to the indicated directory
try
exe "cd ".fnameescape(tmpdir)
exe "lcd ".fnameescape(tmpdir)
catch /^Vim\%((\a\+)\)\=:E344/
redraw!
echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
call s:Msg('tar#Read', 'error', "cannot lcd to temporary directory")
let &report= repkeep
return
endtry
@@ -320,7 +313,7 @@ fun! tar#Read(fname,mode)
call s:Rmdir("_ZIPVIM_")
endif
call mkdir("_ZIPVIM_")
cd _ZIPVIM_
lcd _ZIPVIM_
if has("win32unix") && executable("cygpath")
" assuming cygwin
@@ -333,7 +326,7 @@ fun! tar#Read(fname,mode)
elseif fname =~ '\.bz3$' && executable("bz3cat")
let decmp= "|bz3cat"
let doro = 1
elseif fname =~ '\.t\=gz$' && executable("zcat")
elseif fname =~ '\.t\=gz$' && executable("zcat")
let decmp= "|zcat"
let doro = 1
elseif fname =~ '\.lzma$' && executable("lzcat")
@@ -356,72 +349,66 @@ fun! tar#Read(fname,mode)
endif
endif
if exists("g:tar_secure")
let tar_secure= " -- "
else
let tar_secure= " "
endif
if tarfile =~# '\.bz2$'
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\.bz3$'
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\.\(gz\)$'
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\(\.tgz\|\.tbz\|\.txz\)'
if has("unix") && executable("file")
let filekind= system("file ".shellescape(tarfile,1))
else
let filekind= ""
endif
if filekind =~ "bzip2"
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
let filekind= s:Header(tarfile)
if filekind =~? "bzip2"
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif filekind =~ "bzip3"
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif filekind =~ "XZ"
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif filekind =~? "xz"
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif filekind =~ "Zstandard"
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif filekind =~? "zstd"
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
else
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif filekind =~? "gzip"
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
endif
elseif tarfile =~# '\.lrp$'
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\.lzma$'
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\.\(xz\|txz\)$'
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
elseif tarfile =~# '\.\(lz4\|tlz4\)$'
exe "sil! r! lz4 --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
exe "sil! r! lz4 --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
else
if tarfile =~ '^\s*-'
" A file name starting with a dash is taken as an option. Prepend ./ to avoid that.
let tarfile = substitute(tarfile, '-', './-', '')
endif
exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".tar_secure.shellescape(fname,1).decmp
exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".g:tar_secure.shellescape(fname,1).decmp
exe "read ".escape_file
endif
if get(b:, 'leading_slash', 0)
sil g/^tar: /d
endif
redraw!
if v:shell_error != 0
cd ..
if v:shell_error != 0
lcd ..
call s:Rmdir("_ZIPVIM_")
exe "cd ".fnameescape(curdir)
echohl Error | echo "***error*** (tar#Read) sorry, unable to open or extract ".tarfile." with ".fname | echohl None
exe "lcd ".fnameescape(curdir)
call s:Msg('tar#Read', 'error', $"sorry, unable to open or extract {tarfile} with {fname}")
endif
if doro
@@ -430,40 +417,54 @@ if v:shell_error != 0
endif
let b:tarfile= a:fname
exe "file tarfile::".fnameescape(fname)
" cleanup
keepj sil! 0d
set nomod
let &report= repkeep
exe "lcd ".fnameescape(curdir)
silent exe "file tarfile::". fname->fnameescape()
endfun
" ---------------------------------------------------------------------
" tar#Write: {{{2
fun! tar#Write(fname)
let pwdkeep= getcwd()
let repkeep= &report
set report=10
" temporary buffer variable workaround because too fucking tired. but it works now
let curdir= b:curdir
let tmpdir= b:tmpdir
if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-'
redraw!
echohl WarningMsg | echo '***warning*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"'
return
endif
" sanity checks
if !executable(g:tar_cmd)
redraw!
let &report= repkeep
return
endif
let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
if get(b:, 'leading_slash', 0)
call s:Msg('tar#Write', 'error', $"sorry, not attempting to update {tarfile} with {fname}")
let &report= repkeep
return
endif
if !isdirectory(fnameescape(tmpdir))
call mkdir(fnameescape(tmpdir), 'p')
endif
exe $"lcd {fnameescape(tmpdir)}"
if isdirectory("_ZIPVIM_")
call s:Rmdir("_ZIPVIM_")
endif
call mkdir("_ZIPVIM_")
lcd _ZIPVIM_
let dir = fnamemodify(fname, ':p:h')
if dir !~# '_ZIPVIM_$'
call mkdir(dir)
endif
" handle compressed archives
if tarfile =~# '\.bz2'
call system("bzip2 -d -- ".shellescape(tarfile,0))
@@ -499,10 +500,10 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile,'\.lzma','','e')
let compress= "lzma -- ".shellescape(tarfile,0)
endif
" Note: no support for name.tar.tbz/.txz/.tgz/.tlz4/.tzst
if v:shell_error != 0
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
call s:Msg('tar#Write', 'error', $"sorry, unable to update {tarfile} with {fname}")
else
if fname =~ '/'
@@ -520,28 +521,22 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile, '-', './-', '')
endif
if exists("g:tar_secure")
let tar_secure= " -- "
else
let tar_secure= " "
endif
exe "w! ".fnameescape(fname)
" don't overwrite a file forcefully
exe "w ".fnameescape(fname)
if has("win32unix") && executable("cygpath")
let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e')
endif
" delete old file from tarfile
call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
" Note: BSD tar does not support --delete flag
call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).g:tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
call s:Msg('tar#Write', 'error', $"sorry, unable to update {fnameescape(tarfile)} with {fnameescape(fname)} --delete not supported?")
else
" update tarfile with new file
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).g:tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
call s:Msg('tar#Write', 'error', $"sorry, unable to update {fnameescape(tarfile)} with {fnameescape(fname)}")
elseif exists("compress")
call system(compress)
if exists("tgz")
@@ -567,9 +562,9 @@ fun! tar#Write(fname)
endif
" cleanup and restore current directory
cd ..
lcd ..
call s:Rmdir("_ZIPVIM_")
exe "cd ".fnameescape(curdir)
exe "lcd ".fnameescape(pwdkeep)
setlocal nomod
let &report= repkeep
@@ -582,6 +577,7 @@ fun! tar#Diff(userfname,fname)
if a:userfname != ""
let fname= a:userfname
endif
exe "lcd ".fnameescape(b:tmpdir). '/_ZIPVIM_'
if filereadable(fname)
" sets current file (from tarball) for diff'ing
" splits window vertically
@@ -605,12 +601,6 @@ fun! tar#Extract()
set report=10
let fname= getline(".")
if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
redraw!
echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
return
endif
" sanity check
if fname =~ '^"'
let &report= repkeep
@@ -620,20 +610,20 @@ fun! tar#Extract()
let tarball = expand("%")
let tarbase = substitute(tarball,'\..*$','','')
let extractcmd= netrw#WinPath(g:tar_extractcmd)
let extractcmd= s:WinPath(g:tar_extractcmd)
if filereadable(tarbase.".tar")
call system(extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
echo "***note*** successfully extracted ". fname
endif
elseif filereadable(tarbase.".tgz")
let extractcmd= substitute(extractcmd,"-","-z","")
call system(extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tgz ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tgz {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -642,7 +632,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-z","")
call system(extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.gz {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -651,7 +641,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-j","")
call system(extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tbz {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -660,7 +650,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-j","")
call system(extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.bz2 {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -669,7 +659,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-j","")
call system(extractcmd." ".shellescape(tarbase).".tar.bz3 ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz3 ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.bz3 {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -678,7 +668,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-J","")
call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.txz {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -687,7 +677,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-J","")
call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.xz {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -696,7 +686,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","--zstd","")
call system(extractcmd." ".shellescape(tarbase).".tzst ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzst ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tzst {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -705,7 +695,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","--zstd","")
call system(extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.zst {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -714,7 +704,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-I lz4","")
call system(extractcmd." ".shellescape(tarbase).".tlz4 ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tlz4 ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tlz4 {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -723,7 +713,7 @@ fun! tar#Extract()
let extractcmd= substitute(extractcmd,"-","-I lz4","")
call system(extractcmd." ".shellescape(tarbase).".tar.lz4".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.lz4 ".fname.": failed!" | echohl NONE
call s:Msg('tar#Extract', 'error', $"{extractcmd} {tarbase}.tar.lz4 {fname}: failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -736,15 +726,50 @@ endfun
" ---------------------------------------------------------------------
" s:Rmdir: {{{2
fun! s:Rmdir(fname)
if has("unix")
call system("/bin/rm -rf -- ".shellescape(a:fname,0))
elseif has("win32") || has("win95") || has("win64") || has("win16")
if &shell =~? "sh$"
call system("/bin/rm -rf -- ".shellescape(a:fname,0))
else
call system("del /S ".shellescape(a:fname,0))
endif
call delete(a:fname, 'rf')
endfun
" s:FileHeader: {{{2
fun! s:Header(fname)
let header= readblob(a:fname, 0, 6)
" Nvim: see https://github.com/neovim/neovim/pull/34968
if header[0:2] == 0z425A68 " bzip2 header
return "bzip2"
elseif header[0:2] == 0z425A33 " bzip3 header
return "bzip3"
elseif header == 0zFD377A58.5A00 " xz header
return "xz"
elseif header[0:3] == 0z28B52FFD " zstd header
return "zstd"
elseif header[0:3] == 0z04224D18 " lz4 header
return "lz4"
elseif (header[0:1] == 0z1F9D ||
\ header[0:1] == 0z1F8B ||
\ header[0:1] == 0z1F9E ||
\ header[0:1] == 0z1FA0 ||
\ header[0:1] == 0z1F1E)
return "gzip"
endif
return "unknown"
endfun
" ---------------------------------------------------------------------
" s:WinPath: {{{2
fun! s:WinPath(path)
if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && has("win32")
" remove cygdrive prefix, if present
let path = substitute(a:path, '/cygdrive/\(.\)', '\1:', '')
" remove trailing slash (Win95)
let path = substitute(path, '\(\\\|/\)$', '', 'g')
" remove escaped spaces
let path = substitute(path, '\ ', ' ', 'g')
" convert slashes to backslashes
let path = substitute(path, '/', '\', 'g')
else
let path = a:path
endif
return path
endfun
" =====================================================================

View File

@@ -77,49 +77,11 @@ function! tutor#TutorFolds()
endif
endfunction
" Marks: {{{1
function! tutor#ApplyMarks()
hi! link tutorExpect Special
if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
let b:tutor_sign_id = 1
for expct in keys(b:tutor_metadata['expect'])
let lnum = eval(expct)
call matchaddpos('tutorExpect', [lnum])
call tutor#CheckLine(lnum)
endfor
endif
endfunction
function! tutor#ApplyMarksOnChanged()
if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
let lnum = line('.')
if index(keys(b:tutor_metadata['expect']), string(lnum)) > -1
call tutor#CheckLine(lnum)
endif
endif
endfunction
function! tutor#CheckLine(line)
if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
let bufn = bufnr('%')
let ctext = getline(a:line)
let signs = sign_getplaced(bufn, {'lnum': a:line})[0].signs
if !empty(signs)
call sign_unplace('', {'id': signs[0].id})
endif
if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)]
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn
else
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorbad buffer=".bufn
endif
let b:tutor_sign_id+=1
endif
endfunction
" Tutor Cmd: {{{1
function! s:Locale()
" Make sure l:lang exists before returning.
let l:lang = 'en_US'
if exists('v:lang') && v:lang =~ '\a\a'
let l:lang = v:lang
elseif $LC_ALL =~ '\a\a'
@@ -132,8 +94,6 @@ function! s:Locale()
endif
elseif $LANG =~ '\a\a'
let l:lang = $LANG
else
let l:lang = 'en_US'
endif
return split(l:lang, '_')
endfunction
@@ -167,15 +127,21 @@ function! s:Sort(a, b)
return retval
endfunction
function! s:GlobTutorials(name)
" returns a list of all tutor files matching the given name
function! tutor#GlobTutorials(name, locale)
let locale = a:locale
" pack/*/start/* are not reported in &rtp
let rtp = nvim_list_runtime_paths()
\ ->map({_, v -> escape(v:lua.vim.fs.normalize(v), ',')})
\ ->join(',')
" search for tutorials:
" 1. non-localized
let l:tutors = s:GlobPath(&rtp, 'tutor/'.a:name.'.tutor')
let l:tutors = s:GlobPath(rtp, 'tutor/'.a:name.'.tutor')
" 2. localized for current locale
let l:locale_tutors = s:GlobPath(&rtp, 'tutor/'.s:Locale()[0].'/'.a:name.'.tutor')
let l:locale_tutors = s:GlobPath(rtp, 'tutor/'.locale.'/'.a:name.'.tutor')
" 3. fallback to 'en'
if len(l:locale_tutors) == 0
let l:locale_tutors = s:GlobPath(&rtp, 'tutor/en/'.a:name.'.tutor')
let l:locale_tutors = s:GlobPath(rtp, 'tutor/en/'.a:name.'.tutor')
endif
call extend(l:tutors, l:locale_tutors)
return uniq(sort(l:tutors, 's:Sort'), 's:Sort')
@@ -197,7 +163,7 @@ function! tutor#TutorCmd(tutor_name)
let l:tutor_name = fnamemodify(l:tutor_name, ':r')
endif
let l:tutors = s:GlobTutorials(l:tutor_name)
let l:tutors = tutor#GlobTutorials(l:tutor_name, s:Locale()[0])
if len(l:tutors) == 0
echom "No tutorial with that name found"
@@ -220,15 +186,37 @@ function! tutor#TutorCmd(tutor_name)
call tutor#SetupVim()
exe "edit ".l:to_open
call tutor#EnableInteractive(v:true)
call tutor#ApplyTransform()
endfunction
function! tutor#TutorCmdComplete(lead,line,pos)
let l:tutors = s:GlobTutorials('*')
let l:tutors = tutor#GlobTutorials('*', s:Locale()[0])
let l:names = uniq(sort(map(l:tutors, 'fnamemodify(v:val, ":t:r")'), 's:Sort'))
return join(l:names, "\n")
endfunction
" Enables/disables interactive mode.
function! tutor#EnableInteractive(enable)
let enable = a:enable
if enable
setlocal buftype=nofile
setlocal concealcursor+=inv
setlocal conceallevel=2
lua require('nvim.tutor').apply_marks()
augroup tutor_interactive
autocmd! TextChanged,TextChangedI <buffer> lua require('nvim.tutor').apply_marks_on_changed()
augroup END
else
setlocal buftype<
setlocal concealcursor<
setlocal conceallevel<
if exists('#tutor_interactive')
autocmd! tutor_interactive * <buffer>
endif
endif
endfunction
function! tutor#ApplyTransform()
if has('win32')
sil! %s/{unix:(\(.\{-}\)),win:(\(.\{-}\))}/\2/g

View File

@@ -15,6 +15,7 @@
" 2024 Aug 18 by Vim Project: correctly handle special globbing chars
" 2024 Aug 21 by Vim Project: simplify condition to detect MS-Windows
" 2025 Mar 11 by Vim Project: handle filenames with leading '-' correctly
" 2025 Jul 12 by Vim Project: drop ../ on write to prevent path traversal attacks
" License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -71,8 +72,9 @@ fun! s:Mess(group, msg)
echohl Normal
endfun
if v:version < 702
call s:Mess('WarningMsg', "***warning*** this version of zip needs vim 7.2 or later")
if !has('nvim-0.10') && v:version < 901
" required for defer
call s:Mess('WarningMsg', "***warning*** this version of zip needs vim 9.1 or later")
finish
endif
" sanity checks
@@ -235,59 +237,62 @@ endfun
" zip#Write: {{{2
fun! zip#Write(fname)
let dict = s:SetSaneOpts()
let need_rename = 0
defer s:RestoreOpts(dict)
" sanity checks
if !executable(substitute(g:zip_zipcmd,'\s\+.*$','',''))
call s:Mess('Error', "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program")
return
endif
if !exists("*mkdir")
call s:Mess('Error', "***error*** (zip#Write) sorry, mkdir() doesn't work on your system")
return
call s:Mess('Error', "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program")
return
endif
let curdir= getcwd()
let tmpdir= tempname()
if tmpdir =~ '\.'
let tmpdir= substitute(tmpdir,'\.[^.]*$','','e')
let tmpdir= substitute(tmpdir,'\.[^.]*$','','e')
endif
call mkdir(tmpdir,"p")
" attempt to change to the indicated directory
if s:ChgDir(tmpdir,s:ERROR,"(zip#Write) cannot cd to temporary directory")
return
return
endif
" place temporary files under .../_ZIPVIM_/
if isdirectory("_ZIPVIM_")
call delete("_ZIPVIM_", "rf")
call delete("_ZIPVIM_", "rf")
endif
call mkdir("_ZIPVIM_")
cd _ZIPVIM_
if has("unix")
let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'zipfile://.\{-}::\([^\\].*\)$','\1','')
let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'zipfile://.\{-}::\([^\\].*\)$','\1','')
else
let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','')
let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','')
endif
if fname =~ '^[.]\{1,2}/'
call system(g:zip_zipcmd." -d ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
let fname = fname->substitute('^\([.]\{1,2}/\)\+', '', 'g')
let need_rename = 1
endif
if fname =~ '/'
let dirpath = substitute(fname,'/[^/]\+$','','e')
if has("win32unix") && executable("cygpath")
let dirpath = substitute(fname,'/[^/]\+$','','e')
if has("win32unix") && executable("cygpath")
let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e')
endif
call mkdir(dirpath,"p")
endif
call mkdir(dirpath,"p")
endif
if zipfile !~ '/'
let zipfile= curdir.'/'.zipfile
let zipfile= curdir.'/'.zipfile
endif
exe "w! ".fnameescape(fname)
" don't overwrite files forcefully
exe "w ".fnameescape(fname)
if has("win32unix") && executable("cygpath")
let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e')
let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e')
endif
if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$'
@@ -296,21 +301,24 @@ fun! zip#Write(fname)
call system(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
if v:shell_error != 0
call s:Mess('Error', "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname)
call s:Mess('Error', "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname)
elseif s:zipfile_{winnr()} =~ '^\a\+://'
" support writing zipfiles across a network
let netzipfile= s:zipfile_{winnr()}
1split|enew
let binkeep= &binary
let eikeep = &ei
set binary ei=all
exe "noswapfile e! ".fnameescape(zipfile)
call netrw#NetWrite(netzipfile)
let &ei = eikeep
let &binary = binkeep
q!
unlet s:zipfile_{winnr()}
" support writing zipfiles across a network
let netzipfile= s:zipfile_{winnr()}
1split|enew
let binkeep= &binary
let eikeep = &ei
set binary ei=all
exe "noswapfile e! ".fnameescape(zipfile)
call netrw#NetWrite(netzipfile)
let &ei = eikeep
let &binary = binkeep
q!
unlet s:zipfile_{winnr()}
elseif need_rename
exe $"sil keepalt file {fnameescape($"zipfile://{zipfile}::{fname}")}"
call s:Mess('Warning', "***error*** (zip#Browse) Path Traversal Attack detected, dropping relative path")
endif
" cleanup and restore current directory
@@ -319,7 +327,6 @@ fun! zip#Write(fname)
call s:ChgDir(curdir,s:WARNING,"(zip#Write) unable to return to ".curdir."!")
call delete(tmpdir, "rf")
setlocal nomod
endfun
" ---------------------------------------------------------------------
@@ -332,15 +339,18 @@ fun! zip#Extract()
" sanity check
if fname =~ '^"'
return
return
endif
if fname =~ '/$'
call s:Mess('Error', "***error*** (zip#Extract) Please specify a file, not a directory")
return
call s:Mess('Error', "***error*** (zip#Extract) Please specify a file, not a directory")
return
elseif fname =~ '^[.]\?[.]/'
call s:Mess('Error', "***error*** (zip#Browse) Path Traversal Attack detected, not extracting!")
return
endif
if filereadable(fname)
call s:Mess('Error', "***error*** (zip#Extract) <" .. fname .."> already exists in directory, not overwriting!")
return
call s:Mess('Error', "***error*** (zip#Extract) <" .. fname .."> already exists in directory, not overwriting!")
return
endif
let target = fname->substitute('\[', '[[]', 'g')
" unzip 6.0 does not support -- to denote end-of-arguments
@@ -362,13 +372,12 @@ fun! zip#Extract()
" extract the file mentioned under the cursor
call system($"{g:zip_extractcmd} -o {shellescape(b:zipfile)} {target}")
if v:shell_error != 0
call s:Mess('Error', "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!")
call s:Mess('Error', "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!")
elseif !filereadable(fname)
call s:Mess('Error', "***error*** attempted to extract ".fname." but it doesn't appear to be present!")
call s:Mess('Error', "***error*** attempted to extract ".fname." but it doesn't appear to be present!")
else
echomsg "***note*** successfully extracted ".fname
echomsg "***note*** successfully extracted ".fname
endif
endfun
" ---------------------------------------------------------------------

View File

@@ -47,6 +47,7 @@ hi('WildMenu', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', cterm
hi('VertSplit', { link = 'Normal' })
hi('WinSeparator', { link = 'VertSplit' })
hi('WinBarNC', { link = 'WinBar' })
hi('DiffTextAdd', { link = 'DiffText' })
hi('EndOfBuffer', { link = 'NonText' })
hi('LineNrAbove', { link = 'LineNr' })
hi('LineNrBelow', { link = 'LineNr' })
@@ -61,6 +62,8 @@ hi('PmenuMatchSel', { link = 'PmenuSel' })
hi('PmenuExtra', { link = 'Pmenu' })
hi('PmenuExtraSel', { link = 'PmenuSel' })
hi('ComplMatchIns', {})
hi('ComplHint', { link = 'NonText' })
hi('ComplHintMore', { link = 'MoreMsg' })
hi('Substitute', { link = 'Search' })
hi('Whitespace', { link = 'NonText' })
hi('MsgSeparator', { link = 'StatusLine' })
@@ -133,6 +136,7 @@ hi('DiagnosticDeprecated', { sp = 'Red', strikethrough = true, cterm =
hi('DiagnosticUnnecessary', { link = 'Comment' })
hi('LspInlayHint', { link = 'NonText' })
hi('SnippetTabstop', { link = 'Visual' })
hi('SnippetTabstopActive', { link = 'SnippetTabstop' })
-- Text
hi('@markup.raw', { link = 'Comment' })

View File

@@ -0,0 +1,25 @@
" Vim compiler file
" Language: Gleam
" Maintainer: Kirill Morozov <kirill@robotix.pro>
" Based On: https://github.com/gleam-lang/gleam.vim
" Last Change: 2025 Apr 21
if exists('current_compiler')
finish
endif
let current_compiler = "gleam_build"
CompilerSet makeprg=gleam\ build
" Example error message:
"
" error: Unknown variable
" ┌─ /home/michael/root/projects/tutorials/gleam/try/code/src/main.gleam:19:18
" │
" 19 │ Ok(tuple(name, spot))
" │ ^^^^ did you mean `sport`?
"
" The name `spot` is not in scope here.
CompilerSet errorformat=%Eerror:\ %m,%Wwarning:\ %m,%C\ %#┌─%#\ %f:%l:%c\ %#-%#
" vim: sw=2 sts=2 et

View File

@@ -2,6 +2,7 @@
" Compiler: Pandoc
" Maintainer: Konfekt
" Last Change: 2024 Nov 19
" 2025 May 15 Update the title regex for CompilerSet #17321
"
" Expects output file extension, say `:make html` or `:make pdf`.
" Passes additional arguments to pandoc, say `:make html --self-contained`.
@@ -51,7 +52,7 @@ endfunction
execute 'CompilerSet makeprg=pandoc'..escape(
\ ' --standalone'..
\ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ?
\ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s\+\S\+', 'cnw') > 0)) ?
\ '' : ' --metadata title=%:t:r:S')..
\ ' '..s:PandocLang()..
\ ' --from='..s:PandocFiletype(&filetype)..

View File

@@ -0,0 +1,12 @@
" Vim compiler file
" Compiler: PHPStan
" Maintainer: Dietrich Moerman <dietrich.moerman@gmail.com>
" Last Change: 2025 Jul 17
if exists("current_compiler")
finish
endif
let current_compiler = "phpstan"
CompilerSet makeprg=composer\ exec\ --\ phpstan\ analyse\ -v\ --no-progress\ --error-format=raw
CompilerSet errorformat=%f:%l:%m,%-G%.%#

View File

@@ -1,10 +1,13 @@
*ui.txt* Nvim
*api-ui-events.txt* Nvim
NVIM REFERENCE MANUAL
Nvim UI protocol *UI* *ui*
Nvim UI protocol *UI* *ui* *api-ui-events*
This document describes the UI protocol. See |gui| and |tui| for user-facing
UI components and features.
Type |gO| to see the table of contents.
@@ -226,8 +229,7 @@ the editor.
sent from Nvim, like for |ui-cmdline|.
["chdir", path] ~
The |current-directory| of the embedded Nvim process changed to
`path`.
The |current-directory| changed to `path`.
["mode_change", mode, mode_idx] ~
Editor mode changed. The `mode` parameter is a string representing
@@ -249,6 +251,14 @@ the editor.
Indicates to the UI that it must stop rendering the cursor. This event
is misnamed and does not actually have anything to do with busyness.
["restart", progpath, argv] ~
|:restart| command has been used and the Nvim server is about to exit.
The UI should wait for the server to exit, and then start a new server
using `progpath` as the full path to the Nvim executable |v:progpath| and
`argv` as its arguments |v:argv|, and reattach to the new server.
Note: |--embed| and |--headless| are excluded from `argv`, and the client
should decide itself whether to add either flag.
["suspend"] ~
|:suspend| command or |CTRL-Z| mapping is used. A terminal client (or
another client where it makes sense) could suspend itself. Other
@@ -266,6 +276,10 @@ the editor.
to an internal buffer, this is the time to display the redrawn parts
to the user.
["ui_send", content] ~
Write {content} to the connected TTY. Only UIs that have the
"stdout_tty" |ui-option| set will receive this event.
==============================================================================
Grid Events (line-based) *ui-linegrid*
@@ -609,12 +623,31 @@ tabs.
size). If the window was previously hidden, it should now be shown
again.
["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, mouse_enabled, zindex] ~
Display or reconfigure floating window `win`. The window should be
displayed above another grid `anchor_grid` at the specified position
`anchor_row` and `anchor_col`. For the meaning of `anchor` and more details
of positioning, see |nvim_open_win()|. `mouse_enabled` is true if the
window can receive mouse events.
["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, mouse_enabled, zindex, compindex, screen_row, screen_col] ~
Display or reconfigure floating window `win`.
There are two alternative ways of positioning the window
- Manually - The window should be displayed above another grid
`anchor_grid` at the specified position `anchor_row` and
`anchor_col`. For the meaning of `anchor` and more details of
positioning, see |nvim_open_win()|. NOTE: you have to manually
ensure that the window fits the screen, possibly by further
reposition it. Ignore `screen_row` and `screen_col` in this case.
- Let nvim take care of the positioning - You can ignore `anchor`
and display the window at `screen_row` and `screen_col`.
`mouse_enabled` is true if the window can receive mouse events.
`zindex` is the configured zindex, while `compindex` is the exact
rendering order of the windows determined by nvim. To render exactly
like the TUI, first render all the non-floating windows, then render
in the `compindex` order, overwriting any floating window cells.
Finally, blend the floating window cells against the non-floating
background. To add more blending, you can group the windows by zindex,
and blend between the layers. But note that windows inside the same
zindex should still overwrite previous cells inside the same layer
without blending. This ensures that plugins that render multiple
windows, to add borders for example, work as expected.
["win_external_pos", grid, win] ~
Display or reconfigure external window `win`. The window should be
@@ -627,7 +660,7 @@ tabs.
["win_close", grid] ~
Close the window.
["msg_set_pos", grid, row, scrolled, sep_char] ~
["msg_set_pos", grid, row, scrolled, sep_char, zindex, compindex] ~
Display messages on `grid`. The grid will be displayed at `row` on
the default grid (grid=1), covering the full column width. `scrolled`
indicates whether the message area has been scrolled to cover other
@@ -638,6 +671,10 @@ tabs.
When |ui-messages| is active, no message grid is used, and this event
will not be sent.
`zindex` and `compindex` have the same meaning as for `win_float_pos`.
The `zindex` always has a fixed value of 200 and included for
completeness.
["win_viewport", grid, win, topline, botline, curline, curcol, line_count, scroll_delta] ~
Indicates the range of buffer text displayed in the window, as well
as the cursor position in the buffer. All positions are zero-based.
@@ -719,8 +756,8 @@ This UI extension delegates presentation of the |cmdline| (except 'wildmenu').
For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
["cmdline_show", content, pos, firstc, prompt, indent, level, hl_id] ~
content: List of [attrs, string]
[[{}, "t"], [attrs, "est"], ...]
content: List of [attrs, string, hl_id]
[[{}, "t", hl_id], [attrs, "est", hl_id], ...]
Triggered when the cmdline is displayed or changed.
The `content` is the full content that should be displayed in the
@@ -752,9 +789,10 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
Should be hidden at next cmdline_show.
["cmdline_hide", abort] ~
Hide the cmdline. `abort` is true if the cmdline is hidden after an
aborting condition (|c_Esc| or |c_CTRL-C|).
["cmdline_hide", level, abort] ~
Hide the cmdline. `level` is the nesting level of the cmdline being hidden.
`abort` is true if the cmdline is hidden after an aborting condition
(|c_Esc| or |c_CTRL-C|).
["cmdline_block_show", lines] ~
Show a block of context to the current command line. For example if
@@ -787,12 +825,15 @@ will be set to zero, but can be changed and used for the replacing cmdline or
message window. Cmdline state is emitted as |ui-cmdline| events, which the UI
must handle.
["msg_show", kind, content, replace_last, history] ~
["msg_show", kind, content, replace_last, history, append, msg_id] ~
Display a message to the user.
kind
Name indicating the message kind:
"" (empty) Unknown (consider a |feature-request|)
"empty" Empty message (`:echo ""`), with empty `content`.
Should clear messages sharing the 'cmdheight'
area if it is the only message in a batch.
"bufwrite" |:write| message
"confirm" Message preceding a prompt (|:confirm|,
|confirm()|, |inputlist()|, |z=|, …)
@@ -804,11 +845,12 @@ must handle.
"list_cmd" List output for various commands (|:ls|, |:set|, …)
"lua_error" Error in |:lua| code
"lua_print" |print()| from |:lua| code
"progress" Progress message emitted by |nvim_echo()|
"rpc_error" Error response from |rpcrequest()|
"return_prompt" |press-enter| prompt after a multiple messages
"quickfix" Quickfix navigation message
"search_cmd" Entered search command
"search_count" Search count message ("S" flag of 'shortmess')
"shell_cmd" |:!cmd| executed command
"shell_err" |:!cmd| shell stderr output
"shell_out" |:!cmd| shell stdout output
"shell_ret" |:!cmd| shell return code
@@ -836,9 +878,24 @@ must handle.
history
True if the message was added to the |:messages| history.
append
True if the message should be appeneded to the previous message,
rather than started on a new line. Is set for |:echon|.
msg_id
Unique identifier for the message. It can either be an integer or
string. When message of same id appears it should replace the older message.
["msg_clear"] ~
Clear all messages currently displayed by "msg_show". (Messages sent
by other "msg_" events below will not be affected).
Clear all messages currently displayed by "msg_show", emitted after
clearing the screen (messages sent by other "msg_" events below should
not be affected).
Guidance: The "clear messages" behavior is UI-specific. If the UI
presents messages in a new window, it may choose to clear messages
after a few seconds. If the UI presents messages in a persistent area
(e.g. cmdline), it should clear messages at the start of the next
batch (typically, the next event-loop cycle).
["msg_showmode", content] ~
Shows 'showmode' and |recording| messages. `content` has the same
@@ -854,12 +911,11 @@ must handle.
statusline. `content` has the same format as in "msg_show". This event is
sent with empty `content` to hide the last message.
["msg_history_show", entries] ~
Sent when |:messages| command is invoked. History is sent as a list of
entries, where each entry is a `[kind, content]` tuple.
["msg_history_show", entries, prev_cmd] ~
Sent when |:messages| or |g<| command is invoked. History is sent as a
list of entries, where each entry is a `[kind, content, append]` tuple.
["msg_history_clear"] ~
Clear the |:messages| history.
prev_cmd
True when sent with |g<| command, false with |:messages|.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@@ -73,11 +73,16 @@ Or use `:execute`: >
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
exception is that "<sfile>" is expanded when the autocmd is defined. Example:
exception is that "<sfile>" (unlike "<script>") is expanded when the autocmd
is defined. Example:
>
:au BufNewFile,BufRead *.html so <sfile>:h/html.vim
Here Vim expands <sfile> to the name of the file containing this line.
However, <sfile> works differently in a function, in which case it's better to
use `:execute` with <script> to achieve the same purpose:
>
:exe $'au BufNewFile,BufRead *.html so {expand("<script>:h")}/html.vim'
`:autocmd` adds to the list of autocommands regardless of whether they are
already present. When your .vimrc file is sourced twice, the autocommands
@@ -257,7 +262,7 @@ BufLeave Before leaving to another buffer. Also when
Not used for ":qa" or ":q" when exiting Vim.
*BufModifiedSet*
BufModifiedSet After the `'modified'` value of a buffer has
been changed.
been changed. Special-case of |OptionSet|.
*BufNew*
BufNew After creating a new buffer (except during
startup, see |VimEnter|) or renaming an
@@ -301,6 +306,7 @@ BufUnload Before unloading a buffer, when the text in
going to exit.
NOTE: Current buffer "%" is not the target
buffer "<afile>", "<abuf>". |<buffer=abuf>|
*E1546*
Do not switch buffers or windows!
Not triggered when exiting and v:dying is 2 or
more.
@@ -344,7 +350,8 @@ BufWriteCmd Before writing the whole buffer to a file.
The buffer contents should not be changed.
When the command resets 'modified' the undo
information is adjusted to mark older undo
states as 'modified', like |:write| does.
states as 'modified', like |:write| does. Use
the |'[| and |']| marks for the range of lines.
|Cmd-event|
*BufWritePost*
BufWritePost After writing the whole buffer to a file
@@ -400,6 +407,16 @@ CmdlineLeave Before leaving the command-line (including
Note: `abort` can only be changed from false
to true: cannot execute an already aborted
cmdline by changing it to false.
*CmdlineLeavePre*
CmdlineLeavePre Just before leaving the command line, and
before |CmdlineLeave|. Useful for capturing
completion info with |cmdcomplete_info()|, as
this information is cleared before
|CmdlineLeave| is triggered. Triggered for
non-interactive use of ":" in a mapping, but
not when using |<Cmd>|. Also triggered when
abandoning the command line by typing CTRL-C
or <Esc>. <afile> is set to |cmdline-char|.
*CmdwinEnter*
CmdwinEnter After entering the command-line window.
Useful for setting options specifically for
@@ -477,27 +494,16 @@ CompleteDone After Insert mode completion is done. Either
- "accept": completion was
accepted by |complete_CTRL-Y|.
- "cancel": completion was
stopped by |complete_CTRL-E.
stopped by |complete_CTRL-E|.
- "discard": completion was
abandoned for other reason.
*CursorHold*
CursorHold When the user doesn't press a key for the time
specified with 'updatetime'. Not triggered
until the user has pressed a key (i.e. doesn't
fire every 'updatetime' ms if you leave Vim to
make some coffee. :) See |CursorHold-example|
for previewing tags.
This event is only triggered in Normal mode.
It is not triggered when waiting for a command
argument to be typed, or a movement after an
operator.
While recording the CursorHold event is not
triggered. |q|
*<CursorHold>*
Internally the autocommand is triggered by the
<CursorHold> key. In an expression mapping
|getchar()| may see this character.
CursorHold When there is no user input for 'updatetime'
duration, in Normal-mode. Not triggered while
waiting for a command argument or movement
after an operator, nor while |recording|
a macro. See |CursorHold-example|.
Note: Interactive commands cannot be used for
this event. There is no hit-enter prompt,
@@ -648,14 +654,14 @@ FileType When the 'filetype' option has been set. The
FileWriteCmd Before writing to a file, when not writing the
whole buffer. Should do the writing to the
file. Should not change the buffer. Use the
'[ and '] marks for the range of lines.
|'[| and |']| marks for the range of lines.
|Cmd-event|
*FileWritePost*
FileWritePost After writing to a file, when not writing the
whole buffer.
*FileWritePre*
FileWritePre Before writing to a file, when not writing the
whole buffer. Use the '[ and '] marks for the
whole buffer. Use the |'[| and |']| marks for the
range of lines.
*FilterReadPost*
FilterReadPost After reading a file from a filter command.
@@ -782,6 +788,31 @@ ModeChanged After changing the mode. The pattern is
:au ModeChanged [vV\x16]*:* let &l:rnu = mode() =~# '^[vV\x16]'
:au ModeChanged *:[vV\x16]* let &l:rnu = mode() =~# '^[vV\x16]'
:au WinEnter,WinLeave * let &l:rnu = mode() =~# '^[vV\x16]'
Progress *Progress*
After a progress message is created or updated via
`nvim_echo`. The pattern is matched against
title of the message. The |event-data| contains:
id: id of the message
text: text of the message
title: title of the progress message
status: status of the progress message
percent: how much progress has been
made for this progress item
Usage example:
>
vim.api.nvim_create_autocmd('Progress', {
pattern={"term"},
callback = function(ev)
print(string.format('event fired: %s', vim.inspect(ev)))
end
})
local id = vim.api.nvim_echo({{'searching...'}}, true,
{kind='progress', status='running', percent=10, title="term"})
vim.api.nvim_echo({{'searching'}}, true,
{id = id, kind='progress', status='running', percent=50, title="term"})
vim.api.nvim_echo({{'done'}}, true,
{id = id, kind='progress', status='success', percent=100, title="term"})
< *OptionSet*
OptionSet After setting an option (except during
|startup|). The |autocmd-pattern| is matched
@@ -822,6 +853,10 @@ OptionSet After setting an option (except during
always use |:noautocmd| to prevent triggering
OptionSet.
Note: Not triggered by the 'modified' option;
the |BufModifiedSet| event may be used to
handle that.
Non-recursive: |:set| in the autocommand does
not trigger OptionSet again.
@@ -1034,7 +1069,7 @@ TermRequest When a |:terminal| child process emits an OSC,
autocommand defined without |autocmd-nested|.
*TermResponse*
TermResponse When Nvim receives an OSC or DCS response from
TermResponse When Nvim receives a DA1, OSC, DCS, or APC response from
the host terminal. Sets |v:termresponse|. The
|event-data| is a table with the following fields:
@@ -1058,7 +1093,7 @@ TermResponse When Nvim receives an OSC or DCS response from
local r, g, b = resp:match("\027%]4;1;rgb:(%w+)/(%w+)/(%w+)")
end,
})
io.stdout:write("\027]4;1;?\027\\")
vim.api.nvim_ui_send("\027]4;1;?\027\\")
<
*TextChanged*
TextChanged After a change was made to the text in the
@@ -1186,6 +1221,13 @@ WinScrolled After any window in the current tab page
or changed width or height. See
|win-scrolled-resized|.
Note: This can not be skipped with
`:noautocmd`, because it triggers after
processing normal commands when Vim is back in
the main loop. If you want to disable this,
consider setting the 'eventignore' option
instead.
The pattern is matched against the |window-ID|
of the first window that scrolled or resized.
Both <amatch> and <afile> are set to the

View File

@@ -22,13 +22,13 @@ For inserting text see |insert.txt|.
"dl".
The <Del> key does not take a [count]. Instead, it
deletes the last character of the count.
See |'whichwrap'| for deleting a line break (join
See 'whichwrap' for deleting a line break (join
lines).
*X* *dh*
["x]X Delete [count] characters before the cursor [into
register x] (not |linewise|). Does the same as "dh".
Also see |'whichwrap'|.
Also see 'whichwrap'.
*d*
["x]d{motion} Delete text that {motion} moves over [into register
@@ -141,8 +141,8 @@ the 'joinspaces' option is on, these commands insert two spaces after a '.',
The 'B' and 'M' flags in 'formatoptions' change the behavior for inserting
spaces before and after a multibyte character |fo-table|.
The '[ mark is set at the end of the first line that was joined, '] at the end
of the resulting line.
The |'[| mark is set at the end of the first line that was joined, |']| at the
end of the resulting line.
==============================================================================
@@ -367,7 +367,7 @@ CTRL-A Add [count] to the number or alphabetic character at
*v_g_CTRL-A*
{Visual}g CTRL-A Add [count] to the number or alphabetic character in
the highlighted text. If several lines are
highlighted, each one will be incremented by an
highlighted, each one will be incremented by an
additional [count] (so effectively creating a
[count] incrementing sequence).
For Example, if you have this list of numbers:
@@ -583,9 +583,9 @@ with ".". Vim does not recognize a comment (starting with '"') after the
={motion} Filter {motion} lines through the external program
given with the 'equalprg' option. When the 'equalprg'
option is empty (this is the default), use the
internal formatting function |C-indenting| and
|'lisp'|. But when 'indentexpr' is not empty, it will
be used instead |indent-expression|.
internal formatting function |C-indenting| and 'lisp'.
But when 'indentexpr' is not empty, it will be used
instead |indent-expression|.
*==*
== Filter [count] lines like with ={motion}.
@@ -644,8 +644,9 @@ original user.
Repeat last :substitute with same search pattern and
substitute string, but without the same flags. You
may add [flags], see |:s_flags|.
Note that after `:substitute` the '&' flag can't be
used, it's recognized as a pattern separator.
Note that after `:substitute` the '&' and '#' flags
can't be used, they're recognized as a pattern
separator.
The space between `:substitute` and the 'c', 'g',
'i', 'I' and 'r' flags isn't required, but in scripts
it's a good idea to keep it to avoid confusion.
@@ -948,22 +949,26 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|.
4.3 Changing tabs *change-tabs*
*:ret* *:retab* *:retab!*
:[range]ret[ab][!] [new_tabstop]
:[range]ret[ab][!] [-indentonly] [{new-tabstop}]
Replace all sequences of white-space containing a
<Tab> with new strings of white-space using the new
tabstop value given. If you do not specify a new
tabstop size or it is zero, Vim uses the current value
of 'tabstop'.
<Tab> with new strings of white-space using
{new-tabstop}. If you do not specify {new-tabstop} or
it is zero, Vim uses the current value of 'tabstop'.
The current value of 'tabstop' is always used to
compute the width of existing tabs.
With !, Vim also replaces strings of only normal
spaces with tabs where appropriate.
With 'expandtab' on, Vim replaces all tabs with the
appropriate number of spaces.
This command sets 'tabstop' to the new value given,
and if performed on the whole file, which is default,
should not make any visible change.
Careful: This command modifies any <Tab> characters
This command sets 'tabstop' to {new-tabstop} and if
performed on the whole file, which is default, should
not make any visible change.
When [-indentonly] is specified, only the leading
white-space will be targeted. Any other consecutive
white-space will not be changed.
Warning: This command modifies any <Tab> characters
inside of strings in a C program. Use "\t" to avoid
this (that's a good habit anyway).
`:retab!` may also change a sequence of spaces by
@@ -1105,6 +1110,11 @@ inside of strings can change! Also see 'softtabstop' option. >
:[line]pu[t]! [x] Put the text [from register x] before [line] (default
current line).
*:ip* *:iput*
:[line]ip[ut] [x] like |:put|, but adjust indent to the current line
:[line]ip[ut]! [x] like |:put|!, but adjust indent to the current line
["x]]p or *]p* *]<MiddleMouse>*
["x]]<MiddleMouse> Like "p", but adjust the indent to the current line.
Using the mouse only works when 'mouse' contains 'n'
@@ -1139,8 +1149,8 @@ the ":put" command, Vim always inserts the text in the next line. You can
exchange two characters with the command sequence "xp". You can exchange two
lines with the command sequence "ddp". You can exchange two words with the
command sequence "deep" (start with the cursor in the blank space before the
first word). You can use the "']" or "`]" command after the put command to
move the cursor to the end of the inserted text, or use "'[" or "`[" to move
first word). You can use the |']| or |`]| command after the put command to
move the cursor to the end of the inserted text, or use |'[| or |`[| to move
the cursor to the start.
*put-Visual-mode* *v_p* *v_P*
@@ -1239,6 +1249,18 @@ mapped. E.g. |%| is mapped by the matchit plugin.
With each successive deletion or change, Vim shifts the previous contents
of register 1 into register 2, 2 into 3, and so forth, losing the previous
contents of register 9.
*yankring*
To also store yanks (not only deletions) in registers 1-9, try this: >lua
-- Yank-ring: store yanked text in registers 1-9.
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
if vim.v.event.operator == 'y' then
for i = 9, 1, -1 do -- Shift all numbered registers.
vim.fn.setreg(tostring(i), vim.fn.getreg(tostring(i - 1)))
end
end
end,
})
3. Small delete register "- *quote_-* *quote-*
This register contains text from commands that delete less than one line,
@@ -1714,7 +1736,7 @@ B When joining lines, don't insert a space between two multibyte
j Where it makes sense, remove a comment leader when joining lines. For
example, joining:
int i; // the index ~
// in the list ~
// in the list ~
Becomes:
int i; // the index in the list ~
*fo-p*
@@ -1817,6 +1839,7 @@ And a few warnings:
Vim has a sorting function and a sorting command. The sorting function can be
found here: |sort()|, |uniq()|.
Also see |:uniq|.
*:sor* *:sort*
:[range]sor[t][!] [b][f][i][l][n][o][r][u][x] [/{pattern}/]
@@ -1826,7 +1849,7 @@ found here: |sort()|, |uniq()|.
With [!] the order is reversed.
With [i] case is ignored.
*:sort-l*
With [l] sort uses the current collation locale.
Implementation details: strcoll() is used to compare
strings. See |:language| to check or set the collation
@@ -1858,13 +1881,14 @@ found here: |sort()|, |uniq()|.
With [b] sorting is done on the first binary number in
the line (after or inside a {pattern} match).
*:sort-u* *:sort-uniq*
With [u] (u stands for unique) only keep the first of
a sequence of identical lines (ignoring case when [i]
is used). Without this flag, a sequence of identical
lines will be kept in their original order.
Note that leading and trailing white space may cause
lines to be different.
When you just want to make things unique, use |:uniq|.
When /{pattern}/ is specified and there is no [r] flag
the text matched with {pattern} is skipped, so that
@@ -1911,4 +1935,55 @@ The sorting can be interrupted, but if you interrupt it too late in the
process you may end up with duplicated lines. This also depends on the system
library function used.
==============================================================================
8. Deduplicating text *deduplicating* *unique*
Vim has a deduplicating function and a deduplicating command. The
deduplicating function can be found here: |uniq()|.
Also see |:sort-uniq|.
*:uni* *:uniq*
:[range]uni[q][!] [i][l][r][u] [/{pattern}/]
Remove duplicate lines that are adjacent to each other
in [range]. When no range is given, all lines are
processed.
With [i] case is ignored when comparing lines.
With [l] comparison uses the current collation locale.
See |:sort-l| for more details.
With [r] comparison is done on the text that matches
/{pattern}/ instead of the full line.
With [u] only keep lines that do not repeat (i.e., are
not immediately followed by the same line).
With [!] only keep lines that are immediately followed
by a duplicate.
If both [!] and [u] are given, [u] is ignored and [!]
takes effect.
When /{pattern}/ is specified and [r] is not used, the
text matched with {pattern} is skipped and comparison
is done on what comes after the match.
'ignorecase' applies to the pattern, but 'smartcase'
is not used.
Instead of the slash any non-letter can be used.
For example, to remove adjacent duplicate lines based
on the second comma-separated field: >
:uniq /[^,]*,/
< Or to keep only unique lines ignoring the first 5
characters: >
:uniq u /.\{5}/
< If {pattern} is empty (e.g. // is used), the last
search pattern is used.
Note that leading and trailing white space may cause
lines to be considered different.
To remove all duplicates regardless of position, use
|:sort-u| or external tools.
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -177,84 +177,85 @@ Put this in `uppercase.vim` and run: >bash
==============================================================================
5. Using a prompt buffer *prompt-buffer*
If you want to type input for the job in a Vim window you have a few options:
- Use a normal buffer and handle all possible commands yourself.
This will be complicated, since there are so many possible commands.
- Use a terminal window. This works well if what you type goes directly to
the job and the job output is directly displayed in the window.
See |terminal|.
- Use a window with a prompt buffer. This works well when entering a line for
the job in Vim while displaying (possibly filtered) output from the job.
Prompt buffers provide a "prompt" interface: they are like regular buffers,
except only the last section of the buffer is editable, and the user can
"submit" the prompt by hitting Enter. Useful for implementing:
- chat UI
- REPL or shell plugins
- advanced "picker" plugins
A prompt buffer is created by setting 'buftype' to "prompt". You would
normally only do that in a newly created buffer.
normally only do that in a newly created buffer: >vim
The user can edit and enter one line of text at the very last line of the
buffer. When pressing Enter in the prompt line the callback set with
|prompt_setcallback()| is invoked. It would normally send the line to a job.
Another callback would receive the output from the job and display it in the
buffer, below the prompt (and above the next prompt).
:set buftype=prompt
Only the text in the last line, after the prompt, is editable. The rest of the
buffer is not modifiable with Normal mode commands. It can be modified by
calling functions, such as |append()|. Using other commands may mess up the
buffer.
The user can edit and enter text at the end of the buffer. Pressing Enter in
the prompt section invokes the |prompt_setcallback()| callback, which is
typically expected to process the prompt and show results by appending to the
buffer. To input multiline text, use Shift+Enter to add a new line without
submitting the prompt, or just |put| or |paste| multiline text.
After setting 'buftype' to "prompt" Vim does not automatically start Insert
mode, use `:startinsert` if you want to enter Insert mode, so that the user
can start typing a line.
Only the "prompt" part of the buffer user-editable, given by the |':| mark.
The rest of the buffer is not modifiable with Normal mode commands, though it
can be modified by functions such as |append()|. Using other commands may
mess up the buffer.
The text of the prompt can be set with the |prompt_setprompt()| function. If
no prompt is set with |prompt_setprompt()|, "% " is used. You can get the
effective prompt text for a buffer, with |prompt_getprompt()|.
After setting `buftype=prompt`:
- Nvim unsets the 'comments' option.
- Nvim does not automatically start Insert mode (use `:startinsert` if you
want to enter Insert mode)
The prompt prefix defaults to "% ", but can be set with |prompt_setprompt()|.
You can get the effective prompt prefix for with |prompt_getprompt()|.
The user can go to Normal mode and navigate through the buffer. This can be
useful to see older output or copy text.
The CTRL-W key can be used to start a window command, such as CTRL-W w to
switch to the next window. This also works in Insert mode (use Shift-CTRL-W
to delete a word). When leaving the window Insert mode will be stopped. When
coming back to the prompt window Insert mode will be restored.
By default during prompt insert-mode, the CTRL-W key can be used to start
a window command, such as CTRL-W w to switch to the next window. (Use
Shift-CTRL-W to delete a word). When leaving the window Insert mode will be
stopped. When coming back to the prompt window Insert mode will be restored.
Any command that starts Insert mode, such as "a", "i", "A" and "I", will move
the cursor to the last line. "A" will move to the end of the line, "I" to the
start of the line.
Here is an example for Unix. It starts a shell in the background and prompts
for the next shell command. Output from the shell is displayed above the
prompt. >vim
Example: start a shell in the background and prompt for the next shell
command, displaying shell output above the prompt: >vim
" Function handling a line of text that has been typed.
func TextEntered(text)
" Send the text to a shell with Enter appended.
call chansend(g:shell_job, [a:text, ''])
endfunc
" Handles a line of user input.
func OnSubmit(text)
" Send the text to a shell with Enter appended.
call chansend(g:shell_job, [a:text, ''])
endfunc
" Function handling output from the shell: Add it above the prompt.
func GotOutput(channel, msg, name)
call append(line("$") - 1, a:msg)
endfunc
" Handles output from the shell.
func OnOutput(channel, msg, name)
" Add shell output above the prompt.
call append(line('$') - 1, a:msg)
endfunc
" Function handling the shell exits: close the window.
func JobExit(job, status, event)
quit!
endfunc
" Handles the shell exit.
func JobExit(job, status, event)
quit!
endfunc
" Start a shell in the background.
let shell_job = jobstart(["/bin/sh"], #{
\ on_stdout: function('GotOutput'),
\ on_stderr: function('GotOutput'),
\ on_exit: function('JobExit'),
\ })
" Start a shell in the background.
let shell_job = jobstart(['/bin/sh'], #{
\ on_stdout: function('OnOutput'),
\ on_stderr: function('OnOutput'),
\ on_exit: function('JobExit'),
\ })
new
set buftype=prompt
let buf = bufnr('')
call prompt_setcallback(buf, function("TextEntered"))
call prompt_setprompt(buf, "shell command: ")
new
set buftype=prompt
let buf = bufnr('')
call prompt_setcallback(buf, function('OnSubmit'))
call prompt_setprompt(buf, 'shell command: ')
" start accepting shell commands
startinsert
" Start accepting shell commands.
startinsert
<
vim:tw=78:ts=8:noet:ft=help:norl:
vim:tw=78:ts=8:et:sw=4:ft=help:norl:

View File

@@ -388,7 +388,7 @@ CTRL-D List names that match the pattern in front of the cursor.
to the end.
The 'wildoptions' option can be set to "tagfile" to list the
file of matching tags.
*c_CTRL-I* *c_wildchar* *c_<Tab>*
*c_CTRL-I* *c_wildchar* *c_<Tab>* */_<Tab>*
'wildchar' option
A match is done on the pattern in front of the cursor. The
match (if there are several, the first match) is inserted
@@ -398,6 +398,10 @@ CTRL-D List names that match the pattern in front of the cursor.
again and there were multiple matches, the next
match is inserted. After the last match, the first is used
again (wrap around).
In search context use <CTRL-V><Tab> or "\t" to search for a
literal <Tab> instead of triggering completion.
The behavior can be changed with the 'wildmode' option.
*c_<S-Tab>*
<S-Tab> Like 'wildchar' or <Tab>, but begin with the last match and
@@ -430,7 +434,7 @@ CTRL-G When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-G will move
to the next match (does not take |search-offset| into account)
Use CTRL-T to move to the previous match. Hint: on a regular
keyboard T is above G.
keyboard G is below T.
*c_CTRL-T* */_CTRL-T*
CTRL-T When 'incsearch' is set, entering a search pattern for "/" or
"?" and the current match is displayed then CTRL-T will move
@@ -447,6 +451,8 @@ When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually
ending up back to what was typed. If the first match is not what you wanted,
you can use <S-Tab> or CTRL-P to go straight back to what you typed.
See also |wildtrigger()|.
The 'wildmenu' option can be set to show the matches just above the command
line.
@@ -564,7 +570,6 @@ that see the '"' as part of their argument:
:menu (and the like)
:mkspell
:normal
:ownsyntax
:popup
:registers
:return
@@ -862,7 +867,7 @@ to insert special things while typing you can use the CTRL-R command. For
example, "%" stands for the current file name, while CTRL-R % inserts the
current file name right away. See |c_CTRL-R|.
Note: If you want to avoid the effects of special characters in a Vim script
Note: If you want to avoid the effects of special characters in a Vim script
you may want to use |fnameescape()|. Also see |`=|.
@@ -937,14 +942,6 @@ Note: these are typed literally, they are not special keys!
events).
When the match is with a file name, it is expanded to the
full path.
*:<sfile>* *<sfile>*
<sfile> When executing a `:source` command, is replaced with the
file name of the sourced file. *E498*
When executing a function, is replaced with the call stack,
as with <stack> (this is for backwards compatibility, using
<stack> or <script> is preferred).
Note that filename-modifiers are useless when <sfile> is
not used inside a script.
*:<stack>* *<stack>*
<stack> is replaced with the call stack, using
"function {function-name}[{lnum}]" for a function line
@@ -952,7 +949,7 @@ Note: these are typed literally, they are not special keys!
".." in between items. E.g.:
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
If there is no call stack you get error *E489* .
*:<script>* *<script>*
*:<script>* *<script>* *E498*
<script> When executing a `:source` command, is replaced with the file
name of the sourced file. When executing a function, is
replaced with the file name of the script where it is
@@ -971,7 +968,7 @@ Note: these are typed literally, they are not special keys!
*filename-modifiers*
*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S*
*%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S*
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>",
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<script>",
"<afile>" or "<abuf>". They are also used with the |fnamemodify()| function.
These modifiers can be given, in this order:
:p Make file name a full path. Must be the first modifier. Also
@@ -1242,8 +1239,10 @@ Example: >
:au CmdwinLeave : let &cpt = b:cpt_save
This sets 'complete' to use completion in the current window for |i_CTRL-N|.
Another example: >
:au CmdwinEnter [/?] startinsert
:au CmdwinEnter [/\?] startinsert
This will make Vim start in Insert mode in the command-line window.
Note: The "?" needs to be escaped, as this is a |file-pattern|. See also
|cmdline-autocompletion|.
*cmdline-char* *cmdwin-char*
The character used for the pattern indicates the type of command-line:

View File

@@ -160,5 +160,4 @@ In WinDbg: choose Open Crash Dump on the File menu. Follow the instructions in
Visual Studio 2017 Community Edition can be downloaded for free from:
https://visualstudio.microsoft.com/downloads/
=========================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -12,6 +12,42 @@ They should not be used in new scripts, and old scripts should be updated.
==============================================================================
Deprecated features
------------------------------------------------------------------------------
DEPRECATED IN 0.12 *deprecated-0.12*
API
• todo
DIAGNOSTICS
• "float" in |vim.diagnostic.JumpOpts|. Use "on_jump" instead.
• "float" in |vim.diagnostic.Opts.Jump|. Use "on_jump" instead.
HIGHLIGHTS
• *:ownsyntax* *w:current_syntax* Use 'winhighlight' instead.
LSP
• *vim.lsp.client_is_stopped()* Use |vim.lsp.get_client_by_id()| instead.
• *vim.lsp.util.stylize_markdown()* Use |vim.treesitter.start()| with
`vim.wo.conceallevel = 2`.
• *vim.lsp.log.should_log()* Use |vim.lsp.log.set_format_func()| instead
and return `nil` to omit entries from the logfile.
• *vim.lsp.semantic_tokens.start()* Use `vim.lsp.semantic_tokens.enable(true)` instead
• *vim.lsp.semantic_tokens.stop()* Use `vim.lsp.semantic_tokens.enable(false)` instead
• *vim.lsp.set_log_level()* Use `vim.lsp.log.set_level()` instead
• *vim.lsp.get_log_path()* Use `vim.lsp.log.get_filename()` instead
LUA
• *vim.diff()* Renamed to |vim.text.diff()|
VIMSCRIPT
• todo
------------------------------------------------------------------------------
DEPRECATED IN 0.11 *deprecated-0.11*
@@ -66,7 +102,7 @@ LUA
• vim.validate(opts: table) Use form 1. See |vim.validate()|.
VIMSCRIPT
• *termopen()* Use |jobstart() with `{term: v:true}`.
• *termopen()* Use |jobstart()| with `{term: v:true}`.
------------------------------------------------------------------------------
DEPRECATED IN 0.10 *deprecated-0.10*
@@ -298,13 +334,12 @@ UI EXTENSIONS
• *term_background* Unused. The terminal background color is now detected
by the Nvim core directly instead of the TUI.
VARIABLES
VIMSCRIPT
• *<sfile>* Use |<script>| or |<stack>| instead.
• *b:terminal_job_pid* Use `jobpid(&channel)` instead.
• *b:terminal_job_id* Use `&channel` instead. To access in non-current buffer:
• Lua: `vim.bo[bufnr].channel`
• Vimscript: `getbufvar(bufnr, '&channel')`
VIMSCRIPT
• *buffer_exists()* Obsolete name for |bufexists()|.
• *buffer_name()* Obsolete name for |bufname()|.
• *buffer_number()* Obsolete name for |bufnr()|.

View File

@@ -53,6 +53,27 @@ Other references:
- https://github.com/neovim/neovim/pull/21605
==============================================================================
API
*dev-api-fast*
API functions and Vimscript "eval" functions may be marked as |api-fast| which
means they are safe to call in Lua callbacks and other scenarios. A functions
CANNOT be marked as "fast" if could trigger `os_breakcheck()`, which may
"yield" the current execution and start a new execution of code not expecting
this:
- accidentally recursing into a function not expecting this.
- changing (global) state without restoring it before returning to the
"yielded" callsite.
In practice, this means any code that could trigger `os_breakcheck()` cannot
be "fast". For example, commit 3940c435e405 fixed such a bug with
`nvim__get_runtime` by explicitly disallowing `os_breakcheck()` via the
`EW_NOBREAK` flag.
Common examples of non-fast code: regexp matching, wildcard expansion,
expression evaluation.
==============================================================================

View File

@@ -255,8 +255,7 @@ functions. >c
Integration with declarations generator ~
Every C file must contain #include of the generated header file, guarded by
#ifdef INCLUDE_GENERATED_DECLARATIONS.
Every C file must contain #include of the generated header file.
Include must go after other #includes and typedefs in .c files and after
everything else in header files. It is allowed to omit #include in a .c file
@@ -272,9 +271,7 @@ contain only non-static function declarations. >c
typedef int FooType;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "foo.c.generated.h"
#endif
#include "foo.c.generated.h"
@@ -284,9 +281,7 @@ contain only non-static function declarations. >c
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "foo.h.generated.h"
#endif
#include "foo.h.generated.h"
64-bit Portability ~
@@ -901,8 +896,8 @@ Return Values ~
Do not needlessly surround the `return` expression with parentheses.
Use parentheses in `return expr`; only where you would use them in `x =
expr;`. >c
Use parentheses in `return expr;` only where you would also use them in
`x = expr;`. >c
return result;
return (some_long_condition && another_condition);

View File

@@ -171,8 +171,8 @@ USING GDBSERVER IN TMUX
Consider using a custom makefile
https://github.com/neovim/neovim/blob/master/BUILD.md#custom-makefile to
quickly start debugging sessions using the `gdbserver` method mentioned above.
This example `local.mk` will create the debugging session when you type `make
debug`.
This example `local.mk` will create the debugging session when you type
`make debug`.
>make
.PHONY: dbg-start dbg-attach debug build

View File

@@ -311,7 +311,7 @@ Nvim's filetype detection behavior matches Vim, but is implemented as part of
|vim.filetype| (see `$VIMRUNTIME/lua/vim/filetype.lua`). The logic is encoded in
three tables, listed in order of precedence (the first match is returned):
1. `filename` for literal full path or basename lookup;
2. `pattern` for matching filenames or paths against |lua-patterns|, optimized
2. `pattern` for matching filenames or paths against |lua-pattern|s, optimized
for fast lookup;
3. `extension` for literal extension lookup.

View File

@@ -201,7 +201,7 @@ Docstring format:
- Markdown is supported.
- Tags are written as `[tag]()`.
- References are written as `[tag]`
- Use ``` for code samples.
- Use "```" for code samples.
Code samples can be annotated as `vim` or `lua`
Example: the help for |nvim_open_win()| is generated from a docstring defined
@@ -245,7 +245,7 @@ Docstring format:
- Markdown is supported.
- Tags are written as `[tag]()`.
- References are written as `[tag]`
- Use ``` for code samples.
- Use "```" for code samples.
Code samples can be annotated as `vim` or `lua`
- Use `@since <api-level>` to note the |api-level| when the function became
"stable". If `<api-level>` is greater than the current stable release (or
@@ -353,7 +353,7 @@ Where possible, these patterns apply to _both_ Lua and the API:
- Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|
- Any function signature that accepts a callback (example: |table.foreach()|)
should place it as the LAST parameter (after opts), if possible (or ALWAYS
for "continuation callbacks"—functions called exactly once).
for |continuation|s——functions called exactly once).
- Improves readability by placing the less "noisy" arguments near the start.
- Consistent with luv.
- Useful for future async lib which transforms functions of the form
@@ -426,6 +426,9 @@ Use existing common {verb} names (actions) if possible:
- add: Appends or inserts into a collection
- attach: Listens to something to get events from it (TODO: rename to "on"?)
- call: Calls a function
- callback |continuation|: Function parameter (NOT a field) that
returns the result of an async function. Use the "on_…"
naming-convention for all other callbacks and event handlers.
- cancel: Cancels or dismisses an event or interaction, typically
user-initiated and without error. (Compare "abort", which
cancels and signals error/failure.)
@@ -441,8 +444,11 @@ Use existing common {verb} names (actions) if possible:
- get: Gets things. Two variants (overloads):
1. `get<T>(id: int): T` returns one item.
2. `get<T>(filter: dict): T[]` returns a list.
- has: Checks for the presence of an item, feature, etc.
- inspect: Presents a high-level, often interactive, view
- is_enabled: Checks if functionality is enabled.
- on_…: Handles events or async results, or registers such
a handler. |dev-name-events|
- open: Opens something (a buffer, window, …)
- parse: Parses something into a structured form
- set: Sets a thing (or group of things)
@@ -452,6 +458,7 @@ Use existing common {verb} names (actions) if possible:
- try_{verb}: Best-effort operation, failure returns null or error obj
Do NOT use these deprecated verbs:
- contains: Prefer "has".
- disable: Prefer `enable(enable: boolean)`.
- exit: Prefer "cancel" (or "stop" if appropriate).
- is_disabled: Prefer `is_enabled()`.
@@ -475,7 +482,6 @@ everywhere, not "buffer" in some places and "buf" in others.
Do NOT use these deprecated nouns:
- buffer Use "buf" instead
- callback Use on_foo instead
- command Use "cmd" instead
- window Use "win" instead
@@ -493,6 +499,14 @@ Use this format to name API (RPC) events: >
Example: >
nvim_buf_changedtick_event
<
*continuation*
A "continuation" is implemented as a callback function that returns the result
of an async function and is called exactly once. Often accepts `err` as the
first parameter, to avoid erroring on the main thread. Example: >
foo(…, callback: fun(err, …))
Use the name `callback` only for a continuation. All other callbacks and event
handlers should be named with the |dev-name-events| "on_…" convention.
*dev-api-name*
Use this format to name new RPC |API| functions: >
nvim_{topic}_{verb}_{arbitrary-qualifiers}
@@ -666,6 +680,8 @@ External UIs are expected to implement these common features:
the user).
- Support the text decorations/attributes given by |ui-event-hl_attr_define|.
The "url" attr should be presented as a clickable hyperlink.
- Handle the "restart" UI event so that |:restart| works.
- Detect capslock and show an indicator if capslock is active.
vim:tw=78:ts=8:sw=4:et:ft=help:norl:

View File

@@ -69,6 +69,16 @@ Functions that take a severity as an optional parameter (e.g.
<
This form allows users to filter for specific severities
==============================================================================
DEFAULTS *diagnostic-defaults*
These diagnostic keymaps are created unconditionally when Nvim starts:
- `]d` jumps to the next diagnostic in the buffer. |]d-default|
- `[d` jumps to the previous diagnostic in the buffer. |[d-default|
- `]D` jumps to the last diagnostic in the buffer. |]D-default|
- `[D` jumps to the first diagnostic in the buffer. |[D-default|
- `<C-w>d` shows diagnostic at cursor in a floating window. |CTRL-W_d-default|
==============================================================================
HANDLERS *diagnostic-handlers*
@@ -180,6 +190,28 @@ the `virtual_lines` handler with the following keymap: >lua
end, { desc = 'Toggle diagnostic virtual_lines' })
<
*diagnostic-on-jump-example*
You can use the `on_jump` option from |vim.diagnostic.jump()| to show the
diagnostic that was jumped to using a specific handler. For example, the
following uses the `virtual_lines` handler when jumping to a diagnostic: >lua
local virt_lines_ns = vim.api.nvim_create_namespace 'on_diagnostic_jump'
--- @param diagnostic? vim.Diagnostic
--- @param bufnr integer
local function on_jump(diagnostic, bufnr)
if not diagnostic then return end
vim.diagnostic.show(
virt_lines_ns,
bufnr,
{ diagnostic },
{ virtual_lines = { current_line = true }, virtual_text = false }
)
end
vim.diagnostic.config({ jump = { on_jump = on_jump } })
<
*diagnostic-loclist-example*
Whenever the |location-list| is opened, the following `show` handler will show
the most recent diagnostics: >lua
@@ -269,6 +301,26 @@ DiagnosticVirtualTextHint
DiagnosticVirtualTextOk
Used for "Ok" diagnostic virtual text.
*hl-DiagnosticVirtualLinesError*
DiagnosticVirtualLinesError
Used for "Error" diagnostic virtual lines.
*hl-DiagnosticVirtualLinesWarn*
DiagnosticVirtualLinesWarn
Used for "Warn" diagnostic virtual lines.
*hl-DiagnosticVirtualLinesInfo*
DiagnosticVirtualLinesInfo
Used for "Info" diagnostic virtual lines.
*hl-DiagnosticVirtualLinesHint*
DiagnosticVirtualLinesHint
Used for "Hint" diagnostic virtual lines.
*hl-DiagnosticVirtualLinesOk*
DiagnosticVirtualLinesOk
Used for "Ok" diagnostic virtual lines.
*hl-DiagnosticUnderlineError*
DiagnosticUnderlineError
Used to underline "Error" diagnostics.
@@ -388,27 +440,43 @@ Example: >lua
Lua module: vim.diagnostic *diagnostic-api*
*vim.Diagnostic*
Extends: |vim.Diagnostic.Set|
*diagnostic-structure*
Diagnostics use the same indexing as the rest of the Nvim API (i.e.
0-based rows and columns). |api-indexing|
Fields: ~
• {bufnr}? (`integer`) Buffer number
• {lnum} (`integer`) The starting line of the diagnostic
(0-indexed)
• {end_lnum}? (`integer`) The final line of the diagnostic (0-indexed)
• {bufnr} (`integer`) Buffer number
• {end_lnum} (`integer`) The final line of the diagnostic (0-indexed)
• {col} (`integer`) The starting column of the diagnostic
(0-indexed)
• {end_col}? (`integer`) The final column of the diagnostic
• {end_col} (`integer`) The final column of the diagnostic
(0-indexed)
• {severity}? (`vim.diagnostic.Severity`) The severity of the
• {severity} (`vim.diagnostic.Severity`) The severity of the
diagnostic |vim.diagnostic.severity|
• {namespace}? (`integer`)
*vim.Diagnostic.Set*
Diagnostics use the same indexing as the rest of the Nvim API (i.e.
0-based rows and columns). |api-indexing|
Fields: ~
• {lnum} (`integer`) The starting line of the diagnostic
(0-indexed)
• {col}? (`integer`, default: `0`) The starting column of the
diagnostic (0-indexed)
• {end_lnum}? (`integer`, default: `lnum`) The final line of the
diagnostic (0-indexed)
• {end_col}? (`integer`, default: `col`) The final column of the
diagnostic (0-indexed)
• {severity}? (`vim.diagnostic.Severity`, default: `vim.diagnostic.severity.ERROR`)
The severity of the diagnostic |vim.diagnostic.severity|
• {message} (`string`) The diagnostic text
• {source}? (`string`) The source of the diagnostic
• {code}? (`string|integer`) The diagnostic code
• {user_data}? (`any`) arbitrary data plugins can add
• {namespace}? (`integer`)
*vim.diagnostic.GetOpts*
A table with the following keys:
@@ -420,6 +488,9 @@ Lua module: vim.diagnostic *diagnostic-api*
specified line number.
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
• {enabled}? (`boolean`, default: `nil`) Limit diagnostics to only
enabled or disabled. If nil, enablement is ignored. See
|vim.diagnostic.enable()|
*vim.diagnostic.JumpOpts*
Extends: |vim.diagnostic.GetOpts|
@@ -445,13 +516,9 @@ Lua module: vim.diagnostic *diagnostic-api*
file or not. Similar to 'wrapscan'.
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
• {float}? (`boolean|vim.diagnostic.Opts.Float`, default: `false`)
If `true`, call |vim.diagnostic.open_float()| after
moving. If a table, pass the table as the {opts}
parameter to |vim.diagnostic.open_float()|. Unless
overridden, the float will show diagnostics at the new
cursor position (as if "cursor" were passed to the
"scope" option).
• {on_jump}? (`fun(diagnostic:vim.Diagnostic?, bufnr:integer)`)
Optional callback invoked with the diagnostic that was
jumped to.
• {winid}? (`integer`, default: `0`) Window ID
*vim.diagnostic.NS*
@@ -505,7 +572,8 @@ Lua module: vim.diagnostic *diagnostic-api*
Fields: ~
• {bufnr}? (`integer`, default: current buffer) Buffer number
to show diagnostics from.
• {namespace}? (`integer`) Limit diagnostics to the given namespace
• {namespace}? (`integer|integer[]`) Limit diagnostics to the given
namespace(s).
• {scope}? (`'line'|'buffer'|'cursor'|'c'|'l'|'b'`, default:
`line`) Show diagnostics from the whole buffer
(`buffer"`, the current cursor line (`line`), or the
@@ -563,8 +631,8 @@ Lua module: vim.diagnostic *diagnostic-api*
*vim.diagnostic.Opts.Jump*
Fields: ~
• {float}? (`boolean|vim.diagnostic.Opts.Float`, default: false)
Default value of the {float} parameter of
• {on_jump}? (`fun(diagnostic:vim.Diagnostic?, bufnr:integer)`)
Default value of the {on_jump} parameter of
|vim.diagnostic.jump()|.
• {wrap}? (`boolean`, default: true) Default value of the {wrap}
parameter of |vim.diagnostic.jump()|.
@@ -574,8 +642,8 @@ Lua module: vim.diagnostic *diagnostic-api*
*vim.diagnostic.Opts.Signs*
Fields: ~
• {severity}? (`vim.diagnostic.SeverityFilter`) Only show virtual text
for diagnostics matching the given severity
• {severity}? (`vim.diagnostic.SeverityFilter`) Only show signs for
diagnostics matching the given severity
|diagnostic-severity|
• {priority}? (`integer`, default: `10`) Base priority to use for
signs. When {severity_sort} is used, the priority of a
@@ -607,6 +675,9 @@ Lua module: vim.diagnostic *diagnostic-api*
*vim.diagnostic.Opts.VirtualLines*
Fields: ~
• {severity}? (`vim.diagnostic.SeverityFilter`) Only show virtual
lines for diagnostics matching the given severity
|diagnostic-severity|
• {current_line}? (`boolean`, default: `false`) Only show diagnostics
for the current line.
• {format}? (`fun(diagnostic:vim.Diagnostic): string?`) A
@@ -621,8 +692,12 @@ Lua module: vim.diagnostic *diagnostic-api*
• {severity}? (`vim.diagnostic.SeverityFilter`) Only show
virtual text for diagnostics matching the given
severity |diagnostic-severity|
• {current_line}? (`boolean`) Only show diagnostics for the
current line. (default `false`)
• {current_line}? (`boolean`) Show or hide diagnostics based on
the current cursor line. If `true`, only
diagnostics on the current cursor line are
shown. If `false`, all diagnostics are shown
except on the current cursor line. If `nil`, all
diagnostics are shown. (default `nil`)
• {source}? (`boolean|"if_many"`) Include the diagnostic
source in virtual text. Use `'if_many'` to only
show sources if there is more than one
@@ -881,7 +956,7 @@ set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Parameters: ~
• {namespace} (`integer`) The diagnostic namespace
• {bufnr} (`integer`) Buffer number
• {diagnostics} (`vim.Diagnostic[]`) See |vim.Diagnostic|.
• {diagnostics} (`vim.Diagnostic.Set[]`) See |vim.Diagnostic.Set|.
• {opts} (`vim.diagnostic.Opts?`) Display options to pass to
|vim.diagnostic.show()|. See |vim.diagnostic.Opts|.
@@ -890,8 +965,8 @@ setloclist({opts}) *vim.diagnostic.setloclist()*
Parameters: ~
• {opts} (`table?`) Configuration table with the following keys:
• {namespace}? (`integer`) Only add diagnostics from the given
namespace.
• {namespace}? (`integer[]|integer`) Only add diagnostics from
the given namespace(s).
• {winnr}? (`integer`, default: `0`) Window number to set
location list for.
• {open}? (`boolean`, default: `true`) Open the location list
@@ -900,14 +975,19 @@ setloclist({opts}) *vim.diagnostic.setloclist()*
"Diagnostics".
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
• {format}? (`fun(diagnostic:vim.Diagnostic): string?`) A
function that takes a diagnostic as input and returns a
string or nil. If the return value is nil, the diagnostic is
not displayed in the location list. Else the output text is
used to display the diagnostic.
setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list.
Parameters: ~
• {opts} (`table?`) Configuration table with the following keys:
• {namespace}? (`integer`) Only add diagnostics from the given
namespace.
• {namespace}? (`integer[]|integer`) Only add diagnostics from
the given namespace(s).
• {open}? (`boolean`, default: `true`) Open quickfix list
after setting.
• {title}? (`string`) Title of quickfix list. Defaults to
@@ -915,6 +995,11 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
title, it's updated. If not, a new quickfix list is created.
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
• {format}? (`fun(diagnostic:vim.Diagnostic): string?`) A
function that takes a diagnostic as input and returns a
string or nil. If the return value is nil, the diagnostic is
not displayed in the quickfix list. Else the output text is
used to display the diagnostic.
*vim.diagnostic.show()*
show({namespace}, {bufnr}, {diagnostics}, {opts})
@@ -934,6 +1019,23 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
• {opts} (`vim.diagnostic.Opts?`) Display options. See
|vim.diagnostic.Opts|.
status({bufnr}) *vim.diagnostic.status()*
Returns formatted string with diagnostics for the current buffer. The
severities with 0 diagnostics are left out. Example `E:2 W:3 I:4 H:5`
To customise appearance, set diagnostic signs text with >lua
vim.diagnostic.config({
signs = { text = { [vim.diagnostic.severity.ERROR] = 'e', ... } }
})
<
Parameters: ~
• {bufnr} (`integer?`) Buffer number to get diagnostics from. Defaults
to 0 for the current buffer
Return: ~
(`string`)
toqflist({diagnostics}) *vim.diagnostic.toqflist()*
Convert a list of diagnostics to a list of quickfix items that can be
passed to |setqflist()| or |setloclist()|.

View File

@@ -214,14 +214,28 @@ The diffs are highlighted with these groups:
|hl-DiffAdd| DiffAdd Added (inserted) lines. These lines exist in
this buffer but not in another.
|hl-DiffChange| DiffChange Changed lines.
|hl-DiffText| DiffText Changed text inside a Changed line. Vim
finds the first character that is different,
and the last character that is different
(searching from the end of the line). The
text in between is highlighted. This means
that parts in the middle that are still the
same are highlighted anyway. The 'diffopt'
flags "iwhite" and "icase" are used here.
|hl-DiffText| DiffText Changed text inside a Changed line. Exact
behavior depends on the `inline:` setting in
'diffopt'.
With `inline:` set to "simple", Vim finds the
first character that is different, and the
last character that is different (searching
from the end of the line). The text in
between is highlighted. This means that parts
in the middle that are still the same are
highlighted anyway. The 'diffopt' flags
"iwhite" and "icase" are used here.
With `inline:` set to "char" or "word", Vim
uses the internal diff library to perform a
detailed diff between the changed blocks and
highlight the exact difference between the
two. Will respect any 'diffopt' flag that
affects internal diff.
Not used when `inline:` is set to "none".
|hl-DiffTextAdd| DiffTextAdd Added text inside a Changed line. Similar to
DiffText, but used when there is no
corresponding text in other buffers. Not used
when `inline:` is set to "simple" or "none".
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
because they don't really exist in this
buffer.
@@ -278,18 +292,20 @@ that the buffers will be equal within the specified range.
When no [range] is given, the diff at the cursor position or just above it is
affected. When [range] is used, Vim tries to only put or get the specified
lines. When there are deleted lines, this may not always be possible.
affected. There can be deleted lines below the last line of the buffer. When
the cursor is on the last line in the buffer and there is no diff above this
line, and no [range] is given, the diff below the cursor position will be used
instead.
There can be deleted lines below the last line of the buffer. When the cursor
is on the last line in the buffer and there is no diff above this line, the
":diffget" and "do" commands will obtain lines from the other buffer.
When [range] is used, Vim tries to only put or get the specified lines. When
there are deleted lines, they will be used if they are between the lines
specified by [range].
To be able to get those lines from another buffer in a [range] it's allowed to
use the last line number plus one. This command gets all diffs from the other
buffer: >
To be able to put or get those lines to/from another buffer in a [range] it's
allowed to use 0 and the last line number plus one. This command gets all
diffs from the other buffer: >
:1,$+1diffget
:0,$+1diffget
Note that deleted lines are displayed, but not counted as text lines. You
can't move the cursor into them. To fill the deleted lines with the lines
@@ -308,9 +324,131 @@ name or a part of a buffer name. Examples:
diff mode (e.g., "file.c.v2")
==============================================================================
5. Diff options *diff-options*
5. Diff anchors *diff-anchors*
Also see |'diffopt'| and the "diff" item of |'fillchars'|.
Diff anchors allow you to control where the diff algorithm aligns and
synchronize text across files. Each anchor matches each other in each file,
allowing you to control the output of a diff.
This is useful when a change involves complicated edits. For example, if a
function was moved to another location and further edited. By default, the
algorithm aims to create the smallest diff, which results in that entire
function being considered to be deleted and added on the other side, making it
hard to see what the actual edit on it was. You can use diff anchors to pin
that function so the diff algorithm will align based on it.
To use it, set anchors using 'diffanchors' which is a comma-separated list of
{address} in each file, and then add "anchor" to 'diffopt'. Internaly, Vim
splits each file up into sections split by the anchors. It performs the diff
on each pair of sections separately before merging the results back.
Setting 'diffanchors' will update the diff immediately. If an anchor is tied
to a mark, and you change what the mark is pointed to, you need to manually
call |:diffupdate| afterwards to get the updated diff results.
Example:
Let's say we have the following files, side-by-side. We are interested in the
change that happened to the function `foo()`, which was both edited and moved.
File A: >
int foo() {
int n = 1;
return n;
}
int g = 1;
int bar(int a) {
a *= 2;
a += 3;
return a;
}
<File B: >
int bar(int a) {
a *= 2;
a += 3;
return a;
}
int foo() {
int n = 999;
return n;
}
int g = 1;
<
A normal diff will usually align the diff result as such: >
int foo() { |----------------
int n = 1; |----------------
return n; |----------------
} |----------------
|----------------
int g = 1; |----------------
|----------------
int bar(int a) {|int bar(int a) {
a *= 2; | a *= 2;
a += 3; | a += 3;
return a; | return a;
} |}
----------------|
----------------|int foo() {
----------------| int n = 999;
----------------| return n;
----------------|}
----------------|
----------------|int g = 1;
<
What we want is to instead ask the diff to align on `foo()`: >
----------------|int bar(int a) {
----------------| a *= 2;
----------------| a += 3;
----------------| return a;
----------------|}
----------------|
int foo() { |int foo() {
int n = 1; | int n = 999;
return n; | return n;
} |}
|
int g = 1; |int g = 1;
|----------------
int bar(int a) {|----------------
a *= 2; |----------------
a += 3; |----------------
return a; |----------------
} |----------------
<
Below are some ways of setting diff anchors to get the above result. In each
example, 'diffopt' needs to have `anchor` set for this to take effect.
Marks: Set the |'a| mark on the `int foo()` lines in each file first before
setting the anchors: >
set diffanchors='a
Pattern: Specify the anchor using a |pattern| (see |:/|). Here, we make sure
to always start search from line 1 for consistency: >
set diffanchors=1/int\ foo(/
<
Selection: Use visual mode to select the entire `foo()` function body in each
file. Here, we use two anchors. This does a better job of making sure only
the function bodies are anchored against each other but not the lines after
it. Note the `'>+1` below. The "+1" is necessary as we want the split to
happen below the last line of the function, not above: >
set diffanchors='<,'>+1
<
Manually set two anchors using line numbers via buffer-local options: >
setlocal diffanchors=1,5
wincmd w
setlocal diffanchors=7,11
<
==============================================================================
6. Diff options *diff-options*
Also see 'diffopt' and the "diff" item of 'fillchars'.
*diff-slow* *diff_translations*
For very long lines, the diff syntax highlighting might be slow, especially

View File

@@ -1094,8 +1094,8 @@ the 1', 2' and 3' digraphs.
⌕ TR 2315 8981 TELEPHONE RECORDER
⌠ Iu 2320 8992 TOP HALF INTEGRAL
⌡ Il 2321 8993 BOTTOM HALF INTEGRAL
</ 2329 9001 LEFT-POINTING ANGLE BRACKET
〉 /> 232A 9002 RIGHT-POINTING ANGLE BRACKET
<[ 27E8 10040 LEFT MATHEMATICAL ANGLE BRACKET
⟩ ]> 27E9 10041 RIGHT MATHEMATICAL ANGLE BRACKET
␣ Vs 2423 9251 OPEN BOX
⑀ 1h 2440 9280 OCR HOOK
⑁ 3h 2441 9281 OCR CHAIR

View File

@@ -630,7 +630,7 @@ list of the current window.
buffer.
Also see |++opt| and |+cmd|.
:[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit*
:[count]arge[dit][!] [++opt] [+cmd] {name} ... *:arge* *:argedit*
Add {name}s to the argument list and edit it.
There is no check for duplicates, it is possible to
add a file to the argument list twice |:argded|.
@@ -645,7 +645,7 @@ list of the current window.
edited. No check for duplicates is done.
Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
:[count]arga[dd] {name} ... *:arga* *:argadd* *E479*
:[count]arga[dd] *E1156*
Add the {name}s to the argument list. When {name} is
omitted add the current buffer name to the argument
@@ -676,7 +676,7 @@ list of the current window.
If your current file is a duplicate, your current file
will change to the original file index.
:argd[elete] {pattern} .. *:argd* *:argdelete* *E480* *E610*
:argd[elete] {pattern} ... *:argd* *:argdelete* *E480* *E610*
Delete files from the argument list that match the
{pattern}s. {pattern} is used like a file pattern,
see |file-pattern|. "%" can be used to delete the
@@ -714,11 +714,14 @@ list of the current window.
omitted the current entry is used.
Also see |++opt| and |+cmd|.
:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *]a* *E165* *E163*
:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163*
Edit [count] next file. This fails when changes have
been made and Vim does not want to |abandon| the
current buffer. Also see |++opt| and |+cmd|.
*]a*
]a Mapped to |:next|. |default-mappings|
:[count]n[ext]! [++opt] [+cmd]
Edit [count] next file, discard any changes to the
buffer. Also see |++opt| and |+cmd|.
@@ -740,16 +743,22 @@ list of the current window.
any changes to the buffer. Also see |++opt| and
|+cmd|.
:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* *[a*
:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous*
Same as :Next. Also see |++opt| and |+cmd|.
*:rew* *:rewind* *[A*
*[a*
[a Mapped to |:previous|. |default-mappings|
*:rew* *:rewind*
:rew[ind] [++opt] [+cmd]
Start editing the first file in the argument list.
This fails when changes have been made and Vim does
not want to |abandon| the current buffer.
Also see |++opt| and |+cmd|.
*[A*
[A Mapped to |:rewind|. |default-mappings|
:rew[ind]! [++opt] [+cmd]
Start editing the first file in the argument list.
Discard any changes to the buffer. Also see |++opt|
@@ -759,13 +768,16 @@ list of the current window.
:fir[st][!] [++opt] [+cmd]
Other name for ":rewind".
*:la* *:last* *]A*
*:la* *:last*
:la[st] [++opt] [+cmd]
Start editing the last file in the argument list.
This fails when changes have been made and Vim does
not want to |abandon| the current buffer.
Also see |++opt| and |+cmd|.
*]A*
]A Mapped to |:last|. |default-mappings|
:la[st]! [++opt] [+cmd]
Start editing the last file in the argument list.
Discard any changes to the buffer. Also see |++opt|
@@ -948,8 +960,9 @@ Note: When the 'write' option is off, you are not able to write any file.
executed like with ":!{cmd}", any '!' is replaced with
the previous command |:!|.
The default [range] for the ":w" command is the whole buffer (1,$). If you
write the whole buffer, it is no longer considered changed. When you
The default [range] for the ":w" command is the whole buffer (1,$). The |'[|
and |']| marks will be set to the [range] being used for the write command.
If you write the whole buffer, it is no longer considered changed. When you
write it to a different file with ":w somefile" it depends on the "+" flag in
'cpoptions'. When included, the write command will reset the 'modified' flag,
even though the buffer itself may still be different from its file.
@@ -1229,10 +1242,10 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit*
*:confirm* *:conf*
:conf[irm] {command} Execute {command}, and use a dialog when an
operation has to be confirmed. Can be used on the
|:edit|, |:q|, |:qa| and |:w| commands (the latter to
override a read-only setting), and any commands that
can fail because of unsaved changes, such as |:only|,
|:buffer|, |:bdelete|, etc.
|:edit|, |:restart|, |:q|, |:qa| and |:w| commands
(the latter to override a read-only setting), and any
commands that can fail because of unsaved changes,
such as |:only|, |:buffer|, |:bdelete|, etc.
Examples: >
:confirm w foo
@@ -1303,9 +1316,15 @@ b:browsefilter variable. You would most likely set b:browsefilter in a
filetype plugin, so that the browse dialog would contain entries related to
the type of file you are currently editing. Disadvantage: This makes it
difficult to start editing a file of a different type. To overcome this, you
may want to add "All Files (*.*)\t*\n" as the final filter on Windows or "All
Files (*)\t*\n" on other platforms, so that the user can still access any
desired file.
can add the following as the final filter on Windows: >
All Files\t(*.*)\t*\n
<
Or the following on other platforms, so that the user can still access any
desired file: >
All Files\t(*)\t*\n
<
To avoid setting browsefilter when Vim does not actually support it, you can
use has("browsefilter"): >
@@ -1337,7 +1356,7 @@ exist, the next-higher scope in the hierarchy applies.
:cd[!] {path} Change the current directory to {path}.
If {path} is relative, it is searched for in the
directories listed in |'cdpath'|.
directories listed in 'cdpath'.
Clear any window-local directory.
Does not change the meaning of an already opened file,
because its full path name is remembered. Files from

View File

@@ -187,35 +187,28 @@ Run |:checkhealth| in Nvim for automatic diagnosis.
Other hints:
- The python `neovim` module was renamed to `pynvim` (long ago).
- If you're using pyenv or virtualenv for the `pynvim` module
https://pypi.org/project/pynvim/, you must set `g:python3_host_prog` to
the virtualenv's interpreter path.
- Read |provider-python|.
- Read |provider-python| to learn how to install `pynvim`.
- Be sure you have the latest version of the `pynvim` Python module: >bash
python -m pip install setuptools
python -m pip install --upgrade pynvim
python3 -m pip install --upgrade pynvim
uv tool install --upgrade pynvim
<
See |provider-python| for other installation options.
- If you're manually creating a Python virtual environment for the `pynvim` module
https://pypi.org/project/pynvim/, you must set `g:python3_host_prog` to
the virtualenv's interpreter path.
- Try with `nvim -u NORC` to make sure your config (|init.vim|) isn't causing a
problem. If you get `E117: Unknown function`, that means there's a runtime
issue: |faq-runtime|.
- The python `neovim` module was renamed to `pynvim` (long ago).
:CHECKHEALTH REPORTS E5009: INVALID $VIMRUNTIME ~
This means `health#check()` couldn't load, which suggests that |$VIMRUNTIME|
or 'runtimepath' is broken.
This means |$VIMRUNTIME| or 'runtimepath' is broken.
- |$VIMRUNTIME| must point to Nvim's runtime files, not Vim's.
- The |$VIMRUNTIME| directory contents should be readable by the current user.
- Verify that `:echo &runtimepath` contains the $VIMRUNTIME path.
- Check the output of: >vim
:call health#check()
:verbose func health#check
<
NEOVIM CAN'T FIND ITS RUNTIME ~
@@ -456,10 +449,7 @@ grow and enhance it. Changing the rules of Lua gains nothing in this context.
WILL NEOVIM TRANSLATE VIMSCRIPT TO LUA, INSTEAD OF EXECUTING VIMSCRIPT DIRECTLY? ~
- We are experimenting with vim9jit https://github.com/tjdevries/vim9jit to
transpile Vim9script (Vim9's Vimscript variant) to Lua and have used this to
port Vim9 plugins https://github.com/neovim/neovim/pull/21662 to Nvim Lua.
- We have no plans for transpiling legacy Vimscript.
We have no plans for transpiling Vimscript. It was explored in https://github.com/tjdevries/vim9jit
ARE PLUGIN AUTHORS ENCOURAGED TO PORT THEIR PLUGINS FROM VIMSCRIPT TO LUA? DO YOU PLAN ON SUPPORTING VIMSCRIPT INDEFINITELY? (#1152) ~
@@ -474,4 +464,8 @@ emphatically a fork of Vim in order to leverage the work already spent on
thousands of Vim plugins, while enabling new types of plugins and
integrations.
That being said, reimplementing legacy plugins in Lua in order to make use of
Nvim API and to integrate with Nvim-specific features such as treesitter can
be worthwhile.
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -156,6 +156,8 @@ variables can be used to overrule the filetype used for certain extensions:
`*.inc` g:filetype_inc
`*.lsl` g:filetype_lsl
`*.m` g:filetype_m |ft-mathematica-syntax|
`*[mM]makefile,*.mk,*.mak,[mM]akefile*`
g:make_flavor |ft-make-syntax|
`*.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md`
g:filetype_md |ft-pandoc-syntax|
`*.mod` g:filetype_mod
@@ -262,7 +264,7 @@ D. If your filetype can only be detected by inspecting the contents of the
item of the 'runtimepath' option. Example for Unix: >
:!mkdir -p ~/.config/nvim
<
2. Create a vim script file for doing this. Example: >
2. Create a Vim script file for doing this. Example: >
if did_filetype() " filetype already set..
finish " ..don't do these checks
endif
@@ -623,6 +625,16 @@ possibilities: >
The `:Cycle` command is also mapped to the CTRL-A and CTRL-X keys.
For details, see `git-rebase --help`.
GLEAM *ft-gleam-plugin*
By default the following options are set for the recommended gleam style: >
setlocal expandtab shiftwidth=2 softtabstop=2
To disable this behavior, set the following variable in your vimrc: >
let g:gleam_recommended_style = 0
GO *ft-go-plugin*
By default the following options are set, based on Golang official docs: >
@@ -649,6 +661,32 @@ HARE *ft-hare*
Since the text for this plugin is rather long it has been put in a separate
file: |ft_hare.txt|.
HTML *ft-html-plugin*
Tag folding poses a few difficulties. Many elements, e.g. `blockquote`, are
always delimited by start and end tags; end tags for some elements, e.g. `p`,
can be omitted in certain contexts; void elements, e.g. `hr`, have no end tag.
Although the rules for supporting omissible end tags are ad-hoc and involved
[0], they apply to elements in scope. Assuming syntactical wellformedness, an
end tag can be associated with its nearest matching start tag discoverable in
scope [1] and towards the beginning of a file, whereas all unbalanced tags and
inlined tags can be disregarded. Having syntax highlighting in effect, tag
folding using the |fold-expr| method can be enabled with: >
let g:html_expr_folding = 1
<
By default, tag folding will be redone from scratch after each occurrence of
a |TextChanged| or an |InsertLeave| event. Such frequency may not be desired,
especially for large files, and this recomputation can be disabled with: >
let g:html_expr_folding_without_recomputation = 1
doautocmd FileType
<
To force another recomputation, do: >
unlet! b:foldsmap
normal zx
<
[0] https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
[1] https://en.wikipedia.org/wiki/Dangling_else
IDRIS2 *ft-idris2-plugin*
By default the following options are set: >
@@ -785,8 +823,8 @@ Variables:
For example in C one usually wants section 3 or 2: >
:let b:man_default_sections = '3,2'
*g:man_hardwrap* Hard-wrap to $MANWIDTH or window width if $MANWIDTH is
empty. Enabled by default. Set |FALSE| to enable soft
wrapping.
empty or larger than the window width. Enabled by
default. Set |FALSE| to enable soft wrapping.
To use Nvim as a manpager: >bash
export MANPAGER='nvim +Man!'
@@ -1117,6 +1155,13 @@ functions with [[ and ]]. Move around comments with ]" and [".
The mappings can be disabled with: >
let g:no_vim_maps = 1
YAML *ft-yaml-plugin*
By default, the YAML filetype plugin enables the following options: >
setlocal shiftwidth=2 softtabstop=2
To disable this, set the following variable: >
let g:yaml_recommended_style = 0
ZIG *ft-zig-plugin*

View File

@@ -632,14 +632,17 @@ what you type!
When using an operator, a closed fold is included as a whole. Thus "dl"
deletes the whole closed fold under the cursor.
For Ex commands that work on buffer lines the range is adjusted to always
For Ex commands that operate on buffer lines, the range is adjusted to always
start at the first line of a closed fold and end at the last line of a closed
fold. Thus this command: >
fold. Thus, this command: >
:s/foo/bar/g
when used with the cursor on a closed fold, will replace "foo" with "bar" in
all lines of the fold.
This does not happen for |:folddoopen| and |:folddoclosed|.
Note that for some Ex commands like |:source| the range is only adjusted when
using a two line specifiers [range].
When editing a buffer that has been edited before, the last used folding
settings are used again. For manual folding the defined folds are restored.
For all folding methods the manually opened and closed folds are restored.
@@ -647,5 +650,4 @@ If this buffer has been edited in this window, the values from back then are
used. Otherwise the values from the window where the buffer was edited last
are used.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -76,8 +76,8 @@ The Ada plug-in provides support for:
- user completion (|i_CTRL-X_CTRL-U|)
- tag searches (|tagsrch.txt|)
- Quick Fix (|quickfix.txt|)
- backspace handling (|'backspace'|)
- comment handling (|'comments'|, |'commentstring'|)
- backspace handling ('backspace')
- comment handling ('comments', 'commentstring')
The plug-in only activates the features of the Ada mode whenever an Ada
file is opened and adds Ada related entries to the main and pop-up menu.
@@ -197,7 +197,7 @@ g:gnat.Project_File string
*g:gnat.Make_Command*
g:gnat.Make_Command string
External command used for |g:gnat.Make()| (|'makeprg'|).
External command used for |g:gnat.Make()| ('makeprg').
*g:gnat.Pretty_Program*
g:gnat.Pretty_Program string
@@ -213,7 +213,7 @@ g:gnat.Tags_Command string
*g:gnat.Error_Format*
g:gnat.Error_Format string
Error format (|'errorformat'|)
Error format ('errorformat')
------------------------------------------------------------------------------
4.2 Dec Ada ~
@@ -243,11 +243,11 @@ g:decada.Unit_Name() function
*g:decada.Make_Command*
g:decada.Make_Command string
External command used for |g:decada.Make()| (|'makeprg'|).
External command used for |g:decada.Make()| ('makeprg').
*g:decada.Error_Format*
g:decada.Error_Format string
Error format (|'errorformat'|).
Error format ('errorformat').
==============================================================================
5. References ~
@@ -507,6 +507,4 @@ taglist.vim
The GNU Ada Project distribution (http://gnuada.sourceforge.net) of Vim
contains all of the above.
==============================================================================
vim: textwidth=78 nowrap tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab
vim: filetype=help
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -73,5 +73,4 @@ The maximum search depth can be set to any integer, but using values higher
than 2 is not recommended, and will likely provide no tangible benefit in most
situations.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -60,5 +60,4 @@ Many other distributions are available for Windows like
https://chocolatey.org/packages/less/. Make sure `less` is in a directory
listed in the `PATH` environment variable, which chocolatey above does.
------------------------------------------------------------------------------
vim:ft=help:

View File

@@ -160,7 +160,18 @@ g:rustfmt_emit_files ~
provided) instead of '--write-mode=overwrite'. >vim
let g:rustfmt_emit_files = 0
<
*g:rustfmt_detect_version*
g:rustfmt_detect_version ~
When set to 1, will try to parse the version output from "rustfmt".
Disabled by default for performance reasons >vim
let g:rustfmt_detect_version = 1
<
*g:rustfmt_find_toml*
g:rustfmt_emit_files ~
When set to 1, will try to find "rustfmt.toml" file by searching from
current path upwards. Disabled by default for performance reasons >vim
let g:rustfmt_find_toml = 1
<
*g:rust_playpen_url*
g:rust_playpen_url ~
Set this option to override the url for the playpen to use: >vim
@@ -475,4 +486,4 @@ MAPPINGS *rust-mappings*
This plugin defines mappings for |[[| and |]]| to support hanging indents.
vim:tw=78:sw=4:noet:ts=8:ft=help:norl:
vim:tw=78:sw=4:noet:ts=8:ft=help:norl:

View File

@@ -172,7 +172,7 @@ with comments: >
------------------------------------------------------------------------------
1.4 Macros *sql-macros*
Vim's feature to find macro definitions, |'define'|, is supported using this
Vim's feature to find macro definitions, 'define', is supported using this
regular expression: >
\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>
@@ -249,7 +249,7 @@ key to complete the optional parameter.
After typing the function name and a space, you can use the completion to
supply a parameter. The function takes the name of the Vim script you want to
source. Using the |cmdline-completion| feature, the SQLSetType function will
search the |'runtimepath'| for all Vim scripts with a name containing "sql".
search the 'runtimepath' for all Vim scripts with a name containing "sql".
This takes the guess work out of the spelling of the names. The following are
examples: >
:SQLSetType
@@ -412,7 +412,7 @@ Here are some examples of the entries which are pulled from the syntax files: >
Dynamic mode populates the popups with data directly from a database. In
order for the dynamic feature to be enabled you must have the dbext.vim
plugin installed, (https://vim.sourceforge.net/script.php?script_id=356).
plugin installed, (https://www.vim.org/scripts/script.php?script_id=356).
Dynamic mode is used by several features of the SQL completion plugin.
After installing the dbext plugin see the dbext-tutorial for additional
@@ -496,7 +496,7 @@ depending on the syntax file you are using. The SQL Anywhere syntax file
Dynamic features ~
To take advantage of the dynamic features you must first install the
dbext.vim plugin (https://vim.sourceforge.net/script.php?script_id=356). It
dbext.vim plugin (https://www.vim.org/scripts/script.php?script_id=356). It
also comes with a tutorial. From the SQL completion plugin's perspective,
the main feature dbext provides is a connection to a database. dbext
connection profiles are the most efficient mechanism to define connection
@@ -760,7 +760,7 @@ Step 1 ~
Begins by editing a Perl file. Vim automatically sets the filetype to
"perl". By default, Vim runs the appropriate filetype file
ftplugin/perl.vim. If you are using the syntax completion plugin by following
the directions at |ft-syntax-omni| then the |'omnifunc'| option has been set to
the directions at |ft-syntax-omni| then the 'omnifunc' option has been set to
"syntax#Complete". Pressing <C-X><C-O> will display the omni popup containing
the syntax items for Perl.
@@ -772,7 +772,7 @@ maps for SQL completion, see |sql-completion-maps|. Now these maps have
been created and the SQL completion plugin has been initialized. All SQL
syntax items have been cached in preparation. The SQL filetype script detects
we are attempting to use two different completion plugins. Since the SQL maps
begin with <C-C>, the maps will toggle the |'omnifunc'| when in use. So you
begin with <C-C>, the maps will toggle the 'omnifunc' when in use. So you
can use <C-X><C-O> to continue using the completion for Perl (using the syntax
completion plugin) and <C-C> to use the SQL completion features.

View File

@@ -17,6 +17,8 @@ TUI and GUI (assuming the UI supports the given feature). See |TUI| for notes
specific to the terminal UI. Help tags with the "gui-" prefix refer to UI
features, whereas help tags with the "ui-" prefix refer to the |ui-protocol|.
Type |gO| to see the table of contents.
==============================================================================
Third-party GUIs *third-party-guis* *vscode*
@@ -34,8 +36,6 @@ a Nvim GUI.
- VimR (macOS) https://github.com/qvacua/vimr
- Others https://github.com/neovim/neovim/wiki/Related-projects#gui
Type |gO| to see the table of contents.
==============================================================================
Starting the GUI *gui-config* *gui-start*
@@ -64,7 +64,50 @@ Stop or detach the current UI
the channel to be closed, it may be (incorrectly) reported as
an error.
Note: Not supported on Windows, currently.
Note: Not supported on Windows yet.
------------------------------------------------------------------------------
Restart Nvim
*:restart*
:restart [+cmd] [command]
Restarts Nvim.
1. Stops Nvim using `:qall!` (or |+cmd|, if given).
2. Starts a new Nvim server using the same |v:argv|,
optionally running [command] at startup. |-c|
3. Attaches the current UI to the new Nvim server. Other UIs
(if any) will not reattach on restart (this may change in
the future).
Use with `:confirm` to prompt if changes have been made.
Example: stop with `:qall!`, then restart: >
:restart +qall!
< Example: restart and restore the current session: >
:mksession! Session.vim | restart source Session.vim
< Example: restart and update plugins: >
:restart +qall! lua vim.pack.update()
<
Note: Only works if the UI and server are on the same system.
Note: If the UI hasn't implemented the "restart" UI event,
this command is equivalent to `:qall!`.
------------------------------------------------------------------------------
Connect UI to a different server
*:connect*
:connect {address}
Detaches the UI from the server it is currently attached to
and attaches it to the server at {address} instead.
Note: If the current UI hasn't implemented the "connect" UI
event, this command is equivalent to |:detach|.
:connect! {address}
Same as |:connect| but it also stops the detached server if
no other UI is currently attached to it.
------------------------------------------------------------------------------
GUI commands

View File

@@ -9,18 +9,18 @@
==============================================================================
Checkhealth *vim.health* *health*
vim.health is a minimal framework to help users troubleshoot configuration and
any other environment conditions that a plugin might care about. Nvim ships
with healthchecks for configuration, performance, python support, ruby
support, clipboard support, and more.
To run all healthchecks, use: >vim
:checkhealth
:checkhealth
<
Plugin authors are encouraged to write new healthchecks. |health-dev|
COMMANDS *health-commands*
*:che* *:checkhealth*
@@ -56,7 +56,6 @@ Local mappings in the healthcheck buffer:
q Closes the window.
Global configuration:
*g:health*
g:health Dictionary with the following optional keys:
- `style` (`'float'|nil`) Set to "float" to display :checkhealth in
@@ -65,16 +64,26 @@ g:health Dictionary with the following optional keys:
Example: >lua
vim.g.health = { style = 'float' }
Local configuration:
Checkhealth sets its buffer filetype to "checkhealth". You can customize the
buffer by handling the |FileType| event. For example if you don't want emojis
in the health report: >vim
autocmd FileType checkhealth :set modifiable | silent! %s/\v( ?[^\x00-\x7F])//g
<
--------------------------------------------------------------------------------
Create a healthcheck *health-dev*
Healthchecks are functions that check the user environment, configuration, or
any other prerequisites that a plugin cares about. Nvim ships with
healthchecks in:
- $VIMRUNTIME/autoload/health/
- $VIMRUNTIME/lua/vim/lsp/health.lua
- $VIMRUNTIME/lua/vim/treesitter/health.lua
- and more...
$VIMRUNTIME/autoload/health/
$VIMRUNTIME/lua/vim/lsp/health.lua
$VIMRUNTIME/lua/vim/treesitter/health.lua
and more...
To add a new healthcheck for your own plugin, simply create a "health.lua"
module on 'runtimepath' that returns a table with a "check()" function. Then
@@ -82,35 +91,35 @@ module on 'runtimepath' that returns a table with a "check()" function. Then
For example if your plugin is named "foo", define your healthcheck module at
one of these locations (on 'runtimepath'):
- lua/foo/health/init.lua
- lua/foo/health.lua
lua/foo/health/init.lua
lua/foo/health.lua
If your plugin also provides a submodule named "bar" for which you want
a separate healthcheck, define the healthcheck at one of these locations:
- lua/foo/bar/health/init.lua
- lua/foo/bar/health.lua
If your plugin also provides a submodule named "bar" for which you want a
separate healthcheck, define the healthcheck at one of these locations:
lua/foo/bar/health/init.lua
lua/foo/bar/health.lua
All such health modules must return a Lua table containing a `check()`
function.
Copy this sample code into `lua/foo/health.lua`, replacing "foo" in the path
with your plugin name: >lua
local M = {}
local M = {}
M.check = function()
vim.health.start("foo report")
-- make sure setup function parameters are ok
if check_setup() then
vim.health.ok("Setup is correct")
else
vim.health.error("Setup is incorrect")
end
-- do some more checking
-- ...
end
M.check = function()
vim.health.start("foo report")
-- make sure setup function parameters are ok
if check_setup() then
vim.health.ok("Setup is correct")
else
vim.health.error("Setup is incorrect")
end
-- do some more checking
-- ...
end
return M
return M
<
error({msg}, {...}) *vim.health.error()*

View File

@@ -112,7 +112,6 @@ API (EXTENSIBILITY/SCRIPTING/PLUGINS)
|channel| Nvim asynchronous IO
|vimscript| Vimscript reference
|vimscript-functions| Vimscript functions
|testing.txt| Vimscript testing functions
|remote-plugin| Nvim remote plugins
|health| Health checking

View File

@@ -337,7 +337,7 @@ in such a modeline, that can have undesired consequences.
TAGS
To define a help tag, place the name between asterisks (*tag-name*). The
To define a help tag, place the name between asterisks ("*tag-name*"). The
tag-name should be different from all the Vim help tag names and ideally
should begin with the name of the Vim plugin. The tag name is usually right
aligned on a line.
@@ -373,11 +373,17 @@ To quote a block of ex-commands verbatim, place a greater than (>) character
at the end of the line before the block and a less than (<) character as the
first non-blank on a line following the block. Any line starting in column 1
also implicitly stops the block of ex-commands before it. E.g. >
function Example_Func()
echo "Example"
endfunction
function Example_Func()
echo "Example"
endfunction
<
To enable syntax highlighting for a block of code, place a language name
annotation (e.g. "vim") after a greater than (>) character. E.g. >vim
function Example_Func()
echo "Example"
endfunction
<
*help-notation*
The following are highlighted differently in a Vim help file:
- a special key name expressed either in <> notation as in <PageDown>, or
as a Ctrl character as in CTRL-X
@@ -391,4 +397,10 @@ highlighting. So do these:
You can find the details in $VIMRUNTIME/syntax/help.vim
FILETYPE COMPLETION *ft-help-omni*
To get completion for help tags when writing a tag reference, you can use the
|i_CTRL-X_CTRL-O| command.
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -268,5 +268,4 @@ These are also available via the "main" package:
$main::curwin The current Window object.
$main::curbuf The current Buffer object.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -645,6 +645,6 @@ To check if `pyx*` functions and commands are available: >vim
if has('pythonx')
echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
endif
<
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -189,5 +189,4 @@ evaluate Ruby expressions and pass their values to Vim script.
The Ruby value "true", "false" and "nil" are converted to v:true, v:false and
v:null, respectively.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -146,6 +146,7 @@ commands in CTRL-X submode *i_CTRL-X_index*
|i_CTRL-X_CTRL-N| CTRL-X CTRL-N next completion
|i_CTRL-X_CTRL-O| CTRL-X CTRL-O omni completion
|i_CTRL-X_CTRL-P| CTRL-X CTRL-P previous completion
|i_CTRL-X_CTRL-R| CTRL-X CTRL-R complete contents from registers
|i_CTRL-X_CTRL-S| CTRL-X CTRL-S spelling suggestions
|i_CTRL-X_CTRL-T| CTRL-X CTRL-T complete identifiers from thesaurus
|i_CTRL-X_CTRL-Y| CTRL-X CTRL-Y scroll down
@@ -515,7 +516,7 @@ tag command action in op-pending and Visual mode ~
tag command action in Normal mode ~
------------------------------------------------------------------------------ ~
|CTRL-W_CTRL-B| CTRL-W CTRL-B same as "CTRL-W b"
|CTRL-W_CTRL-C| CTRL-W CTRL-C same as "CTRL-W c"
|CTRL-W_CTRL-C| CTRL-W CTRL-C no-op
|CTRL-W_CTRL-D| CTRL-W CTRL-D same as "CTRL-W d"
|CTRL-W_CTRL-F| CTRL-W CTRL-F same as "CTRL-W f"
CTRL-W CTRL-G same as "CTRL-W g .."
@@ -1016,7 +1017,7 @@ tag command action in Command-line editing mode ~
|c_CTRL-D| CTRL-D list completions that match the pattern in
front of the cursor
|c_CTRL-E| CTRL-E cursor to end of command-line
|'cedit'| CTRL-F default value for 'cedit': opens the
'cedit' CTRL-F default value for 'cedit': opens the
command-line window; otherwise not used
|c_CTRL-G| CTRL-G next match when 'incsearch' is active
|c_<BS>| <BS> delete the character in front of the cursor
@@ -1265,6 +1266,7 @@ tag command action ~
|:delcommand| :delc[ommand] delete user-defined command
|:delfunction| :delf[unction] delete a user function
|:delmarks| :delm[arks] delete marks
|:detach| :detach detach the current UI
|:diffupdate| :dif[fupdate] update 'diff' buffers
|:diffget| :diffg[et] remove differences in current buffer
|:diffoff| :diffo[ff] switch off diff mode
@@ -1348,6 +1350,8 @@ tag command action ~
|:inoreabbrev| :inorea[bbrev] like ":noreabbrev" but for Insert mode
|:inoremenu| :inoreme[nu] like ":noremenu" but for Insert mode
|:intro| :int[ro] print the introductory message
|:iput| :ip[ut] like |:put|, but adjust the indent to the
current line
|:isearch| :is[earch] list one line where identifier matches
|:isplit| :isp[lit] split window and jump to definition of
identifier
@@ -1469,7 +1473,6 @@ tag command action ~
|:options| :opt[ions] open the options-window
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
|:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window
|:packadd| :pa[ckadd] add a plugin from 'packpath'
|:packloadall| :packl[oadall] load all packages under 'packpath'
|:pbuffer| :pb[uffer] edit buffer in the preview window
@@ -1522,6 +1525,7 @@ tag command action ~
|:redrawtabline| :redrawt[abline] force a redraw of the tabline
|:registers| :reg[isters] display the contents of registers
|:resize| :res[ize] change current window height
|:restart| :restart restart the Nvim server
|:retab| :ret[ab] change tab size
|:return| :retu[rn] return from a user function
|:rewind| :rew[ind] go to the first file in the argument list
@@ -1663,6 +1667,7 @@ tag command action ~
|:unabbreviate| :una[bbreviate] remove abbreviation
|:unhide| :unh[ide] open a window for each loaded file in the
buffer list
|:uniq| :uni[q] uniq lines
|:unlet| :unl[et] delete variable
|:unlockvar| :unlo[ckvar] unlock variables
|:unmap| :unm[ap] remove mapping

View File

@@ -29,7 +29,7 @@ use "CTRL-V 003" to insert a CTRL-C. Note: When CTRL-V is mapped you can
often use CTRL-Q instead |i_CTRL-Q|.
If you are working in a special language mode when inserting text, see the
'langmap' option, |'langmap'|, on how to avoid switching this mode on and off
'langmap' option, 'langmap', on how to avoid switching this mode on and off
all the time.
char action ~
@@ -269,15 +269,17 @@ The effect of the <BS>, CTRL-W, and CTRL-U depend on the 'backspace' option
item action ~
indent allow backspacing over autoindent
eol allow backspacing over end-of-line (join lines)
start allow backspacing over the start position of insert; CTRL-W and
CTRL-U stop once at the start position
eol allow backspacing over line breaks (join lines)
start allow backspacing over the start of insert; CTRL-W and CTRL-U stop
once at the start of insert.
nostop like start, except CTRL-W and CTRL-U do not stop at the start of
insert.
When 'backspace' is empty, Vi compatible backspacing is used. You cannot
backspace over autoindent, before column 1 or before where insert started.
For backwards compatibility the values "0", "1", "2" and "3" are also allowed,
see |'backspace'|.
see 'backspace'.
If the 'backspace' option does contain "eol" and the cursor is in column 1
when one of the three keys is used, the current line is joined with the
@@ -510,7 +512,7 @@ paragraph, no matter where the cursor currently is. Or you can use Visual
mode: hit "v", move to the end of the block, and type "gq". See also |gq|.
==============================================================================
4. 'expandtab', 'smarttab' and 'softtabstop' options *ins-expandtab*
4. 'expandtab', 'softtabstop' and 'smarttab' options *ins-expandtab*
If the 'expandtab' option is on, spaces will be used to fill the amount of
whitespace of the tab. If you want to enter a real <Tab>, type CTRL-V first
@@ -521,13 +523,6 @@ number of characters in the line increases. Backspacing will delete one
space at a time. The original character will be put back for only one space
that you backspace over (the last one).
*ins-smarttab*
When the 'smarttab' option is on, a <Tab> inserts 'shiftwidth' positions at
the beginning of a line and 'tabstop' positions in other places. This means
that often spaces instead of a <Tab> character are inserted. When 'smarttab'
is off, a <Tab> always inserts 'tabstop' positions, and 'shiftwidth' is only
used for ">>" and the like.
*ins-softtabstop*
When the 'softtabstop' option is non-zero, a <Tab> inserts 'softtabstop'
positions, and a <BS> used to delete white space, will delete 'softtabstop'
@@ -542,6 +537,13 @@ the cursor. Otherwise you cannot always delete a single character before the
cursor. You will have to delete 'softtabstop' characters first, and then type
extra spaces to get where you want to be.
*ins-smarttab*
When the 'smarttab' option is on, the <Tab> key indents by 'shiftwidth' if the
cursor is in leading whitespace. The <BS> key has the opposite effect. This
behaves as if 'softtabstop' were set to the value of 'shiftwidth'. This option
allows the user to set 'softtabstop' to a value other than 'shiftwidth' and
still use the <Tab> key for indentation.
==============================================================================
5. Replace mode *Replace* *Replace-mode* *mode-replace*
@@ -599,7 +601,7 @@ In 'list' mode, Virtual Replace mode acts as if it was not in 'list' mode,
unless "L" is in 'cpoptions'.
Note that the only situations for which characters beyond the cursor should
appear to move are in List mode |'list'|, and occasionally when 'wrap' is set
appear to move are in List mode 'list', and occasionally when 'wrap' is set
(and the line changes length to become shorter or wider than the width of the
screen). In other cases spaces may be inserted to avoid following characters
to move.
@@ -628,7 +630,8 @@ Completion can be done for:
10. User defined completion |i_CTRL-X_CTRL-U|
11. omni completion |i_CTRL-X_CTRL-O|
12. Spelling suggestions |i_CTRL-X_s|
13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P|
13. completions from 'complete' |i_CTRL-N| |i_CTRL-P|
14. contents from registers |i_CTRL-X_CTRL-R|
Additionally, |i_CTRL-X_CTRL-Z| stops completion without changing the text.
@@ -638,6 +641,9 @@ and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is
not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself,
CTRL-N (next), and CTRL-P (previous).
By default, the possible completions are showed in a menu and the first
completion is inserted into the text. This can be adjusted with 'completeopt'.
To get the current completion information, |complete_info()| can be used.
Also see the 'infercase' option if you want to adjust the case of the match.
@@ -651,10 +657,11 @@ When completion is active you can use CTRL-E to stop it and go back to the
originally typed text. The CTRL-E will not be inserted.
*complete_CTRL-Y*
When the popup menu is displayed you can use CTRL-Y to stop completion and
accept the currently selected entry. The CTRL-Y is not inserted. Typing a
space, Enter, or some other unprintable character will leave completion mode
and insert that typed character.
When the popup menu is displayed, CTRL-Y stops completion and accepts the
currently selected entry. Typing a space, Enter, or some other unprintable
character will leave completion mode and insert that typed character. If you
want to use <Enter> to accept a completion item, use this mapping: >vim
inoremap <expr> <cr> pumvisible() ? '<c-y>' : '<cr>'
When the popup menu is displayed there are a few more special keys, see
|popupmenu-keys|.
@@ -998,6 +1005,25 @@ CTRL-X CTRL-V Guess what kind of item is in front of the cursor and
completion, for example: >
:imap <Tab> <C-X><C-V>
Completing contents from registers *compl-register-words*
*i_CTRL-X_CTRL-R*
CTRL-X CTRL-R Guess what kind of item is in front of the cursor from
all registers and find the first match for it.
Further use of CTRL-R (without CTRL-X) will insert the
register content, see |i_CTRL-R|.
'ignorecase' applies to the matching.
CTRL-N Search forwards for next match. This match replaces
the previous one.
CTRL-P Search backwards for previous match. This match
replaces the previous one.
CTRL-X CTRL-R Further use of CTRL-X CTRL-R will copy the line
following the previous expansion in other contexts
unless a double CTRL-X is used (e.g. this switches
from completing register words to register contents).
User defined completion *compl-function*
Completion is done by a function that can be defined by the user with the
@@ -1058,25 +1084,23 @@ CTRL-X s Locate the word in front of the cursor and find the
previous one.
Completing keywords from different sources *compl-generic*
Completing from different sources *compl-generic*
*i_CTRL-N*
CTRL-N Find next match for words that start with the
keyword in front of the cursor, looking in places
specified with the 'complete' option. The found
keyword is inserted in front of the cursor.
CTRL-N Find the next match for a word ending at the cursor,
using the sources specified in the 'complete' option.
All sources complete from keywords, except functions,
which may complete from non-keyword. The matched
text is inserted before the cursor.
*i_CTRL-P*
CTRL-P Find previous match for words that start with the
keyword in front of the cursor, looking in places
specified with the 'complete' option. The found
keyword is inserted in front of the cursor.
CTRL-P Same as CTRL-N, but find the previous match.
CTRL-N Search forward for next matching keyword. This
keyword replaces the previous matching keyword.
CTRL-N Search forward through the matches and insert the
next one.
CTRL-P Search backwards for next matching keyword. This
keyword replaces the previous matching keyword.
CTRL-P Search backward through the matches and insert the
previous one.
CTRL-X CTRL-N or
CTRL-X CTRL-P Further use of CTRL-X CTRL-N or CTRL-X CTRL-P will
@@ -1090,26 +1114,25 @@ Stop completion *compl-stop*
CTRL-X CTRL-Z Stop completion without changing the text.
AUTO-COMPLETION *compl-autocomplete*
AUTOCOMPLETION *ins-autocompletion*
To get LSP-driven auto-completion, see |lsp-completion|. To get basic
auto-completion without installing plugins or LSP, try this: >lua
Vim can display a completion menu as you type, similar to using |i_CTRL-N|,
but triggered automatically. See 'autocomplete'. The menu items are collected
from the sources listed in the 'complete' option, in order.
A decaying timeout keeps Vim responsive. Sources earlier in the 'complete'
list get more time (higher priority), but all sources receive at least a small
time slice.
This mode is fully compatible with other completion modes. You can invoke
any of them at any time by typing |CTRL-X|, which temporarily suspends
autocompletion. To use |i_CTRL-N| or |i_CTRL-X_CTRL-N| specifically, press
|CTRL-E| first to dismiss the popup menu (see |complete_CTRL-E|).
See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'.
To get LSP-driven auto-completion, see |lsp-completion|.
local triggers = {'.'}
vim.api.nvim_create_autocmd('InsertCharPre', {
buffer = vim.api.nvim_get_current_buf(),
callback = function()
if vim.fn.pumvisible() == 1 or vim.fn.state('m') == 'm' then
return
end
local char = vim.v.char
if vim.list_contains(triggers, char) then
local key = vim.keycode('<C-x><C-n>')
vim.api.nvim_feedkeys(key, 'm', false)
end
end
})
<
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
@@ -1162,6 +1185,9 @@ For example, the function can contain this: >
let matches = ... list of words ...
return {'words': matches, 'refresh': 'always'}
<
If looking for matches is time-consuming, |complete_check()| may be used to
maintain responsiveness.
*complete-items*
Each list item can either be a string or a Dictionary. When it is a string it
is used as the completion. When it is a Dictionary it can contain these
@@ -1296,6 +1322,7 @@ use all space available.
The 'pumwidth' option can be used to set a minimum width. The default is 15
characters.
*compl-states*
There are three states:
1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P.
2. A cursor key has been used to select another match. The match was not
@@ -1923,7 +1950,7 @@ These commands are used to start inserting text. You can end insert mode with
<Esc>. See |mode-ins-repl| for the other special characters in Insert mode.
The effect of [count] takes place after Insert mode is exited.
The following commands insert text, but stay in normal mode:
The following |default-mappings| insert text, but stay in normal mode:
*]<Space>*
]<Space> Insert an empty line below the cursor without leaving

View File

@@ -89,7 +89,7 @@ To uninstall Nvim:
- Scoop (Windows): `scoop uninstall neovim`
==============================================================================
Sponsor Vim/Nvim development *sponsor* *register*
Sponsor Vim/Nvim development *sponsor*
Fixing bugs and adding new features takes a lot of time and effort. To show
your appreciation for the work and motivate developers to continue working on
@@ -605,7 +605,7 @@ status messages will only be used if an option is on: >
command characters 'showcmd' on off
cursor position 'ruler' off off
The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The
The current mode is "-- INSERT --" or "-- REPLACE --", see 'showmode'. The
command characters are those that you typed but were not used yet.
If you have a slow terminal you can switch off the status messages to speed
@@ -711,5 +711,4 @@ Arbitrary code registered via |:UpdateRemotePlugins|, that runs in a separate
process and communicates with Nvim via the |api|.
==============================================================================
vim:tw=78:ts=8:et:sw=4:ft=help:norl:

View File

@@ -140,5 +140,4 @@ A job may be killed at any time with the |jobstop()| function:
<
Individual streams can be closed without killing the job, see |chanclose()|.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More