Commit Graph

10843 Commits

Author SHA1 Message Date
Justin M. Keyes
f1fad32e2e docs: misc, custom text-object #39877
text-object-define is a pattern I found in tpope's plugins (e.g.
https://github.com/tpope/vim-jdaddy) which shows an elegant way to
define a text-object. (Any mistakes in the example are my fault.)
2026-05-20 05:21:27 -04:00
Barrett Ruth
5181984db9 fix(api): nvim_exec_autocmds({buf=x}) runs in buffer context #39061
Problem: `nvim_exec_autocmds({ buf = ... })` matches the target buffer, but callbacks and modelines run with the caller buffer current rather than the target buffer.

Solution: Execute the buffered path in prepared target-buffer context and restore the caller afterward.
2026-05-20 03:48:55 -04:00
Olivia Kinnear
ea8f1463dd fix(lua): fields of nvim.spellfile.Opts are optional #39902 2026-05-20 02:47:35 -04:00
zeertzjq
3bc21c0903 vim-patch:9.2.0502: runtime(netrw): bookmark handling can be improved (#39900)
Problem:  To goto or delete a bookmark, one needs to prefix a count
          for the bookmark number (e.g., "2gb" to open bookmark#2).
          As the bookmark list gets or deletes entries, the numbers
          keep changing, requiring listing the bookmarks with qb to
          discover the desired bookmark number. Typing gb or mB
          without a count targets g:netrw_bookmarklist[-1].
Solution: If no count is given to gb or mB, list all bookmarks and
          prompt for a number using inputlist(), similar to tag jump
          with g].

closes: vim/vim#20211

35b767a090

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

This PR reverses the effect of the commit #f03155a.

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

d004cc4f89

Co-authored-by: tecis <67809811+tecis@users.noreply.github.com>
2026-05-20 00:30:00 +00:00
Barrett Ruth
353d2a4e4a feat(normal): lines textobject "il", "al" #39845
`al` to select the whole buffer linewise.
`il` to select the current line without surrounding whitespace.
2026-05-19 05:08:23 -04:00
zeertzjq
f3bb21e71d vim-patch:9.2.0500: filetype: some html files wrongly recognized as htmlangular (#39880)
Problem:  filetype: some html files are wrongly recognized as htmlangular
Solution: Use the \< atom to anchor ng-template and ng-content to start
          of word (truffle)

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

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

354ab1a69e

Co-authored-by: truffle <truffleagent@gmail.com>
2026-05-19 08:42:05 +08:00
Justin M. Keyes
d8ec793379 Merge #39822 from ofseed/pos-mark
feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
2026-05-18 10:45:21 -04:00
Yi Ming
ff43f1950e feat(lsp)!: deprecate vim.lsp.util.character_offset() 2026-05-18 22:19:07 +08:00
Yi Ming
856bc6d284 fix(range): handle inclusive/exclusive positions on multibyte characters 2026-05-18 22:19:07 +08:00
Yi Ming
f2b031136f feat(pos,range): pos:to_mark(), pos.mark(), range:to_mark(), range.mark()
Problem:
Ranges represented by marks are usually end-inclusive,
but the range utilities we provided are end-exclusive.

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

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

For example given the following Test command and TestComplete function:

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

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

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

f0e874a129

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

Solution:
Use filterText fallback so selected item respects typed trigger chars.
2026-05-18 05:25:41 -04:00
Justin M. Keyes
82cc02d19f docs: misc, $NVIM_TERMDEFS 2026-05-18 11:20:18 +02:00
zeertzjq
878718fa76 vim-patch:9.2.0496: [security]: Code Injection in cucumber filetype plugin
Problem:  [security]: Code Injection in cucumber filetype plugin
          (Christopher Lusk)
Solution: Use rubys Regexp.new() with the untrusted pattern

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

a65a52d684

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

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

f08ab2f4d7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-18 08:11:18 +08:00
zeertzjq
7096631249 vim-patch:2a01e59: runtime(just): add 'suffixesadd' to ftplugin
closes: vim/vim#20197

2a01e59671

Co-authored-by: mathmil <82173590+mathmil@users.noreply.github.com>
2026-05-18 08:11:17 +08:00
zeertzjq
66d85a2732 vim-patch:23c77d8: runtime(sh): Do not conflate empty array and function declarations in Bash
Although the "=" character is permitted in function names,
a construct that parses as a variable assignment is
preferred to it parsing as a function declaration.  See the
updated test file "sh_functions_bash.sh" for details.

fixes:  vim/vim#20183
closes: vim/vim#20205

23c77d8ec8

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-05-18 08:11:17 +08:00
zeertzjq
5a78c5baf6 fix(netrw): fix g:netrw_home not respected 2026-05-18 08:11:17 +08:00
Kyle
84d5c5f4bf feat(tui): $NVIM_TERMDEFS can override builtin terminfo #39555
Problem:
- Windows users can't use terminfo to configure their terminal
  capabilities. #37274
- Terminfo definitions sometimes get out of date or are simply
  inaccurate.
- Eventually, we may want to drop terminfo, relying primarily on
  built-in definitions. Users will still need some flexibility.

Solution:
Support $NVIM_TERMDEFS environment variable, which is JSON data that
defines "terminfo" definitions that override our builtin terminfo.
2026-05-17 13:02:46 -04:00
Puneet Dixit
fff9897ce3 fix(startup): emitting useless OptionSet #39830
Problem:
During startup, we manually trigger a useless and misleading `OptionSet`
event, which doesn't set `v:option_*` values (this is a limitation of
`nvim_exec_autocmds`).
ad4bc2d90c/runtime/lua/vim/_core/defaults.lua (L939).

Solution:
The `nvim_exec_autocmds('OptionSet',…)` call does not serve any purpose
since 5cbb9d613b, so just drop it.
2026-05-17 12:18:24 -04:00
glepnir
767fbd88ff fix(lsp): fallback to filterText for non-matching PlainText items #39695
Problem:
PlainText completion items used `textEdit.newText` or `insertText` as
the completion word even when they did not match the typed prefix. This
could break popup completion behavior like 'completeopt+=longest'.

Solution:
Fall back to `filterText` when `newText` or `insertText` does not match
the typed prefix.
2026-05-17 11:58:49 -04:00
Justin M. Keyes
a562fb33ca Merge #39820 from echasnovski/pack-get-more 2026-05-17 11:51:39 -04:00
Evgeni Chasnovski
db0682fe50 feat(ui): vim.ui.input(opts.scope) #39570
Problem: There is no way for a `vim.ui.input` caller to indicate for
  which scope the input is. As in "This input is for something at cursor
  scope". This information can be useful for `vim.ui.input`
  implementation to tweak its behavior and presentation:
  - Show different floating window depending on the scope. For example:
    - Near cursor for "cursor" scope.
    - At line start for "line" scope.
    - In window corner for "buffer" and "window" scopes.
    - In whole editor corner for "tabpage", "editor", "project" scopes.
  - Navigate through history only for inputs with the same scope.

Solution: Document new `opts.scope` for `vim.ui.input`. Use it in the
  codebase.
2026-05-17 11:34:06 -04:00
Justin M. Keyes
846b8b2420 refactor: group nvim_buf_call, nvim_win_call tests #39828 2026-05-17 11:20:54 -04:00
Evgeni Chasnovski
8f379be261 feat(pack): update get() to be able to fetch data from plugin source
Problem: There is currently no convenient way to programmatically check
  for new updates from plugin source. Running `vim.pack.update()` is one
  approach, but it opens a confirmation buffer that requires a manual
  action to close.

Solution: Add `opts.offline` to `vim.pack.get()` that will first fetch
  new updates from plugin source before computing the output.
2026-05-17 18:17:13 +03:00
Evgeni Chasnovski
b9c4329c35 feat(pack): update get() to return revision of a pending update
Problem: No convenient way to programmatically get the revision that
  would be checked out after `vim.pack.update()` (with `offline=true`).
  Doing this manually requires resolving `spec.version` which is not
  trivial.  This data can be useful for custom reporting of pending
  updates or third party confirmation step.

Solution: Make `get()` include a new field for the revision that points
  at the state after applying pending update. This is also the same as
  the revision of resolved `spec.version`.
2026-05-17 18:14:01 +03:00
bfredl
0aa7d2f4d5 feat(api): nvim_buf_call, win_call can has multiple return values #39801
from the "because we can and it is not much code" department. (diffcount
excluding tests is actually negative)

fixes https://github.com/neovim/neovim/issues/39636#issuecomment-4397141270
2026-05-17 10:25:22 -04:00
Justin M. Keyes
e572c9c80a feat(api): tab-local option scope #39811
Problem:
2d795face6 added support for tab-local options ('cmdheight')
to `nvim_get_option_value`, but not to:

    nvim_get_option_info2()
    nvim_set_option_value(…, { tab = … })
    gettabwinvar()

Solution:
- Update `options.lua` to model tab-local options. Introduce `kOptScopeTab`.
- Handle tab scope in the options layer so it works for all options APIs.

Note:
- No change to `gettabvar()`. Not sure if needed/wanted.

fix https://github.com/neovim/neovim/issues/31140
2026-05-17 10:24:46 -04:00
Justin M. Keyes
c55b6128f8 docs: misc #39817 2026-05-17 10:02:12 -04:00
Ayose C.
3ace049c6a feat(vim.hl): vim.hl.hl_op() #39777
Problem:
vim.hl.on_yank() only works for TextYankPost, not TextPutPost.

Solution:
Introduce hl_op().
Deprecate on_yank().
2026-05-17 09:56:37 -04:00
zeertzjq
ce7137da41 vim-patch:f03155a: runtime(htmldjango): Add syntax highlighting of comparison operators
The presence `djangoOperators` in the file `syntax/django.vim` and
having the highlight function with a `match` statement leads to a
highlight spill-over with other elements defined in `syntax/html.vim`.
To avoid the highlight spill-over declare a region called
`djangoTagBlockNaive` to limit `djangoOperator` to only be matched
within.

related: vim/vim#20225
closes:  vim/vim#20232

f03155aa2a

Co-authored-by: tecis <67809811+tecis@users.noreply.github.com>
2026-05-17 16:49:48 +08:00
zeertzjq
1b6063db59 vim-patch:8b25d90: runtime(django): Resolve FIXME of comparrison operators + localization tags
Summary: Add highlight of comparison operators resolving FIXME left by maintainer.

How it works: By creating a the variable ‘djangoOperator’ with the regex
and defining to only highlight when enclosed within ‘djangoTag’ and
‘djangoVarBlock’ the highlight works as expected.

Note: Note even though the maintainer had left the note “FIXME ==, !=,
      <, >, <=, and >= should be djangoStatements” the results do work
as I think he intended even though the variable ‘djangoOperator’ had to
be created to achieve the result. By doing it this way the highlight
process does not get confused depending on the spacing of the comparison
operator. Example: {{ x>=10 }} and {{ x >= 10 }} work as expected.

Add tags related to localization.

Documentation source:

- https://docs.djangoproject.com/en/5.2/topics/i18n/formatting/#controlling-localization-in-templates

closes: vim/vim#20225

8b25d90b08

Co-authored-by: tecis <67809811+tecis@users.noreply.github.com>
2026-05-17 16:49:27 +08:00
Evgeni Chasnovski
8d100483e0 feat(pack): update get() to take rev from actual repo if info=true
Problem: `vim.pack.get()` always uses lockfile as the source for the
  `rev` field. This is fast, but may be misleading in case of
  a corrupted lockfile.

Solution: Compute revision from Git repo on disk if `info=true`
  (default), use lockfile otherwise. This does increase execution time
  (as a result of one extra `git ...` call for every plugin), but
  `info=true` is already designed to be informative and not necessarily
  fast.
2026-05-17 10:49:48 +03:00
yashlala
7d99104058 feat(events): add TabMoved autocommand event #24137
Problem:
No way to handle a "tab moved" event.
Use-case: tabline plugins may cache tab labels, and need to know when to
invalidate their cache.

Solution:
Add a `TabMoved` event that triggers whenever tabs are reordered via `:tabmove`
or via mouse click-and-drag.
2026-05-16 13:55:42 -04:00
Yi Ming
a7f09db9de refactor(lsp): remove some private utility functions
Problem:
`make_position_params`/`get_line_byte_from_position`/`make_line_range_params`
are private functions and their functionality can be replaced by `vim.pos` now.

Solution:
Remove them, use `vim.pos` instead.
2026-05-16 23:47:38 +08:00
Yi Ming
1c687c76b0 refactor(pos): move get_lines from lsp.util to pos 2026-05-16 23:47:38 +08:00
Yi Ming
6f5ba9ebf6 fix(pos): precisely handle positions at the end of the file 2026-05-16 23:44:54 +08:00
Tomas Slusny
a0637e0c4e feat(prompt): support 'scrollback' option in prompt-buffers #39793
Problem:
There is a lot of overlap between terminal and prompt buffer, but no
easy way to limit the number of lines kept above the prompt to prevent
performance and other issues. This is desirable for both example
use cases in current documentation, chat UI and repl/shell plugins.

Solution:
Use existing 'scrollback' option to limit prompt-buffer lines
as well.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2026-05-16 10:14:18 -04:00
EliWiegman
2d795face6 fix(api): nvim_get_option_value tab-local 'cmdheight' #39259
Problem:
API clients cannot query the tab-local value of 'cmdheight'.

Solution:
Allow nvim_get_option_value() to accept { tab = <tab-ID> } for 'cmdheight'.
2026-05-16 09:31:05 -04:00
Olivia Kinnear
b62c1049c0 feat(pack): :packupdate, :packdel commands #39693
Define `:packupdate` and `:packdel` as separate commands instead of a
unified `:pack {subcommand}` because the semantics between the two
commands vary differently enough that it doesn't make sense to combine
them. Additionally, `:pack! update/del` looks bad.
2026-05-16 05:15:05 -04:00
zeertzjq
cca6dc0ae2 vim-patch:591db92: runtime(zip,tar): Add support for compressed .cbz and .cbt files
*.cbz and *.cbt files are just zip and tar files for comic books.
https://en.wikipedia.org/wiki/Comic_book_archive

closes: vim/vim#20206

591db923ba

Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
2026-05-16 16:54:11 +08:00
zeertzjq
c165202b79 vim-patch:f7e239b: runtime(sh): Update syntax, don't include parens in function name highlighting
Parentheses are not part of the function name so highlight them
differently.

closes: vim/vim#20219

f7e239bd0e

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-05-16 16:54:11 +08:00
zeertzjq
925b14ce2b vim-patch:9.2.0489: filetype: some Objective-C files are not recognized
Problem:  filetype: some Objective-C files are not recognized
Solution: Add g:filetype_mm override variable, improve the objective c
          pattern detection (Keith Smiley).

closes: vim/vim#20221

bc7f736a39

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2026-05-16 16:54:11 +08:00
zeertzjq
1813e1c089 vim-patch:9.2.0486: out-of-bound read when recovering swap files (#39807)
Problem:  out-of-bound read when recovering corrupted swap files
          (Rahul Hoysala)
Solution: Validate the db_txt_start field when recovering a swap
          file.

Supported by AI

de7a5b5425

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-16 08:07:22 +08:00
zeertzjq
d8c464a0fa vim-patch:77b8a12: runtime(doc): Update 'softtabstop' documentation (#39806)
closes: vim/vim#20218

77b8a12f82

Co-authored-by: Jonathan Demme <j.b.demme@gmail.com>
2026-05-16 07:50:56 +08:00
zeertzjq
10432d0df8 vim-patch:9.2.0481: runtime(netrw): command injection possible via maps
Problem:  runtime(netrw): command injection possible via crafted
          directory names in NetrwMaps() (Christopher Lusk)
Solution: Temporarily remove B flag in NetrwMaps() to prevent command
          injection

8e41c34aba

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-15 09:09:35 +08:00
zeertzjq
86c5703111 vim-patch:9.2.0480: [security]: runtime(netrw): code injection via mf command
Problem:  [security]: runtime(netrw): code injection via mf command
          (Christopher Lusk, Zdenek Dohnal)
Solution: Do not use string concatenation inside the filter() commands
          (Zdenek Dohnal)

Github Security Advisory:
https://github.com/vim/vim/security/advisories/GHSA-66hr-7p6x-x5j3

8af0f098c3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-05-15 09:05:59 +08:00
Jackson Ludwig
1e09b020e5 fix(difftool): handle filenames containing spaces #39740
Problem:
Using the `DiffTool` plugin (e.g. through `nvim -d ...` or `:DiffTool
<file1> <file2>` fails if a space is in one of the paths. This occurs
because the `diff` wraps the paths with quotes (`'`) if space
characters are present, which the line diff regex fails to parse.

Solution:
Update regex to handle quoted paths by matching the string within the
quotes, if it exists.
2026-05-14 20:23:39 -04:00